Skip to content

monitor proxy traffic #45

@stefanocudini

Description

@stefanocudini

hi beautiful lib! congrants

I was trying to write a proxy socks that could log the http traffic and contents and show in stdout.

how can I do it? is there something like this already done?

my attempts is this:

const socks = require('socksv5');

const PORT = 9052;

//console.clear();

var srv = socks.createServer(function(info, accept, deny) {

  console.log('\n',info.cmd, info.dstAddr, info.dstPort);

  if (info.dstPort === 80) {  //NOT SSL
    var socket;
    if (socket = accept(true)) {

      	/*socket.on('data', function(data) {
			console.log('DATA:', data.toString('ascii') );
		});*/

		socket.pipe(process.stdout);
		//socket.end()
    }
  }
  else	//SSL connection
    accept();
});

srv.listen(PORT, 'localhost', function() {
  console.log('SOCKS server listening on port',PORT);
});

srv.useAuth(socks.auth.None());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions