commit
5c6d047452
92
assistant.py
92
assistant.py
|
@ -302,49 +302,63 @@ def game_loop():
|
||||||
print("Basic commands are:")
|
print("Basic commands are:")
|
||||||
print("(S)tart, (N)ext, (H)elp, (C)heck, (E)xit")
|
print("(S)tart, (N)ext, (H)elp, (C)heck, (E)xit")
|
||||||
while True:
|
while True:
|
||||||
print("Waiting for your input:")
|
try:
|
||||||
command = input()
|
print("Waiting for your input:")
|
||||||
command = command.lower()
|
command = input()
|
||||||
if command in ("a", "abort", "(a)bort"):
|
command = command.lower()
|
||||||
abort_game(game, hint_giver, flag_checker)
|
if command in ("a", "abort", "(a)bort"):
|
||||||
elif command in ("e", "exit"):
|
abort_game(game, hint_giver, flag_checker)
|
||||||
abort_game(game, hint_giver, flag_checker)
|
elif command in ("e", "exit"):
|
||||||
print("Exiting...")
|
abort_game(game, hint_giver, flag_checker)
|
||||||
return
|
print("Exiting...")
|
||||||
elif command in ("s", "start", "(s)tart"):
|
return
|
||||||
start_game(game, level_selector)
|
elif command in ("s", "start", "(s)tart"):
|
||||||
elif command in ("n", "next", "(n)ext"):
|
start_game(game, level_selector)
|
||||||
try:
|
elif command in ("n", "next", "(n)ext"):
|
||||||
if game.level == 0:
|
try:
|
||||||
print("Can't continue, (S)tart the game first!")
|
if game.level == 0:
|
||||||
elif game.level == 5:
|
print("Can't continue, (S)tart the game first!")
|
||||||
print("Can't continue, you are on the last level!")
|
elif game.level == 5:
|
||||||
print("Make sure to run (F)inish and (L)og your progress before exiting.")
|
print("Can't continue, you are on the last level!")
|
||||||
|
print("Make sure to run (F)inish and (L)og your progress before exiting.")
|
||||||
|
else:
|
||||||
|
if check_flag(game.level, flag_checker):
|
||||||
|
try_next_level(game, level_selector)
|
||||||
|
except NoLevelFoundError as err:
|
||||||
|
print("Error encountered: {}".format(err))
|
||||||
|
elif command in ("f", "finish", "(f)inish"):
|
||||||
|
if (not game.game_in_progress and not game.game_finished):
|
||||||
|
print("Can't finish game, game was not started yet.")
|
||||||
|
elif (not game.game_in_progress and game.game_finished):
|
||||||
|
print("Can't finish game, game was already finished earlier.")
|
||||||
else:
|
else:
|
||||||
if check_flag(game.level, flag_checker):
|
if check_flag(game.level, flag_checker):
|
||||||
try_next_level(game, level_selector)
|
finish_game(game)
|
||||||
except NoLevelFoundError as err:
|
elif command in ("i", "info", "information", "(i)nfo", "(i)nformation"):
|
||||||
print("Error encountered: {}".format(err))
|
game.print_info()
|
||||||
elif command in ("f", "finish", "(f)inish"):
|
elif command in ("h", "help", "(h)elp"):
|
||||||
if (not game.game_in_progress and not game.game_finished):
|
print_help()
|
||||||
print("Can't finish game, game was not started yet.")
|
elif command in ("c", "check", "(c)heck"):
|
||||||
elif (not game.game_in_progress and game.game_finished):
|
check_prerequisites()
|
||||||
print("Can't finish game, game was already finished earlier.")
|
elif command in ("l", "log", "(l)og"):
|
||||||
|
player_logging(game, hint_giver, flag_checker)
|
||||||
|
elif command in ("t", "hint", "hin(t)"):
|
||||||
|
give_hint(game, hint_giver)
|
||||||
else:
|
else:
|
||||||
if check_flag(game.level, flag_checker):
|
print("Unknown command. Enter another command or try (H)elp.")
|
||||||
finish_game(game)
|
except EOFError:
|
||||||
elif command in ("i", "info", "information", "(i)nfo", "(i)nformation"):
|
|
||||||
game.print_info()
|
|
||||||
elif command in ("h", "help", "(h)elp"):
|
|
||||||
print_help()
|
|
||||||
elif command in ("c", "check", "(c)heck"):
|
|
||||||
check_prerequisites()
|
|
||||||
elif command in ("l", "log", "(l)og"):
|
|
||||||
player_logging(game, hint_giver, flag_checker)
|
|
||||||
elif command in ("t", "hint", "hin(t)"):
|
|
||||||
give_hint(game, hint_giver)
|
|
||||||
else:
|
|
||||||
print("Unknown command. Enter another command or try (H)elp.")
|
print("Unknown command. Enter another command or try (H)elp.")
|
||||||
|
print("If you want to exit the assistant, please use the `exit` command.")
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("You sent a keyboard interrupt to the program.")
|
||||||
|
print("Would you like to exit?")
|
||||||
|
print("This will NOT save your log or end the game. yes/no")
|
||||||
|
confirmation = input()
|
||||||
|
confirmation = confirmation.lower()
|
||||||
|
if confirmation in ("y", "yes"):
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
print("Not exiting. Continuing normal operation.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -31,7 +31,7 @@ level4:
|
||||||
"Password cracking": "The password appears to be encrypted with a simple MD5 hash. A tool like John the Ripper, which is already installed on the computer, could be used to crack the password."
|
"Password cracking": "The password appears to be encrypted with a simple MD5 hash. A tool like John the Ripper, which is already installed on the computer, could be used to crack the password."
|
||||||
"Command line options": 'The arguments you will need to crack the password are "--format=" and "--wordlist="'
|
"Command line options": 'The arguments you will need to crack the password are "--format=" and "--wordlist="'
|
||||||
"Database interaction": "Use the [SQL] button in the web shell to interact with log into local databases and interact with them using SQL queries."
|
"Database interaction": "Use the [SQL] button in the web shell to interact with log into local databases and interact with them using SQL queries."
|
||||||
"Solution": "Place to hash in to_crack.txt. Run `john --format=raw-md5 --wordlist=passwords.txt to_crack.txt` to get the password."
|
"Solution": "Place the hash in to_crack.txt. Run `john --format=raw-md5 --wordlist=passwords.txt to_crack.txt` to get the password."
|
||||||
level5:
|
level5:
|
||||||
level5:
|
level5:
|
||||||
"Database interaction": "You can communicate with local databases using SQL queries."
|
"Database interaction": "You can communicate with local databases using SQL queries."
|
||||||
|
|
Reference in New Issue