About

SHTraf is a Bash-based Traffic accounting system for Linux/Unix-like systems. Script isn't user-friendly, requires manual installation, which requires basic knowledge about iptables and crond.

News

Shtraf-0.1 is released (23.09.2007)
This is first public release.

Description

Script is meant to be used for monitoring counters on iptables chains. It takes names of those chains as arguments (those names must be written directly into script body using any text editor). It must be called with certain arguments at least once during a hour (using crond), during system startup and during system shutdown. Detailed instructions can be found in INSTRUCTIONS file. In case you don't want to create all those chains yourself, there is a sample "firewall" script included in the package, which can create iptables chains for use (again, it should be edited manually and executed during system startup).

Features

  • Small. (main traffic accounting script is 4177 bytes big at the moment)
  • Doesn't need Apache, PHP or MySql (or any other database) to work.
  • Provides daily/hourly/weekly/monthly/yearly statistics.
  • Statistic is stored in human-readable format. (statistical information is stored in filesystem as a large amount of plaintext files).

Disadvantages

  • Non-trivial installation at the moment (no ./configure && make && make install)
  • Creates large amounts of small files.
  • counters can desynchronize. "desynchronize" means that if something breaks, then (for example) summary value of weekly statistics during a month won't be equal to monthly amount of traffic.
  • no nice graphs, no friendly GUI, nothing that isn't required to make it work.

Software requirements

Script needs crond, bash, iptables, bc and sed to work.

Skill requirements

Knowledge about iptables and crontab is required.

Documentation

Currently installation instructions are available in INSTRUCTIONS (or INSTRUCTIONS_RU.KOI8-R, if you understand Russian language) file, which can be found in the program package. This file also contains relatively verbose description of program and it's functionality.

Download

Currently project is only available via "downloads" page.

Statistics format

Statistical information is stored as a tree-like hierarchy of folders and text files. Text files are ASCII files containing number of bytes that went through specified iptables chain during the specified period. Detailed information can be found in the INSTRUCTIONS file inside the project package.

Further development

I've initially created this script for myself and it wasn't supposed to be released - I've put it onto the sourceforge because people started using that script and fixing bugs become difficult due to the lack of central page to host the releases. Projects currently "works for me ", and there are no critical improvements planned (that doesn't mean that there won't be any). But, if you want to improve this script or add something(installation program would be nice, for example), feel free to contact me via one of email addresses listed below. There are good chances that your improvement will be added.

Contact Author

Victor Eremin (nickname "ErV")
Russian.
Timezone : GMT+3
Operating System: Slackware 12 Linux
e-mail:
    erv000<at>users.sourceforge.net
    erv2005<at>rambler.ru
    erv255<at>googlemail.com
    erv<at>box.vsi.ru
ICQ: 265557823

Feel free to contact me, but don't send me any binaries/attachments without asking first. And, please, include "shtraf" in the subject.

GPG signatures

For certain reasons source packages were signed with GPG. They are not encrypted, just signed. So, If you want to verify if packages were created by me or not, you can use following public key (it's just for checking signatures):

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)

mQENBEZ5yZEBCADa8GCc8x9wnumA+jYF1ThZ0XwexJWiqhohprbxEvgFh+JgS6QW
OgGJPa3GsS8k0SMtL1QOamTk5mrIaKqiDsAno/x7W4eayExl8BrG3YEIF5cHzx9X
f2SKRziFEew2KaXAGetW0IN3wvjiIJegf0XoUfdCkWQ4a3SJUtDL3PCXM9qgx5mw
MFpWE821LBvVTtDaNiSuNoD4sa13op0MPSJBiqZwQ5X9yuXcJHh9BwRAgKrAh8mZ
ljfFzkt8UFGrAw2BhQtW28I2lZN+so4oQuiGI8oQaxw0/CZqEIic8d1YPWK+4Kux
RSd1vfn74ZQrChF6EC/x4kZd/ThICv5H/F8zABEBAAG0KFZpY3RvciBFcmVtaW4g
KEVyVikgPEVyVjIwMDVAcmFtYmxlci5ydT6JATYEEwECACAFAkZ5yZECGwMGCwkI
BwMCBBUCCAMEFgIDAQIeAQIXgAAKCRBUPVxZq4GIcTLKB/9dwwF+QchUktO4G8CT
oT9k4f+o8/Ii4kAdiLzgK1lENrF/lZ5flqhGy4lDVF3Zdv0n6H7m/w1+fALYkvhA
aRvOJuF8PlUqDw+CY2aAHaaRNUe55sbXOs0EJGWpFqS4so2Yo/dpY3by9OnF2olW
s2yyrwwOxCGTPEigIwaqsGCrrOVu+RVeg1gi/JcocYHbLte5GqFLT+3WBKdK5vis
SP5o23GuOg3vIO0tm/jEo57YU8RuYj6Q6D+4tEuNQ7JJmwExaAzDp7MysNf7bEUv
IIqWEVUVdtM6+Mx8zhoYWSvCvaoAWmcFlL2lvPNdw0g8zzMrn5PFXwDLSS7C9s2G
NKk3
=MwPK
-----END PGP PUBLIC KEY BLOCK-----
			



Downloads

Archive with script and documentation.
GPG-signature for archive.

Project

List all files
Project Summary

Languages

English
Russian

SHTraf project