Beispiel #1
0
def CreateAccount():
    console.out(16, 0.03)

    askCommand = True
    while (askCommand):
        newUser = input("")
        newPass = ""
        if (not ParseForCommand(newUser)):
            askCommand = False

    doesMatch = False
    while (not doesMatch):
        console.out(21)
        newPass = getpass.getpass("")
        if (not ParseForCommand(newPass)
            ):  #Only run rest of routine if input was not a command
            console.out(22)
            check = getpass.getpass("")

            if (newPass == check):
                doesMatch = True
            else:
                console.out(23)

    newSalt = Encryptor.GenerateSALT()
    encPass = Encryptor.OneWayEncryptor(newPass, newSalt)
    FileHandler.CreateUserAccount(newUser, encPass, newSalt)
Beispiel #2
0
 def __init__(self, user, passw):
     salt = enc.GenerateSALT()
     self.sessionSALT = salt
     self.user = enc.AESEncrypt(user, salt)
     self.passw = enc.AESEncrypt(passw, salt)
     self.toClear = False
     
     #Define all commands, add to self
     commandList = []
     for cmds in GetCommandList():            
         commandList.append(CommandInfo.Command(cmds[0], getattr(self, cmds[0]), cmds[1], cmds[2], cmds[3], cmds[4]))
     self.commandList = commandList
Beispiel #3
0
def CreateSecurityFile(EncrpytedPassKey, AESKey):
    if (DoesProgramFileExist(securityFile)):
        os.remove(GetFileLocation() +
                  securityFile)  #Old file is useless, remove it if it exists
    #Now build file contents
    fileContents = [
        "#Active Session, DO NOT EDIT",
        Encryptor.AESEncrypt("Security_Session_Key", Encryptor.GenerateSALT())
    ]
    encKey = Encryptor.AESEncrypt(
        EncrpytedPassKey, AESKey)  #Again, doesn't need to be overly secure
    fileContents.append(encKey)

    sessionFile = open((GetFileLocation() + securityFile), "w+")
    for x in fileContents:
        sessionFile.write(x + "\n")
    sessionFile.close()
Beispiel #4
0
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)
Beispiel #5
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()