コード例 #1
0
ファイル: FileHandler.py プロジェクト: aThornes/PassLocker
def CreateSFFPSL(FilePath):
    global securityPath
    securityPath = FilePath

    newKey = Encryptor.GenerateSecurityKey()

    fillKey = Encryptor.GenerateSALT(64, True)
    toSave = ""
    for idx, val in enumerate(newKey):
        toGrab = 2 * idx
        toSave += val + fillKey[toGrab] + fillKey[toGrab + 1]

    toSave = Encryptor.AESEncrypt(toSave, sep2)

    #Now write to file
    SFFPSLFile = open(securityPath + exSecFile, "w+")
    SFFPSLFile.write(toSave + "\n")
    SFFPSLFile.close()

    UpdateSecurityKey(newKey)
    UpdateSecurityPath(FilePath)
コード例 #2
0
#First check if user account exists
fileFound = FileHandler.DoesAccountExist()
if (not fileFound):
    #Create user account since it doesn't exist
    try:
        CreateAccount()
        console.out(17)  #Success, account created
    except Exception:
        console.out(18)  #Failure
        raise

#Now get the user to log in to their account
credentialPass = False

validationKey = Encryptor.GenerateSALT()
while (not credentialPass):
    verification = VerifyUser()
    if (not verification[0]):
        if (verification[1] == "Invalid"):
            #console.cls()
            console.out(24, 0.03)
    else:
        #Success, user has logged in
        securityKey = Encryptor.GenerateSecurityKey()
        FileHandler.CreateSecurityFile(
            Encryptor.OneWayEncryptor(securityKey, validationKey), username)
        Command = CMD.CommandHandler(username, verification[1])
        credentialPass = verification

PasswordLocker()