-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·69 lines (55 loc) · 1.56 KB
/
cli.js
File metadata and controls
executable file
·69 lines (55 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env node
/**
* secops-bot CLI
* Usage: ./cli.js <target> [--deep]
*/
import { runScan, validateTarget } from './src/scanner.js';
const args = process.argv.slice(2);
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
console.log(`
secops-bot CLI 🔒
━━━━━━━━━━━━━━━━━━━━━━━━━━━
Usage:
./cli.js <target> [options]
Options:
--deep Run deep scan (full port range)
--help Show this help
Examples:
./cli.js example.com
./cli.js 192.168.1.1 --deep
⚠️ Only scan targets you own or have permission to test.
`);
process.exit(0);
}
const target = args.find(a => !a.startsWith('--'));
const isDeep = args.includes('--deep');
if (!target) {
console.error('Error: No target specified');
process.exit(1);
}
// Validate
const validation = validateTarget(target);
if (!validation.valid) {
console.error(`Error: ${validation.error}`);
process.exit(1);
}
console.log(`
🔒 secops-bot scan
━━━━━━━━━━━━━━━━━━━━━━━━━━━
Target: ${validation.target}
Type: ${isDeep ? 'Deep' : 'Basic'}
━━━━━━━━━━━━━━━━━━━━━━━━━━━
`);
try {
const result = await runScan(validation.target);
if (result.success) {
console.log(result.report);
console.log(`\n📁 Full report saved to: ${result.reportPath}`);
} else {
console.error(`Scan failed: ${result.error}`);
process.exit(1);
}
} catch (err) {
console.error(`Error: ${err.message}`);
process.exit(1);
}