Exemplo n.º 1
0
def response(package, address):
    ts2, lt2 = functions.timeterms()
    idc = package["idc"]
    adc = address[0]
    stringtgs = uuid.uuid4().hex[:6].lower()
    # print(stringtgs)
    kctgs = functions.generatePassword(stringtgs)
    ticket = {
        "kctgs": kctgs,
        "idc": idc,
        "adc": adc,
        "idtgs": idtgs,
        "ts2": str(ts2),
        "lt2": str(lt2)
    }

    ktgs = functions.generatePassword("TGSsecret")
    keytgs = AES.generateKey(ktgs)

    encrypted_ticket = functions.dict_encryption(ticket, keytgs)

    final_pkg = {
        "kctgs": kctgs,
        "idtgs": idtgs,
        "ticket_tgs": encrypted_ticket.decode(),
        "ts2": str(ts2),
        "lt2": str(lt2)
    }
    return final_pkg
Exemplo n.º 2
0
def response(kctgs, auth):
    idc = auth['idc']
    adc = auth['adc']
    ts4, lt4 = functions.timeterms()

    string_v = uuid.uuid4().hex[:6].lower()
    # print(string_v)
    kcv = functions.generatePassword(string_v)
    ticket = {
        "kcv": kcv,
        "idc": idc,
        "adc": adc,
        "idv": idv,
        "ts4": str(ts4),
        "lt4": str(lt4)
    }

    kv = functions.generatePassword("Vsecret")
    keyv = AES.generateKey(kv)

    encrypted_ticket = functions.dict_encryption(ticket, keyv)

    final_pkg = {
        "kcv": kcv,
        "idv": idv,
        "ts4": str(ts4),
        "ticketv": encrypted_ticket.decode()
    }
    return final_pkg
Exemplo n.º 3
0
'''
Recognition - Password Generator
Python 3.7.4
Password Generator Created in Python
'''

#Import Statements
import functions

#Main-------------
print("Generating a password.......")

#Assign Password
userPassword = functions.generatePassword()

#Print Users Password
print("Your password is: {}".format(userPassword))


Exemplo n.º 4
0
        "ticketv": encrypted_ticket.decode()
    }
    return final_pkg


s = socket.socket()
host = socket.gethostname()
port = 8002
s.bind((host, port))
s.listen(5)
iterator = 0

clientsocket, address = s.accept()
print(f"Connection from {address} has been established")
idtgs = 1101
ktgs = functions.generatePassword("TGSsecret")
keytgs = AES.generateKey(str(ktgs))

while True:
    try:
        package = recvmsg(clientsocket)
        print("Message received from client")
        # print(package,"\n")
        ticket_tgs_bytes = AES.decrypt(package['ticket_tgs'], keytgs)
        ticket_tgs = json.loads(ticket_tgs_bytes.decode())
        kctgs = ticket_tgs['kctgs']
        keyctgs = AES.generateKey(kctgs)

        authc = functions.getauth(kctgs, package['authenticatorC'])
        if (not functions.checkTimestamp(authc['ts'])):
            if (functions.verify(authc, ticket_tgs)):
Exemplo n.º 5
0
isRunning = True
idtgs = 1101

ip_add = socket.gethostbyname(host)
clientInfo = {}
download_request = "DownloadHome"

while isRunning:
    print("1) Run the Client")
    print("2) Exit")
    choice = int(input())
    if (choice == 1):
        idc = int(input("Enter the ClientID: "))
        password = getpass.getpass()
        hashed_password = functions.generatePassword(password)

        if (client_has_key(idc) and (clientInfo[idc] != None)):
            user_input = input(
                "\nDo you want to download the homepage? (y/n): ")
            if (user_input == 'y' or user_input == 'Y'):
                download_homepage(idc, True)

            else:
                continue

        else:
            keyc = AES.generateKey(hashed_password)

            package = {
                "idc": idc,
Exemplo n.º 6
0
        mode = int(
            input(
                "Please choose:\n1 - Default Options (recommended)\n2 - Custom Options\nYour choice: "
            ))
    except:
        print("Warning: That's not a valid option. Let's try again.")
if mode == 1:
    pwdOptions = defaultOptions
elif mode == 2:
    # ask user input for the Options
    pwdOptions = fc.presentOptions()
else:
    # this should not happen, EVER!!!
    raise ValueError(
        "Incorrect option passed. This should not happen please investigate.")
if mode and pwdOptions:
    print("Generating Password")
    pwdConfig = fc.prepareOptions(pwdOptions)
    success = False
    while not success:
        password = ''.join(fc.generatePassword(pwdConfig))
        print("Your password is:", password)
        if fc.inHistory(password):
            print("Password exists...we need a new one")
        else:
            success = True
    if fc.savePassword(password):
        print("Password saved successfully")
    else:
        print("Failed to save password. Please check file permissions")
Exemplo n.º 7
0
 elif choice == '6':
     redo6 = 'y'
     while redo6 == 'y' or redo6 == 'Y':
         service = input("What service are you making an account for? ")
         pw = input("Enter a word to generate a random password. ")
         while True:
             length = int(
                 input(
                     "How long do you want your password to be? (10-15) "))
             if length < 10:
                 print("Password too short.")
             elif length > 15:
                 print("Password too long.")
             else:
                 break
         pw = generatePassword(service.encode('utf-8'), pw.encode('utf-8'),
                               length)
         print("The randomly generated password is " + pw + ".")
         print("-----------------------------------------")
         print("PLEASE KEEP IT IN A SAFE PLACE")
         print("-----------------------------------------")
         store = input("Would you like to store this password? (y/n) ")
         if store == "y" or store == "Y":
             emailUser = input(
                 "What is the email/username for the service? ")
             storeInfo(service, emailUser.encode('utf-8'),
                       pw.encode('utf-8'), db, s)
             changes = True
         redo6 = input("Would you like to make another password? (y/n) ")
     redo = input("\nDo you need anything else? (y/n) ")
 elif choice == '0':
     break
Exemplo n.º 8
0
        html_text = prepareHtml()
        encrypted_text = AES.encrypt(html_text, keycv)

    return encrypted_text


s = socket.socket()
host = socket.gethostname()
port = 8003
s.bind((host, port))
s.listen(5)

clientsocket, address = s.accept()
print(f"Connection from {address} has been established")
idv = 100
kv = functions.generatePassword("Vsecret")
keyv = AES.generateKey(str(kv))

clientInfo = {}

loop = True

while loop:
    try:
        package = recvmsg(clientsocket)
        print("Message received from the client")

        if (type(package) == type({})):
            ticket_v_bytes = AES.decrypt(package['ticketv'], keyv)
            ticketv = json.loads(ticket_v_bytes.decode())