Esempio n. 1
0
def allStats(i):
        h = dparse.intToHex(i)

        print "=== EXT MAGIC NUMBERS ==="
        extMagNum(h)
        print ""

        print "=== FREQUENCIES ==="
        graphDict(i)
        print ""

        print "=== UNUSED ==="
        print getUnused(i) 
Esempio n. 2
0
def extMagNum(h):
        print "Creating flipped data"
        i = dparse.hexToInt(h)
        b = dparse.intToBin(i)
        bFlip = dmanip.flipBits(b)
        bRev = dmanip.flipBinOrder(b)
        bRevFlip = dmanip.flipBits(bRev)
        
        hFlip = dparse.intToHex(dparse.binToInt(bFlip))
        hRev = dparse.intToHex(dparse.binToInt(bRev))
        hRevFlip = dparse.intToHex(dparse.binToInt(bRevFlip))
        
        print "> Searching normal"
        magNumSearch(h)

        print "> Searching flipped bits"
        magNumSearch(hFlip)

        print "> Searching reversed order"
        magNumSearch(hRev)

        print "> Searching flipped bits and reversed order"
        magNumSearch(hRevFlip)
Esempio n. 3
0
# bBin = dparse.txtToBin(bRaw)
# bInt = dparse.binToInt(bBin)
# 
# # d1 = [15, 7, 3]
# # d2 = [2, 2, 2]
# # print dparse.intToBin(d1)
# # print dparse.intToBin(d2)
# # print dparse.intToBin(dmanip.xor(d1, d2))
# 
# print hHex
# print hInt
# print "-----"
# print bBin
# print dmanip.flipOrder(bBin)
# print dmanip.flipBits(bBin)
# 
# # print hInt[0:dstats.searchForBytes(hInt, [73, 254])

gRaw = dparse.readFile("../../../../Downloads/hello.gif")
gAsc = dparse.txtToAsc(gRaw)
gInt = dparse.ascToInt(gAsc)
gHex = dparse.intToHex(gInt)
dstats.magNumSearch(gHex)

print "---"


oRaw = dparse.readFile("../data/onion2.hex")
oHex = dparse.txtToHex(oRaw)
dstats.extMagNum(gHex)
Esempio n. 4
0
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))
#         curSuff = len(dstats.getFreq(suffs))
#