Reads the byte counter on the last rule in a chain on a Unix box using ipchains as a firewall. Unfortunately this test needs to read info in the /proc/net/ip_fwchains file.
If the following rules were entered on a Linux box with ipchains setup then the script could be used to read values for the data to and from 192.168.100.19. The idea is simple, direct output that you want to measure to a custom chain and add an accept rule to the chain.
#ipchains -N testin
#ipchains -N testout
#ipchains -A output -d 192.168.100.19 -j testout
#ipchains -A input -s 192.168.100.19 -j testin
#ipchains -A testin -j ACCEPT
#ipchains -A testout -j ACCEPT
Enter 'testin' as in Arg0 to read the counter. Setting 'testout' for in Arg0 will read the counter for 'testout' chains.