# PicViz: Spot the difference


# apt-get install picviz

# cat csv2pgdl.py
#!/usr/bin/python

import sys

csvfile = sys.argv[1]

print 'header {'
print '\ttitle="Bots connections";'
print '}'
print 'axes {'
print '\tenum time     [ label="Time"    ];'
print '\tenum proto    [ label="Proto"   ];'
print '\tipv4 sip      [ label="SrcIP"   ];'
print '\tinteger sport [ label="SrcPort" ];'
print '\tipv4 dip      [ label="DstIP"   ];'
print '\tinteger dport [ label="DstPort" ];'
print '}'


f = open(csvfile)
lines = f.readlines()
f.close()

print 'data {'
for line in lines:
 # line = 2015-01-05 22:22:22;tcp;1.2.3.4;3078;5.6.7.8;23
 field = line.strip().split(';')
 print '\ttime="' + field[0] + '", proto="' + field[1] + '", sip="' + field[2] + '", sport="' + field[3] + '", dip="' + field[4] + '", dport="' + field[5] + '";'
print '}'

# ./csv2pgdl.py data.csv > data.pgdl
# pcv -Tpngcairo data.pgdl -rrra -Rheatline -o data.png # or
# pcv -Tpngcairo data.pgdl -rrra -Rheatline -o data.png 'show value = "tcp" on axis 2 and value = "23" on axis 6'
# eog data.png

References

http://en.wikipedia.org/wiki/Parallel_coordinates

No comments: