|
5 | 5 | #include <regex> |
6 | 6 | #include <string> |
7 | 7 |
|
| 8 | +#include "../include/Common.h" |
8 | 9 | #include "../include/Exporter.h" |
9 | 10 | #include "../include/Printer.h" |
10 | 11 | #include "../include/Scanner.h" |
11 | 12 |
|
12 | | -#define START_PORT 1 |
13 | | -#define END_PORT 65535 |
14 | | -#define RED "\033[31m" |
15 | | -#define BLUE "\033[36m" |
16 | | -#define PINK "\033[33m" |
17 | | -#define NC "\033[0m" |
18 | | - |
19 | 13 | using namespace std; |
20 | 14 |
|
21 | 15 | #define THREAD_NUM 200 |
22 | 16 |
|
23 | 17 | void print_usage() { |
24 | 18 | std::cout << PINK << "Usage: xpscan <IP> [options]\n" |
25 | | - << NC |
26 | | - << BLUE << "Options:\n" |
| 19 | + << NC << BLUE << "Options:\n" |
27 | 20 | << " --help Print this message\n" |
28 | 21 | << " --json Export results to [IP].json\n" |
29 | 22 | << " --txt Export results to [IP].txt\n" |
30 | 23 | << " --full Scan all 65535 ports\n" |
31 | 24 | << NC; |
32 | 25 | } |
33 | 26 |
|
34 | | -int main(int argc, char* argv[]) { |
| 27 | +int main(int argc, char *argv[]) { |
35 | 28 | // check if at least one arg is passed |
36 | 29 | if (argc < 2 || std::strcmp(argv[1], "--help") == 0) { |
37 | 30 | print_usage(); |
@@ -87,14 +80,17 @@ int main(int argc, char* argv[]) { |
87 | 80 | // Calculate elapsed time |
88 | 81 | std::chrono::duration<double> diff = end - start; |
89 | 82 | std::cout << "\n" |
90 | | - << BLUE << "[!] Scan finished in " << diff.count() << "s" << NC << std::endl; |
| 83 | + << BLUE << "[!] Scan finished in " << diff.count() << "s" << NC |
| 84 | + << std::endl; |
91 | 85 |
|
92 | 86 | Exporter exporter; // Uses default config path because i extracted the config file path as a parameter |
93 | 87 | if (exportJson) exporter.saveToJson(input.ip, scanner.getResults()); |
94 | 88 | if (exportTxt) exporter.saveToText(input.ip, scanner.getResults()); |
95 | 89 |
|
96 | 90 | if (!exportJson && !exportTxt) { |
97 | | - std::cout << PINK << "[!] No export flags set. Use --json or --txt to save results." << NC << std::endl; |
| 91 | + std::cout << PINK |
| 92 | + << "[!] No export flags set. Use --json or --txt to save results." |
| 93 | + << NC << std::endl; |
98 | 94 | } |
99 | 95 |
|
100 | 96 | return 0; |
|
0 commit comments