hulud-party-scanner 1.0.0 → 1.0.1
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/package.json +2 -2
- package/scan.js +14 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hulud-party-scanner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"preferGlobal": true,
|
|
5
5
|
"bin": {
|
|
6
6
|
"hulud-party-scanner": "./scan.js"
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
"author": "miguel.sngular",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"repository": "https://github.com/migohe14/hulud-scanner"
|
|
16
|
-
}
|
|
16
|
+
}
|
package/scan.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const https = require('https');
|
|
4
4
|
const path = require('path');
|
|
@@ -149,7 +149,19 @@ function scanForMaliciousFiles(directory) {
|
|
|
149
149
|
async function main() {
|
|
150
150
|
try {
|
|
151
151
|
// Use the provided path or the current directory.
|
|
152
|
-
|
|
152
|
+
// This handles arguments like `npx tool .` or `npx tool -- /path/to/project`
|
|
153
|
+
const args = process.argv.slice(2);
|
|
154
|
+
const doubleDashIndex = args.indexOf('--');
|
|
155
|
+
|
|
156
|
+
let targetArg;
|
|
157
|
+
if (doubleDashIndex !== -1) {
|
|
158
|
+
// If '--' is present, the path is the argument right after it.
|
|
159
|
+
targetArg = args[doubleDashIndex + 1];
|
|
160
|
+
} else {
|
|
161
|
+
// Otherwise, it's the first argument.
|
|
162
|
+
targetArg = args[0];
|
|
163
|
+
}
|
|
164
|
+
const targetPath = targetArg || '.';
|
|
153
165
|
const projectRoot = path.resolve(targetPath);
|
|
154
166
|
|
|
155
167
|
if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
|