Пример #1
0
def pk_addpubkey(sfd):
    print "ADD A PUBKEY"
    myargs = {
        KEY_NICK:
        "frlfrl",
        KEY_HOST:
        KEY_YAHOST_DATA,
        KEY_SERVER:
        KEY_SERVER_DATA,
        KEY_BLOB:
        "IpPlkHjaehHIva58t9UOk92x3HIa9mzG9wWzt8i/Tlpzpj/W64+iNiAAAP//3ukNnQ=="
    }
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKADD, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "KEY FP:"
    print binascii.hexlify(ac_pkr.blob)
Пример #2
0
def pk_list(sfd):
    print "LIST RUNNING DAEMON PUBLIC KEYS"
    #myargs = { KEY_NICK:"frlfrl" }
    myargs = None
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKLIST, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(4096)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    if ac_msg_test.type == ac_pb2.ArseneCryptoMessage.AC_ERROR:
        print "Request Error!"
        print ac_msg_test.blob
        return 1
    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "PKR do we have public keys?!"
    print ac_pkr.public_keys
    print "HOW MANY PUB KEYS!?"
    print len(ac_pkr.public_keys)
    for t in ac_pkr.public_keys:
        print t.nick + ":" + t.pubkey + ":" + str(t.timestamp) + ":" + str(
            datetime.datetime.fromtimestamp(t.timestamp))
        print binascii.hexlify(t.fp)
    return 0
Пример #3
0
def pk_getnewpair(sfd):
    #
    #   GET NEW KEYPAIR MESSAGE
    #
    print "GENERATE NEW KEYPAIR MESSAGE"

    #myargs = { KEY_NICK:"yondaime", KEY_HOST:KEY_HOST_DATA, KEY_SERVER:KEY_SERVER_DATA, KEY_BLOB:"ddskjdkdjsakjdasksa" }
    myargs = {
        KEY_NICK: "yondaime",
        KEY_HOST: KEY_HOST_DATA,
        KEY_SERVER: "",
        KEY_BLOB: "ddskjdkdjsakjdasksa"
    }
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKGEN, myargs)

    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print "%d" % ac_pkr.error_code
    return 0
Пример #4
0
def pk_getmypubkey(sfd):
    print "GET MY PUBLIC KEY"
    myargs = {KEY_NICK: "youpiya"}
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKGET, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "PKR do we have public keys?!"
    print ac_pkr.public_keys
    print "HOW MANY PUB KEYS!?"
    print len(ac_pkr.public_keys)
    for t in ac_pkr.public_keys:
        print t.nick + ":" + t.pubkey + ":" + str(t.timestamp) + ":" + str(
            datetime.datetime.fromtimestamp(t.timestamp))
        print binascii.hexlify(t.fp)
    return 0
Пример #5
0
def pk_list(sfd):
    print "LIST RUNNING DAEMON PUBLIC KEYS"
    #myargs = { KEY_NICK:"frlfrl" }
    myargs = None 
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKLIST, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(4096)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    if ac_msg_test.type == ac_pb2.ArseneCryptoMessage.AC_ERROR:
        print "Request Error!"
        print ac_msg_test.blob
        return 1
    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "PKR do we have public keys?!"
    print ac_pkr.public_keys
    print "HOW MANY PUB KEYS!?"
    print len(ac_pkr.public_keys)
    for t in ac_pkr.public_keys:
        print t.nick + ":" + t.pubkey + ":" + str(t.timestamp) + ":" + str(datetime.datetime.fromtimestamp(t.timestamp))
        print binascii.hexlify(t.fp)
    return 0
Пример #6
0
def pk_getmypubkey(sfd):
    print "GET MY PUBLIC KEY"
    myargs = { KEY_NICK:"youpiya" }
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKGET, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "PKR do we have public keys?!"
    print ac_pkr.public_keys
    print "HOW MANY PUB KEYS!?"
    print len(ac_pkr.public_keys)
    for t in ac_pkr.public_keys:
        print t.nick + ":" + t.pubkey + ":" + str(t.timestamp) + ":" + str(datetime.datetime.fromtimestamp(t.timestamp))
        print binascii.hexlify(t.fp)
    return 0
Пример #7
0
def pk_getnewpair(sfd):
#
#   GET NEW KEYPAIR MESSAGE
# 
    print "GENERATE NEW KEYPAIR MESSAGE"

    #myargs = { KEY_NICK:"yondaime", KEY_HOST:KEY_HOST_DATA, KEY_SERVER:KEY_SERVER_DATA, KEY_BLOB:"ddskjdkdjsakjdasksa" }
    myargs = { KEY_NICK:"yondaime", KEY_HOST:KEY_HOST_DATA, KEY_SERVER:"", KEY_BLOB:"ddskjdkdjsakjdasksa" }
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKGEN, myargs)

    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print "%d" % ac_pkr.error_code
    return 0
Пример #8
0
def pk_del(sfd):
    print "DEL message"
    #myargs = { KEY_NICK:"frlfrl" }
    myargs = None  # { KEY_NICK:"frlfrl" }

    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKDEL, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(4096)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
Пример #9
0
def pk_del(sfd):
    print "DEL message"
    #myargs = { KEY_NICK:"frlfrl" }
    myargs = None # { KEY_NICK:"frlfrl" }

    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKDEL, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(4096)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
Пример #10
0
def pk_addpubkey(sfd):
    print "ADD A PUBKEY"
    myargs = { KEY_NICK:"frlfrl", KEY_HOST:KEY_YAHOST_DATA, KEY_SERVER:KEY_SERVER_DATA, KEY_BLOB:"IpPlkHjaehHIva58t9UOk92x3HIa9mzG9wWzt8i/Tlpzpj/W64+iNiAAAP//3ukNnQ==" }
    acblob = ac_msg(ACMSG_TYPE_PK, ACMSG_SUBTYPE_PKADD, myargs)
    sfd.send(acblob)
    rcvblob = sfd.recv(2048)

    ac_msg_test = ac_pb2.ArseneCryptoMessage()
    ac_msg_test.ParseFromString(rcvblob)
    print "message type:"
    print ac_msg_test.type

    ac_pkr = ac_pb2.acPublicKeyMessageResponse()
    ac_pkr.ParseFromString(ac_msg_test.blob)
    print "PKR message type:"
    print ac_pkr.type
    print "PKR message bada:"
    print ac_pkr.bada
    print "PKR message error_code:"
    print ac_pkr.error_code
    print "KEY FP:"
    print binascii.hexlify(ac_pkr.blob)