from os import system i = 0 while True: i += 1 with open('temp1.bin', 'rb') as f: d1 = f.read() with open('temp2.bin', 'rb') as f: d2 = f.read() if ('+' in d1 and '+' not in d2) or ('+' in d2 and '+' not in d1): if all(a not in d1 and a not in d2 for a in '[.]-\x00'): print "Found it!!! A plus!" break if ('-' in d1 and '-' not in d2) or ('-' in d2 and '-' not in d1): if all(a not in d1 and a not in d2 for a in '[.]+\x00'): print "Found it!!! A minus!" break if ('[' in d1 and '[' not in d2) or ('[' in d2 and '[' not in d1): if all(a not in d1 and a not in d2 for a in '.]+-\x00'): print "Found it!!! An open bracket!" break print "[+] Round %d" % i system('./fastcoll -o temp1.bin temp2.bin')