示例#1
0
def createPictures():
    print "Reading file"
    raw = dparse.readFile("onion3.hex")

    print "Parsing"
    dHex = dparse.txtToHex(raw)
    dInt = dparse.hexToInt(dHex)
    dBin = dparse.intToBin(dInt)

    print "Searching"
    start = dstats.searchForBytes(dBin, dparse.intToBin(dparse.hexToInt(["FF", "D8", "FF"])))
    end = dstats.searchForBytes(dBin, dparse.intToBin(dparse.hexToInt(["FF", "D9"]))) + 2

    print "Separating: " + str(start) + ", " + str(end)
    iBin = dBin[start:end]

    iInt = dparse.binToInt(iBin)
    iAsc = dparse.intToAsc(iInt)

    print "Writing"
    outFile = open("../pics/2out0.jpg", "w")
    outFile.write(iAsc)
    outFile.close()

    remains = dBin[end:]

    remains = dmanip.flipOrder(remains)
    rAsc = dparse.intToAsc(dparse.binToInt(remains))
    with open("../pics/2out1.jpg", "w") as f:
        f.write(rAsc)
示例#2
0
def createPictures():
        print "Reading file"
        raw = dparse.readFile("onion2.hex")

        print "Parsing"
        dHex = dparse.txtToHex(raw)
        dInt = dparse.hexToInt(dHex)
        dBin = dparse.intToBin(dInt)

        print "Flipping"
        dBinFlipped = dmanip.flipBits(dBin)

        for i in range(3):
                if i == 2:
                        dBinFlipped = dmanip.flipOrder(dBinFlipped)
                

                print "Searching"
                start = dstats.searchForBytes(dBinFlipped, dparse.intToBin(dparse.hexToInt(['FF', 'D8'])))
                end   = dstats.searchForBytes(dBinFlipped, dparse.intToBin(dparse.hexToInt(['FF', 'D9']))) + 2

                print "Separating: " + str(start) + ", " + str(end)
                iBin = dBinFlipped[start : end]
                
                print dBinFlipped[:5]
                print dBinFlipped[-5:]
                print "---"
                print iBin[:5]
                print iBin[-5:]
                print "---"
                
                dBinFlipped = dBinFlipped[end:] # Cut off beginning of file for next iteration
                iInt = dparse.binToInt(iBin)
                iAsc = dparse.intToAsc(iInt)

                print "Writing"
                outFile = open("../pics/out" + str(i) + ".jpg", 'w')
                outFile.write(iAsc)
                outFile.close()

        print "Done"
示例#3
0
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)
示例#4
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)
示例#5
0
#!/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()
示例#6
0
#!/usr/bin/python

# Possible keys:
# Runes outguess
# Xor combinations of all of above
# 3301/1103 */^/xor
# Pi

import dparse
import fractions

primes = []
fibs = []
totients = []

time1 = dparse.hexToInt(dparse.txtToHex(dparse.readFile("time1.hex")))
time2 = dparse.hexToInt(dparse.txtToHex(dparse.readFile("time2.hex")))
time3 = dparse.hexToInt(dparse.txtToHex(dparse.readFile("time3.hex")))
sexag = dparse.sexToInt(dparse.txtToSex(dparse.readFile("sexag.sex")))
cune1 = [17,15,55,1]
cune2 = [17,15,50,5,1]
cune3 = [10,7,10,5,50,5,1]

def initPrimes(m):
        for i in range(2,m):
                isPrime = True
                for j in range(2,i/2+1):
                        if i%j == 0:
                                isPrime = False
                                break
                if isPrime:
示例#7
0
#!/usr/bin/python

import dparse
import dstats
import dmanip

raw1 = ""

with open("../outguesses/2out0.jpg.out", 'r') as f:
        for i in range(9):
                next(f)

        for line in f:
                if line[:3] == "---":
                        break
                
                raw1 += line

#raw2 = dparse.readFile("../outguesses/2out1.jpg.out")

h1Hex = dparse.txtToHex(raw1)
h1Int = dparse.hexToInt(h1Hex)
h1Asc = dparse.intToAsc(h1Int)

with open("../pics/newrunes.jpg", 'w') as f:
        f.write(h1Asc)