|
2 | 2 |
|
3 | 3 | Rust command line utility for quick asynchronous network hosts scanning. |
4 | 4 |
|
5 | | -NOTE: in order to use the tool you may need to increase the maximum allowed |
6 | | -open files. E.g.: |
| 5 | +> NOTE: in order to use the tool you may need to increase the maximum allowed |
| 6 | +> open files. E.g.: |
7 | 7 |
|
8 | 8 | ```bash |
9 | 9 | ulimit -n 10000 |
10 | 10 | ``` |
11 | 11 |
|
| 12 | +> NOTE: for the ping scan mode, you need `root` or other |
| 13 | +> proper permissions (i.e. CAP_NET_RAW). |
| 14 | +
|
12 | 15 | See the CLI tool on [crates.io](https://crates.io/crates/qsc). |
13 | 16 |
|
14 | 17 | ## Obtain `qsc` |
@@ -37,63 +40,99 @@ Print the help message using `-h` option: |
37 | 40 |
|
38 | 41 | ```bash |
39 | 42 | >>> qsc -h |
40 | | -qsc 0.3.0 |
| 43 | +qsc 0.4.0 |
41 | 44 | 0xor0ne |
42 | 45 | Quick async network scanner CLI |
43 | 46 |
|
44 | 47 | USAGE: |
45 | 48 | qsc [OPTIONS] --targets <TARGETS> --ports <PORTS> |
46 | 49 |
|
47 | 50 | OPTIONS: |
48 | | - --batch <BATCH> Parallel scan [default: 5000] |
49 | | - -h, --help Print help information |
50 | | - --json <JSON> Path to file whre to save results in json format |
51 | | - --ports <PORTS> Comma separate list of ports (or port ranges) to scan for each |
52 | | - target. E.g., '80', '22,443', '1-1024,8080' |
53 | | - --printlevel <PRINTLEVEL> Console output mode: |
54 | | - - 0: suppress console output; |
55 | | - - 1: print ip:port for open ports at the end of the scan; |
56 | | - - 2: print ip:port:<OPEN|CLOSE> at the end of the scan; |
57 | | - - 3: print ip:port for open ports as soon as they are found; |
58 | | - - 4: print ip:port:<OPEN:CLOSE> as soon as the scan for a |
59 | | - target ends; |
60 | | - [default: 3] |
61 | | - --targets <TARGETS> Comma separated list of targets to scan. A target can be an IP, |
62 | | - a set of IPs in CIDR notation, a domain name or a path to a |
63 | | - file containing one of the previous for each line. E.g., |
64 | | - '8.8.8.8', '192.168.1.0/24', 'www.google.com,/tmp/ips.txt' |
65 | | - --timeout <TIMEOUT> Timeout in ms. If the timeout expires the port is considered |
66 | | - close [default: 1500] |
67 | | - --tries <TRIES> Number of maximum retries for each target:port pair [default: |
68 | | - 1] |
69 | | - -V, --version Print version information |
70 | | - |
| 51 | + --batch <BATCH> |
| 52 | + Parallel scan [default: 5000] |
| 53 | + |
| 54 | + -h, --help |
| 55 | + Print help information |
| 56 | + |
| 57 | + --json <JSON> |
| 58 | + Path to file whre to save results in json format |
| 59 | + |
| 60 | + --mode <MODE> |
| 61 | + Scan mode: |
| 62 | + - 0: TCP connect; |
| 63 | + - 1: ping (--ports is ognored); |
| 64 | + - 2: ping and then TCP connect using as targets the nodes that replied to the ping; |
| 65 | + [default: 0] |
| 66 | + |
| 67 | + --ping-interval <PING_INTERVAL> |
| 68 | + Inteval in ms between pings for a single target. [default: 1000] |
| 69 | + |
| 70 | + --ping-tries <PING_TRIES> |
| 71 | + Number of maximum retries for each target (ping scan) [default: 1] |
| 72 | + |
| 73 | + --ports <PORTS> |
| 74 | + Comma separate list of ports (or port ranges) to scan for each target. E.g., '80', |
| 75 | + '22,443', '1-1024,8080' |
| 76 | + |
| 77 | + --printlevel <PRINTLEVEL> |
| 78 | + Console output mode: |
| 79 | + - 0: suppress console output; |
| 80 | + - 1: print ip:port for open ports at the end of the scan; |
| 81 | + - 2: print ip:port:<OPEN|CLOSE> at the end of the scan; |
| 82 | + - 3: print ip:port for open ports as soon as they are found; |
| 83 | + - 4: print ip:port:<OPEN:CLOSE> as soon as the scan for a |
| 84 | + target ends; |
| 85 | + [default: 3] |
| 86 | + |
| 87 | + --targets <TARGETS> |
| 88 | + Comma separated list of targets to scan. A target can be an IP, a set of IPs in CIDR |
| 89 | + notation, a domain name or a path to a file containing one of the previous for each |
| 90 | + line. E.g., '8.8.8.8', '192.168.1.0/24', 'www.google.com,/tmp/ips.txt' |
| 91 | + |
| 92 | + --tcp-tries <TCP_TRIES> |
| 93 | + Number of maximum retries for each target:port pair (TCP Connect scan) [default: 1] |
| 94 | + |
| 95 | + --timeout <TIMEOUT> |
| 96 | + Timeout in ms. If the timeout expires the port is considered close [default: 1500] |
| 97 | + |
| 98 | + -V, --version |
| 99 | + Print version information |
71 | 100 | ``` |
72 | 101 |
|
73 | 102 | here are a few usage examples: |
74 | 103 |
|
75 | 104 | ```bash |
76 | | -# Single target, multiple port |
| 105 | +# Single target, multiple ports |
77 | 106 | qsc --targets "8.8.8.8" --ports "1-1000" |
78 | | -# Scan local lan for SSH (assuming 192.168.1.0/24). In this case we reduce the |
79 | | -# timeout to 500ms. |
| 107 | + |
| 108 | +# Scan local lan (assuming 192.168.1.0/24) for SSH default port. In this case we |
| 109 | +# are reducing the timeout to 500ms. |
80 | 110 | qsc --targets "192.168.1.0/24" --ports "22" --timeout 500 |
| 111 | + |
81 | 112 | # Use a domain name as target |
82 | 113 | qsc --targets "www.google.com" --ports "80,443" |
| 114 | + |
83 | 115 | # Use a file as target, the file must contain a target (IP, cidr or domain name) |
84 | 116 | # for each line |
85 | 117 | qsc --targets "/tmp/ips.txt" --ports "1-1024" |
86 | | -# Print all the ports with OPEN/CLOSED indication and save results in json |
| 118 | + |
| 119 | +# Print all the ports with OPEN/CLOSE indication and save results in json |
87 | 120 | # format in file /tmp/res.json |
88 | | -qsc --targets "8.8.8.8" --ports 80,443,111 --tries 1 --json /tmp/xxx.json --printlevel 4 |
| 121 | +qsc --targets "8.8.8.8" --ports 80,443,111 --tcp-tries 1 --json /tmp/xxx.json --printlevel 4 |
| 122 | + |
| 123 | +# Ping scan: 3 re-tries, 1s timeout, 1s interval between pings. Print UP/DOWN info |
| 124 | +sudo qsc --targets "8.8.8.8,1.2.3.4" --ports "" --mode 1 --ping-tries 3 --timeout 1000 --ping-interval 1000 --printlevel 4 |
| 125 | + |
| 126 | +# Ping+TCP connect scan (assuming 192.168.1.0/24 is your local network) |
| 127 | +# Scan ports 22, 80 and 443 for all targets that answer to ping |
| 128 | +# Also, save results in json format in /tmp/res.json |
| 129 | +sudo qsc --targets "192.168.1.0/24" --ports "22,80,443" --mode 2 --ping-tries 1 --timeout 1000 --ping-interval 1000 --printlevel 4 --json /tmp/res.json |
89 | 130 | ``` |
90 | 131 |
|
91 | 132 | ## Docker Image |
92 | 133 |
|
93 | 134 | It's possible to build and use a Docker image configured for running `qsc`. |
94 | 135 |
|
95 | | -NOTE: currently only Linux has been tested for building the Docker image. |
96 | | - |
97 | 136 | Assuming Docker is installed on your machine and configured to run without sudo |
98 | 137 | (if not, see [here][1] and [here][2]), proceed by building the image: |
99 | 138 |
|
|
0 commit comments