-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.js
More file actions
70 lines (56 loc) · 1.91 KB
/
index.js
File metadata and controls
70 lines (56 loc) · 1.91 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
70
#!/usr/bin/env node
// GitRecon - Modüler versiyonu
// Orijinal main function logic'i Scanner sınıfında
const Scanner = require('./src/core/scanner');
// Main function
const main = async () => {
const scanner = new Scanner();
try {
// Check if running in interactive mode
if (process.argv.includes('--interactive') || process.argv.includes('-i')) {
await scanner.runInteractive();
return;
}
// Check if environment validation requested
if (process.argv.includes('--check-env')) {
await scanner.displayEnvironmentCheck();
return;
}
// Check if status requested
if (process.argv.includes('--status')) {
const status = scanner.getStatus();
console.log(JSON.stringify(status, null, 2));
return;
} // Run normal scanning
await scanner.run(process.argv.slice(2));
} catch (error) {
console.error('GitRecon failed:', error.message);
if (process.argv.includes('--verbose') || process.argv.includes('-v')) {
console.error(error.stack);
}
process.exit(1);
} finally {
// Cleanup resources
scanner.cleanup();
}
};
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\n🛑 Scanning interrupted by user');
process.exit(0);
});
process.on('SIGTERM', () => {
console.log('\n🛑 Scanning terminated');
process.exit(0);
});
// Handle uncaught exceptions
process.on('uncaughtException', (error) => {
console.error('Uncaught Exception:', error.message);
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
process.exit(1);
});
// Run the main function and handle errors - orijinal koddan
main().catch((error) => console.error(error));