--- /home/christian/mallory.tmp2/mallory2cap.py 2014-12-30 14:54:52.000000000 +0100 +++ mallory2cap.py 2014-12-30 16:15:06.000000000 +0100 @@ -95,10 +95,22 @@ return len(''.join(str1.split())) / 2 def writeByteStringToFile(bytestring, filename): + try: bytelist = bytestring.split() - bytes = binascii.a2b_hex(''.join(bytelist)) + tmpbytes=''.join(bytelist) + if( len(tmpbytes) % 2 == 1): + print "odd" + bytes = binascii.a2b_hex(tmpbytes[:-1].lower()) + else: + print "even" + bytes = binascii.a2b_hex(tmpbytes.lower()) + #bytes = binascii.a2b_hex(''.join(bytelist)) bitout = open(filename, 'ab') bitout.write(bytes) + except: + print "failing with" + #print ''.join(bytelist), len(bytelist) + print ''.join(bytelist), len(bytelist) def writeheader(): pcap_global_header = ('D4 C3 B2 A1'