For those who haven't noticed, Kraken code has found a new home in git,
and the latest version can be gotten by:

  git clone git://git.srlabs.de/kraken.git

The latest version can handle multiple requests simultaneously, and
these are identified by a unique job number.

I have written some sample glue code in python that shows how it is
possible to interface with Kraken over the server socket. The relevant
snippets look like this:

Simple function to read from socket:

def ReadLine(s):
    r = ""
    c = s.recv(1)
    while c!='\n':
        r = r + c
        c = s.recv(1)
    return r


And the code for processing a batch of known plaintext looks something
like this

#Open server connection
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 9100))

found = False
for crk in cracks:
    pos = crk.find("crack")
    skip = False
    if pos>0:
        cmd = crk[pos:]
        s.send(cmd+"\n")
        while True:
            r = ReadLine(s)
            print r
            if (len(r) > 5) and r[:6]=="crack ":
                break
            if (len(r) > 5) and r[:6]=="Found ":
                find = r.split(" ")
                key = find[1]
                keypos = find[3]
                #Another frame will have to be found from this group
                framenum1 = ???
                framenum2 = ???
                burst2 = ???
                pipe = os.popen("./find_kc %s %s %s %s %s"%
                                (key,keypos,framenum1,framenum2,burst2))
                result = pipe.read();
                print result
                rv = result.split("\n")
                for r in rv:
                    if r.find("MATCH")>0:
                        print r
                        key = r.split(" ")[1:9]
                        keystring = string.join(key," ")
                        # This is your key
                        print keystring
                        found = True
                        break
    if found:
        break

#close connection
s.close()


I hope this can prove useful.

Frank

_______________________________________________
A51 mailing list
A51@lists.reflextor.com
http://lists.lists.reflextor.com/cgi-bin/mailman/listinfo/a51

Reply via email to