[GLLUG] Netcat Bash prompt

Daniel Griswold daniel at griswoldcomputing.com
Thu Dec 4 17:55:27 EST 2014


 

If that is working, this will pull stderr into stdin. It's counter
intuitive because it is after the redirect to the fifo file. 

nc -l 5555 < pipe_name_out | /bin/bash > pipe_name_in 2>&1
If you want the output to go back to the client, only one pipe is
needed.mkfifo pipenc -l 5555 < pipe | /bin/bash > pipe 2>&1 

On 2014-12-04 17:28, Michael P. Flaga wrote: 

> The below basically works. 
> 
> sets up a pipe handle to funnel data to and from 
> 
> mkfifo pipe_name_in 
> 
> mkfifo pipe_name_out 
> 
> connects netcat to bash, via the pipes. 
> 
> nc -l 5555 < pipe_name_out | /bin/bash > pipe_name_in 
> 
> But I am not able to figure out how to pipe the 2>1& correctly between /bin/bash > pipe_name_in 
> 
> Michael P. Flaga, michael at flaga.net 
> 
> FROM: Michael P. Flaga [mailto:michael at flaga.net] 
> SENT: Thursday, December 04, 2014 5:25 PM
> TO: Daniel Griswold
> CC: 'Jason L. Froebe'; 'GLLUG'
> SUBJECT: RE: [GLLUG] Netcat Bash prompt 
> 
> The windows machine's program will initiate a telnet to something (likely the Linux Box)? Where the linux jump box is only (initially) accepting SSH. Telnetd has been removed and 23 been block, even from local access. 
> 
> So the idea is to get netcat (-t for telnet emulation), on some other port, to pipe to and from bash. As to emulate a Telnet on the linux box. Noting that telnetd has been removed. So that the Telnet client can either connect directly to the linux box's netcat -t port. Or through a tunnel to it, if needed. Which does not appear to be needed, as I can netcat directly between the two machines on any port other than 22 (being used) and 23(blocked), as the rest are allowed. 
> 
> Michael P. Flaga, michael at flaga.net 
> 
> FROM: Daniel Griswold [mailto:daniel at griswoldcomputing.com] 
> SENT: Thursday, December 04, 2014 5:08 PM
> TO: michael at flaga.net
> CC: 'Jason L. Froebe'; 'GLLUG'
> SUBJECT: Re: [GLLUG] Netcat Bash prompt 
> 
> "ssh $jumpserver ssh $targetserver /bin/bash -i" will give the client an interactive session on the target server 
> 
> if using ssh keys/agents to not require interactive authentication, you can do: 
> 
> echo "command" | ssh $jumpserver ssh $targetserver /bin/bash 
> 
> which will run the command on the remote host and return when the process on the remote host terminates. 
> 
> I'm confused as to whether the connections are initiating to terminating at the linux servers. The Windows implementation may not support the above. 
> 
> --Daniel 
> 
> On 2014-12-04 16:22, Michael P. Flaga wrote: 
> 
>> Yes, I can create a tunnel over, but not forwarded onto another IP, rather need a bash prompt. So that the telneting program can call bash commands at the remote linux box. 
>> 
>> The goal is to not simply tunnel the telnet. But rather translate it. Noting that telnetd is gone from the remote linux box. 
>> 
>> Netcat is there, so "-t" will answer TELNET negotiation in place of telnetd. 
>> 
>> Michael P. Flaga, michael at flaga.net 
>> 
>> FROM: Jason L. Froebe [mailto:jason.froebe at gmail.com] 
>> SENT: Thursday, December 04, 2014 4:12 PM
>> TO: Michael Flaga
>> CC: GLLUG
>> SUBJECT: Re: [GLLUG] Netcat Bash prompt 
>> 
>> On the windows box, use putty to create a ssh tunnel to your Linux box. This way nothing is transferred unencrypted over the network. 
>> 
>> Jason 
>> 
>> On Dec 4, 2014 4:02 PM, "Michael P. Flaga" <michael at flaga.net> wrote: 
>> 
>> I have closed source programs that telnet on windows boxes. Where I am constrained to Linux Jump servers. That now only have SSH. The Telnet is GONE on the jump servers. The closed source programs once connected (formerly via telnet) to the jump servers then know who to issue the commands to ssh into the remote targets. 
>> 
>> I need a way to translate Telnet to SSH on the jump servers. 
>> 
>> The netcat on the jump servers do not have the -e option, so I cannot run nc in telnet mode into /bin/bash. 
>> 
>> I have found 
>> 
>> mkfifo pipe_name_in 
>> 
>> mkfifo pipe_name_out 
>> 
>> nc -l 5555 < pipe_name_out | /bin/bash > pipe_name_in 
>> 
>> which kind of works. However, the Standard Error does not go down the pipe. 
>> 
>> So I don't get any echo or prompts, only the response. 
>> 
>> nc -l 5555 < pipe_name_out | /bin/bash 2> pipe_name_in 
>> 
>> does get the some of the prompts but then no responses. 
>> 
>> nc -l 5555 < pipe_name_out | /bin/bash 2>&1 pipe_name_in 
>> 
>> fails to allow connections. 
>> 
>> Any suggestions or solutions? 
>> 
>> Michael P. Flaga, michael at flaga.net 
>> 
>> _______________________________________________
>> linux-user mailing list
>> linux-user at egr.msu.edu
>> http://mailman.egr.msu.edu/mailman/listinfo/linux-user [1] 
>> 
>> _______________________________________________
>> 
>> linux-user mailing list
>> 
>> linux-user at egr.msu.edu
>> 
>> http://mailman.egr.msu.edu/mailman/listinfo/linux-user [1]

 

Links:
------
[1] http://mailman.egr.msu.edu/mailman/listinfo/linux-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.egr.msu.edu/mailman/public/linux-user/attachments/20141204/0229f979/attachment.html>


More information about the linux-user mailing list