node.js - Creating a Nodejs local reverse shell over Ajax? -
i'm attempting make small node executable has ability open local shell , send , receive commands http server.
seems simple enough logically best practice in implementing this?
- open command line using node api
- listen commands server url /xmlrpc-urlhere/
- when command received via ajax or webrtc? execute in command line
- post command line response user
this shell administrative purposes.
i can't think of way of doing this, i've checked npm , seem there basic command line modules node js nothing has functionality.
the npm modules commander
, request
ought trick. started, here's simple command line tool issues search google , dumps raw html console.
eg:
./search.js puppies
#!/usr/bin/env node var program = require('commander'); var request = require('request'); var search; program .version('0.0.1') .arguments('<query>') .action(function(query) { search = query; }); program.parse(process.argv); if (typeof search === 'undefined') { console.error('no query given!'); process.exit(1); } var url = 'http://google.com/search?q=' + encodeuricomponent(search); request(url, function(err, res, body) { if (err) { console.error(err); process.exit(1); } console.log('search result:'); console.log(body); process.exit(0); });
Comments
Post a Comment