def xorOutguess(): data = [] for i in range(3): cur = "" f = open("../outguesses/out" + str(i) + ".jpg.out", 'r') next(f); next(f) for line in f: if line[:3] == "---": break else: cur += line data.append(dparse.hexToInt(dparse.txtToHex(cur))) xored = dmanip.xor(data[0], dmanip.xor(data[1], data[2])) print dparse.intToAsc(xored)
#!/usr/bin/python import dparse import dstats import dmanip print "starting" txt = "" with open("../data/twitter.hex", "r") as f: for line in f: if line[:3] == "Off": continue txt += line[9:] print "parsing" tInt = dparse.hexToInt(dparse.txtToHex(txt)) sInt = dparse.ascToInt(dparse.txtToAsc(dparse.readFile("761.MP3"))) dstats.magNumSearch(sInt) print len(tInt) print len(sInt) outFile = open("../pics/twitter.jpg", "w") outFile.write(dparse.intToAsc(dmanip.xor(tInt, sInt))) outFile.close()
print len(data) relData = [] for i in data: if len(i) == 58152: relData.append(i) print len(relData) relData = [dparse.txtToAsc(i) for i in relData] xored = relData[0] for i in range(1, len(relData)): xored = dmanip.xor(xored, relData[i]) dstats.extMagNum(dparse.intToHex(xored)) with open("../data/xorrunes.asc", 'w') as f: f.write(dparse.intToAsc(xored)) # Search for suffs and prefs # count = 2 # prevPref = 0 # prevSuff = 0 # while(True): # prefs = [', '.join([str(j) for j in i[:count]]) for i in data] # suffs = [', '.join([str(j) for j in i[-count:]]) for i in data] # # curPref = len(dstats.getFreq(prefs))