10 def bladecode(filename):
11 with open(filename, 'rb') as csvfile:
12 spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
18 for row in spamreader:
26 # if source != 192.168.67.84
27 if row[2] != '192.168.67.84':
30 from pprint import pprint
31 #pprint("SRC: %s, DSCP: %s" % (row[2], row[10]))
32 #pprint ('diff:%f' % (float(row[1])-float(last[1])))
33 #va = str(int((float(row[1])-float(last[1]))*10))
34 va = str(int(row[10])-int(last[10]))
35 pprint ("diff:%s" % va)
36 # print row[0]+"-"+row[1]+"-"+row[10]
37 # print str(float(row[1])-float(last[1]))+"-"+str(int(row[10])-int(last[10]))
38 #print " "+str(unichr(int(row[10])-int(last[10])+ord('A'))),
39 # va = str(int((float(row[1])-float(last[1]))*10))
40 if va not in ["0","1","2","3"]:
41 print "error: %s" % va
51 # print "dec: "+binascii.unhexlify('%x' % n)
52 # print " "+binascii.unhexlify('%x' % n),
58 if __name__ == "__main__":
59 def signal_handler(signal, frame):
60 print('SIG received. exitting!')
62 signal.signal(signal.SIGINT, signal_handler)
64 bladecode("10mins_transaction.dehexed.csv")