Added http mode and results
All checks were successful
Rust-build / build (push) Successful in 2m39s

This commit is contained in:
Justine Pelletreau
2023-07-22 13:48:36 +02:00
parent 5476327560
commit c4462fcbca
7 changed files with 1118 additions and 33 deletions

View File

@ -1,15 +1,20 @@
# Portnut
...
Portnut is a port stressing / scanning multithreaded utility. It can handle raw TCP and HTTP.
# TODO
* Read the answer and count the number of answers received.
* Make a distributed version that allows stressing from multiple computers at the same time
* When TCP stress testing, show results for each port.
# Install
Go to the releases page and download the latest version.
Give it execution rights and simply launch it.
# Building
Prerequisite to building reqwest:
> apt install libssl-dev
# Usage
Portnut is a tcp port scanner / stresser.
@ -17,37 +22,101 @@ Portnut is a tcp port scanner / stresser.
The scanning function simply tries to connect to the tcp ports given.
The stressing function sends a payload every 10 milliseconds, to every ports given at the same time. The payload can be passed via a pipe (optionnal).
## Scan
```
1637 justine@portnut > target/release/portnut -a 127.0.0.1 -w 3 -p 8080,22
Scanning 127.0.0.1
TCP/8080 => REJECT
TCP/22 => REJECT
2347 justine > portnut tcpscan -a 127.0.0.1 -p 8080,8090
____ ____ ____ _______ ____ ________
/ __ \/ __ \/ __ \/_ __/ | / / / / /_ __/
/ /_/ / / / / /_/ / / / / |/ / / / / / /
/ ____/ /_/ / _, _/ / / / /| / /_/ / / /
/_/ \____/_/ |_| /_/ /_/ |_/\____/ /_/
Scanning 127.0.0.1
TCP/8080 => ACCEPT
TCP/8090 => REJECT
2351 justine > portnut tcpscan -a 127.0.0.1 -p 8080,8090 --range
____ ____ ____ _______ ____ ________
/ __ \/ __ \/ __ \/_ __/ | / / / / /_ __/
/ /_/ / / / / /_/ / / / / |/ / / / / / /
/ ____/ /_/ / _, _/ / / / /| / /_/ / / /
/_/ \____/_/ |_| /_/ /_/ |_/\____/ /_/
Scanning 127.0.0.1
TCP/8080 => ACCEPT
TCP/8081 => REJECT
TCP/8082 => REJECT
TCP/8083 => REJECT
TCP/8084 => REJECT
TCP/8085 => REJECT
TCP/8086 => REJECT
TCP/8087 => REJECT
TCP/8088 => REJECT
TCP/8089 => REJECT
```
## TCP Stress
TCP Stress can be applied to a port, a list of port, or a range of port.
Stressing allows sending a payload (via -p/--payload or via a pipe), sending, and waiting for an answer.
```
2356 justine > portnut tcpstress -a 127.0.0.1 -p 8080 -d 2
____ ____ ____ _______ ____ ________
/ __ \/ __ \/ __ \/_ __/ | / / / / /_ __/
/ /_/ / / / / /_/ / / / / |/ / / / / / /
/ ____/ /_/ / _, _/ / / / /| / /_/ / / /
/_/ \____/_/ |_| /_/ /_/ |_/\____/ /_/
#First scan the ports, and stress the available ones.
1738 justine@portnut > echo "GET / HTTP/1.1" | target/release/portnut -a 127.0.0.1 -p 8080 -w 30 -s -c 100
Scanning 127.0.0.1
TCP/8080 => ACCEPT
Stressing 127.0.0.1 using 100 concurrent threads per port for 30s
Stressing 127.0.0.1 using 5 concurrent threads per port for 2s
TOTAL 20
OK 20
NOK 0
Got 100% of OK
Mean answer time : 512ms
```
## HTTP Stress
HTTP stress performs a GET on the given address.
```
1257 justine > portnut httpstress -a http://localhost:8080 --duration 5
____ ____ ____ _______ ____ ________
/ __ \/ __ \/ __ \/_ __/ | / / / / /_ __/
/ /_/ / / / / /_/ / / / / |/ / / / / / /
/ ____/ /_/ / _, _/ / / / /| / /_/ / / /
/_/ \____/_/ |_| /_/ /_/ |_/\____/ /_/
Threads starting their 5s run...
over !
TOTAL 809
OK 809
NOK 0
Got 100% of OK
Mean answer time : 5ms
```
## More ?
See the help :
```
justine@portnut > target/release/portnut -h
A simple TCP port scanner / stresser. If stressing, you can pass a payload via a pipe
A simple TCP/HTTP port scanner / stresser. If stressing, you can pass a payload via a pipe
Usage: portnut [OPTIONS] --address <ADDRESS>
Usage: portnut [OPTIONS] --address <ADDRESS> --ports <PORTS>... <MODE>
Arguments:
<MODE> Mode of use : either tcpstress, tcpscan or httpstress
Options:
-a, --address <ADDRESS> IP address or hostname to scan
-a, --address <ADDRESS> IP address or hostname to scan - or url if using http
-t, --timeout <TIMEOUT> Timeout for each connection in seconds [default: 1]
-w, --wait <WAIT> Number of milliseconds to wait in between scans when scanning OR duration of stress when stress testing (in seconds) [default: 30]
-w, --wait <WAIT> Number of milliseconds to wait in between scans or requests [default: 30]
-d, --duration <DURATION> Duration of tcp stress test in seconds, default 30 [default: 30]
-p, --ports <PORTS>... Ports to stress / scan, separated by commas (22,80)
-r, --range Set this flag to treat the ports as a range rather than a list
-s, --stress Set this flag to stress the ports instead of scanning them
-c, --cthreads <CTHREADS> How many threads per port when stressing (Concurrent Threads) [default: 5]
-h, --help Print help
-V, --version Print version
```