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?

  1. open command line using node api
  2. listen commands server url /xmlrpc-urlhere/
  3. when command received via ajax or webrtc? execute in command line
  4. 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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -