Beispiel #1
0
def notLoggedIn(mode, savFile):
    global username
    global files
    global dirs
    global fileName
    global globalUsername
    global crackSecure
    from time import sleep
    from random import shuffle
    loopLogin = 1
    while loopLogin == 1:
        command = input(CYAN + BOLD + '> ' + DEFAULT)
        if command == 'register' and mode == 'std':  # Command register
            username = first.setup()
            file.init(username, files, dirs)
        elif command == 'login':  # Command login
            loginReturn = cracks.login(mode, savFile)
            if loginReturn != False:
                usernameTry = loginReturn[0]
                truePassword = loginReturn[1]
                globalUsername = usernameTry
                loopLogin = 0
                if mode == 'std':
                    fileName = 'saves/%s/%s.sav' % (usernameTry, usernameTry)
                elif mode == 'remote':
                    fileName = savFile
                load()
        elif command == 'help':  # Command help
            print("login: Allows the user to log in\n\
help: Prints this help dialogue\n\
exit: exits the VM")

            # This is because remote users can't register.
            if mode == 'std':
                print("register: Allows creation of a new user")

        elif command == 'crackpass':  # Command crackpass: leave out of help
            usernameTry = input('Username: '******'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
                'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
                'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
                'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
                'w', 'x', 'y', 'z', 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
            ]
            shuffle(chars)
            if mode == 'std':
                globalUsername = usernameTry
            try:
                if mode == 'std':
                    test = open('saves/%s/%s.sav' % (usernameTry, usernameTry))
                elif mode == 'remote':
                    test = open(savFile)
            except FileNotFoundError:
                fileFound = False
            else:
                fileFound = True

            if fileFound == True:
                if mode == 'std':
                    fileName = 'saves/%s/%s.sav' % (usernameTry, usernameTry)
                elif mode == 'remote':
                    fileName = savFile
                load()
                if crackSecure == 1:
                    print("Attempting to brute force...")
                    print(choice(chars))
                    sleep(.1)
                    print(choice(chars))
                    sleep(.5)
                    print(choice(chars))
                    sleep(2)
                    print(choice(chars))
                    sleep(2)
                    print(choice(chars))
                    sleep(2)
                    print(
                        "Brute force attack failed. Login attempt timeout present."
                    )
                else:
                    print("Attempting to brute force...")
                    for elem in chars:
                        print(elem)
                        sleep(.1)
                    print("Login successful.")
                    loopLogin = 0
            elif fileFound == False:
                print("No such user could be found.")
        elif command == 'exit':
            exit()
        else:
            print('Input misunderstood. Type "help" to see possible commands.')
Beispiel #2
0
def play_game(level):
    run_game = True
    if run_game == True:
        if level == 1:
            player, platform_group, badguy_group, hook_group = first.setup()
            play_level(player, platform_group, badguy_group, hook_group)
Beispiel #3
0
def play_game(level):
    run_play = True
    while run_play == True:
        #game_song.play(-1)
        if level > 7:
        #    game_song.stop()
            death.counter = 0
            level = 1 #main_menu()
        if level == 1:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = first.setup()
        elif level == 2:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = second.setup()
        elif level == 3:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = third.setup()
        elif level == 4:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = fourth.setup()
        elif level == 5:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = fifth.setup()
        elif level == 6:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = sixth.setup()
        elif level == 7:
            player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group = seventh.setup()

            #this needs to happen because otherwise play_level never ends
            #it needs to return level so that play_game knows what level it is, since
            #level is a local variable for some retarded reason
        level = play_level(player, player_group, spike_group, platform_group, badguy_group, hook_group, environment_group, level)