Skip to content

Commit e98c659

Browse files
committed
Merge branch 'dev'
2 parents 6f3c4b8 + e621a86 commit e98c659

File tree

11 files changed

+893
-135
lines changed

11 files changed

+893
-135
lines changed

Cargo.lock

Lines changed: 105 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ Quick Network Scanner project includes:
77
* [qsc](./qsc/): a command line utility built on top of qscan library
88
for quick network scanning activities (see [README](./qsc/README.md)).
99

10-
NOTE: in order to properly use the library and the command line utility provided
11-
by this project you may need to increase the maximum allowed open files. E.g.:
10+
> NOTE: in order to properly use the library and the command line utility
11+
> provided by this project you may need to increase the maximum allowed open
12+
> files. E.g.:
1213
1314
```bash
1415
ulimit -n 10000
1516
```
1617

18+
> NOTE: also, for using the ping scan functionality, you need `root` or other
19+
> proper permission (i.e. CAP_NET_RAW).
20+
1721
## [`qsc`](./qsc/) CLI Tool: Quick Scan Example
1822

1923
Install `qsc` with:
@@ -22,7 +26,7 @@ Install `qsc` with:
2226
cargo install qsc
2327
```
2428

25-
run the scanner:
29+
run the scanner (TCP connect scan):
2630

2731
```bash
2832
qsc --targets www.google.com --ports 1-1024
@@ -36,7 +40,7 @@ For using `qscan` library put this dependency in your `Cargo.toml`:
3640

3741
```bash
3842
[dependencies]
39-
qscan = "0.5.0"
43+
qscan = "0.6.0"
4044
```
4145

4246
for more details and examples see [qscan README](./qscan/README.md).

qsc/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "qsc"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "Quick async network scanner CLI"
55
documentation = "https://github.com/0xor0ne/qscan"
66
readme = "README.md"
@@ -17,7 +17,7 @@ exclude = [
1717
]
1818

1919
[dependencies]
20-
qscan = { path = "../qscan", version = "0.5.0" , features = ["serialize"] }
20+
qscan = { path = "../qscan", version = "0.6.0" , features = ["serialize"] }
2121
tokio = { version = "1", features = ["rt"] }
2222
clap = { version = "3.1.18", features = ["derive"] }
2323

qsc/README.md

Lines changed: 72 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
Rust command line utility for quick asynchronous network hosts scanning.
44

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.:
77
88
```bash
99
ulimit -n 10000
1010
```
1111

12+
> NOTE: for the ping scan mode, you need `root` or other
13+
> proper permissions (i.e. CAP_NET_RAW).
14+
1215
See the CLI tool on [crates.io](https://crates.io/crates/qsc).
1316

1417
## Obtain `qsc`
@@ -37,63 +40,99 @@ Print the help message using `-h` option:
3740

3841
```bash
3942
>>> qsc -h
40-
qsc 0.3.0
43+
qsc 0.4.0
4144
0xor0ne
4245
Quick async network scanner CLI
4346

4447
USAGE:
4548
qsc [OPTIONS] --targets <TARGETS> --ports <PORTS>
4649

4750
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
71100
```
72101

73102
here are a few usage examples:
74103

75104
```bash
76-
# Single target, multiple port
105+
# Single target, multiple ports
77106
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.
80110
qsc --targets "192.168.1.0/24" --ports "22" --timeout 500
111+
81112
# Use a domain name as target
82113
qsc --targets "www.google.com" --ports "80,443"
114+
83115
# Use a file as target, the file must contain a target (IP, cidr or domain name)
84116
# for each line
85117
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
87120
# 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
89130
```
90131

91132
## Docker Image
92133

93134
It's possible to build and use a Docker image configured for running `qsc`.
94135

95-
NOTE: currently only Linux has been tested for building the Docker image.
96-
97136
Assuming Docker is installed on your machine and configured to run without sudo
98137
(if not, see [here][1] and [here][2]), proceed by building the image:
99138

0 commit comments

Comments
 (0)