Exemplo n.º 1
0
def webreg(data):

    #validate auth hash
    if data[0] == rsa_encrypt.get_auth_hash():

        print("Added User via web register")

        #add user
        shamir_gen.add_user(data[1], data[2], data[3:])
Exemplo n.º 2
0
def net_register():
    #Ask for and recieve uid
    print("Enter user id: ")
    uid = input().strip("\n")

    #Make sure the uid is less than 16 characters
    while len(uid) > 16:
        print("lets keep it under 16 chars")
        uid = input().strip("\n")

    #Ask for the user's name 
    print("Enter user's name: ")
    name = input().strip("\n")

    #Keep the name shorter than 16 characters
    while len(name) > 16:
        print("lets keep it under 16 chars")
        name = input().strip("\n")

    #Holder for user keys
    keys = []

    #Create a socket to get user passwords
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.bind(('127.0.0.1', 55556))
        s.listen(5)

        #For each db
        for i in settings.DBS:

            #Prompt for password
            print("Send the user's password for the " + i + " database: ")
            
            #accept connection
            cli, addr = s.accept()

            #Get password
            temp = str(cli.recv(128), 'ascii').strip("\n")
            
            #Close connection
            cli.close()

            #Make sure the password isnt longer than a sha256 hash
            if len(temp) > 66:
                print("ERROR recieving pass, needs to be under 66 chars")
                return
            
            #append the key to the list
            keys.append(temp)

    #Send the gathered information to be entered into the proper databases
    shamir_gen.add_user(uid, name, keys)

    #Ask the auth server to share the new user
    broadcast(uid)
Exemplo n.º 3
0
Arquivo: ui.py Projeto: Korux/crow
def cli_register():
    #Ask for and recieve uid
    print("Enter user id: ")
    uid = input().strip("\n").strip(":").strip("|")

    #Make sure the uid is less than 16 characters
    while len(uid) > 16:
        print("lets keep it under 16 chars")
        uid = input().strip("\n").strip(":").strip("|")

    #Ask for the user's name
    print("Enter user's name: ")
    name = input().strip("\n").strip(":").strip("|")

    #Keep the name shorter than 16 characters
    while len(name) > 16:
        print("lets keep it under 16 chars")
        name = input().strip("\n").strip(":").strip("|")

    #Holder for user keys
    keys = []

    #For each db
    for i in settings.DBS:

        # register user's face
        if i is "face":
            print("Registering user's face")
            embed = register_face()
            if embed is None:
                # Handle error in registering face if needed
                pass

            #convert embed to string to store in db
            tmp = embed_to_string(embed)
            keys.append(tmp)
        else:

            #Prompt for password
            print("Enter the user's password for the " + i + " database: ")
            temp = input().strip("\n").strip(":").strip("|")

            #Make sure the password isnt longer than a sha256 hash
            while len(temp) > 66:
                print("lets keep it under 66 chars")
                temp = input().strip("\n").strip(":").strip("|")

            #append the key to the list
            keys.append(temp)

    #Send the gathered information to be entered into the proper databases
    shamir_gen.add_user(uid, name, keys)

    #Ask the auth server to share the new user
    broadcast(uid)
Exemplo n.º 4
0
def cli_register():
    #Ask for and recieve uid
    print("Enter user id: ")
    uid = input().strip("\n")

    #Make sure the uid is less than 16 characters
    while len(uid) > 16:
        print("lets keep it under 16 chars")
        uid = input().strip("\n")

    #Ask for the user's name 
    print("Enter user's name: ")
    name = input().strip("\n")

    #Keep the name shorter than 16 characters
    while len(name) > 16:
        print("lets keep it under 16 chars")
        name = input().strip("\n")

    #Holder for user keys
    keys = []

    #For each db
    for i in settings.DBS:

        #Prompt for password
        print("Enter the user's password for the " + i + " database: ")
        temp = input().strip("\n")
        
        #Make sure the password isnt longer than a sha256 hash
        while len(temp) > 66:
            print("lets keep it under 66 chars")
            name = input().strip("\n")
        
        #append the key to the list
        keys.append(temp)

    #Send the gathered information to be entered into the proper databases
    shamir_gen.add_user(uid, name, keys)

    #Ask the auth server to share the new user
    broadcast(uid)