Note: This tool is meant to be used in conjunction with at least one honeypot from which you are gathering your data from. The data input cannot be simply data collected from a normal network, since the tool does not differentiate between attacks and regular connections. It currently treats every IP in the input data file as an attacker, although a web crawler filteration module is in the works.
In this document, I will describe how to use the AIP algorithm tool. Since it is written in python, it is quite simple to set up for your system.
- A Linux based OS. I have used it on Ubuntu, Kali, Mint, PopOS, and Elementary.
- Python 3.8/3.9 support. Test implemented using
pytest
- Python dependencies:
csv
,datetime
,operator
,time
,os
,inspect
andshutil
(builtins). - An input data file collected from your honeypots in a format described below.
- Download or clone the repo to a directory of your choosing. It contains all necessary files and folders
cd /the/location/of/the/AIP_repo
chmod u+x AIP_auto_run.sh
chmod u+x AIP_manual_run.sh
AIP_auto_run
andAIP_manual_run
are configured similarly.- To run AIP, execute either
AIP_auto_run
orAIP_manual_run
, as:sh AIP_auto_run.sh
- Follow the onscreen instructions. Depending on whether this is the first time you have run it or not, it will ask you for the location of your input data files, and then the location that you want the output to be saved to.
- cd /the/location/you/specified/for/the/output/Files
- There you will see a number of folders and files. These are the files AIP uses to remember past runs.
- Go to the directory /Historical_Ratings/ to see the output blocklists.
In terms of file format for the input data, the program accepts a .csv file that has one IP per line, with each of the following data inputs for each IP on that line, separated by commas:
- The IP address
- Number of events - Meaning the total connections to your honeypots originating from the given IP
- Total Duration - How long did this IP connect for the total of its events
- Average duration - The average length in seconds of all the connections by this IP
- Amount of Bytes - Total bytes sent and received by this IP
- Average number of bytes - For bytes transferred in each connection by this IP
- Total packets - Of all the connections by this IP
- Average packets - Average packets sent per connection by this IP
- Last event time - UNIX time of the last time this IP tried to connect to something in the last 24 hours
- First event time - UNIX time of the first time the IP tried to connect in the last 24 hour
For example, a single line in the file could look like this: "IPv4-Address", ”26049”, "7415310", "284.6", "41808957", "1605.0", ”284577”, "10.92", "157899154", "1578968762.519"
The tool is designed to be run once a day at a time of your choosing after copying the .csv file that contains the data from the last 24 hours to the Input-Data directory. If it is not run once a day, the rating system will be thrown off, but it will still work. The Run-AIP script is designed to simply run the python script for AIP, and then copy the generated blocklist files to another location to be saved.