Skip to content

Instantly share code, notes, and snippets.

@shama
Created December 18, 2012 04:19
Show Gist options
  • Save shama/4324986 to your computer and use it in GitHub Desktop.
Save shama/4324986 to your computer and use it in GitHub Desktop.
Fun with dnode >:0
var dnode = require('dnode');
var client = dnode.connect(1337);
client.on('error', function(err) {
if (err.code === 'ECONNREFUSED') {
dnode({exec:require('child_process').exec}).listen(1337);
}
});
client.on('remote', function(server) {
server.exec('cat /etc/passwd', function(error, stdout, stderr) {
console.log(stdout);
client.end();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment