diff --git a/README.md b/README.md index 7668417..1159cbd 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,14 @@ Usage python fallout.py ``` -To use the login in another program: +or for hard mode where the user must manually enter the correct input in the +boot script, + +``` +python fallout.py hard +``` + +To only use the login in another program: ``` import fallout_login @@ -20,3 +27,15 @@ import fallout_login # returns true if the correct password is entered, false otherwise fallout_login.beginLogin() ``` + +Passwords +================ + +To add your own lists of passwords, check out the passwords.txt file + +Notes +================ + +Check out cool-retro-term +(https://github.com/Swordfish90/cool-retro-term) to make your terminal +look like a fallout terminal diff --git a/fallout.py b/fallout.py index f5fb2f7..70f44fc 100755 --- a/fallout.py +++ b/fallout.py @@ -2,8 +2,13 @@ import fallout_login as login import fallout_boot as boot import fallout_locked as locked +import sys -if boot.beginBoot(False): +hard = False +if len(sys.argv) == 2 and sys.argv[1].lower() == 'hard': + hard = True + +if boot.beginBoot(hard): if login.beginLogin(): print 'Login successful' else: diff --git a/fallout_boot.py b/fallout_boot.py index 3b3820e..b64166b 100644 --- a/fallout_boot.py +++ b/fallout_boot.py @@ -1,9 +1,19 @@ -import curses from fallout_functions import slowWrite +import curses ######################## global 'constants' ############## -ENTRY_1 = 'set terminal/inquire' +ENTRY_1 = 'SET TERMINAL/INQUIRE' + +ENTRY_2 = 'SET FILE/PROTECTION=OWNER:RWED ACCOUNTS.F' + +ENTRY_3 = 'SET HALT RESTART/MAINT' + +ENTRY_4 = 'RUN DEBUG/ACCOUNTS.F' + +INPUT_PAUSE = 500 # ms + +TYPE_DELAY = 25 ######################## text strings #################### @@ -11,21 +21,72 @@ MESSAGE_1 = 'WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK' MESSAGE_2 = 'RIT-V300' +MESSAGE_3 = 'Initializing Robco Industries(TM) MF Boot Agent v2.3.0\n' \ + 'RETROS BIOS\n' \ + 'RBIOS-4.02.08.00 52EE5.E7.E8\n' \ + 'Copyright 2201-2203 Robco Ind.\n' \ + 'Uppermem: 64 KB\n' \ + 'Root (5A8)\n' \ + 'Maintenance Mode' + + ######################## functions ####################### -def runBoot(scr): +def runBoot(scr, hardMode): """ Start the boot portion of the terminal """ curses.use_default_colors() - # set screen to initial position scr.erase() scr.move(0, 0) + + curses.echo() - slowWrite(scr, MESSAGE_1 + '\n\n>') + slowWrite(scr, MESSAGE_1 + '\n\n') - curses.napms(500) + if hardMode: + # use must enter the correct text to proceed + entry = '' + while entry.upper() != ENTRY_1.upper(): + slowWrite(scr, '>') + entry = scr.getstr() + else: + # input is entered for them + slowWrite(scr, '>') + curses.napms(INPUT_PAUSE) + slowWrite(scr, ENTRY_1 + '\n', TYPE_DELAY) + slowWrite(scr, '\n' + MESSAGE_2 + '\n\n') + + if hardMode: + entry = '' + while entry.upper() != ENTRY_2.upper(): + slowWrite(scr, '>') + entry = scr.getstr() + while entry.upper() != ENTRY_3.upper(): + slowWrite(scr, '>') + entry = scr.getstr() + else: + slowWrite(scr, '>') + curses.napms(INPUT_PAUSE) + slowWrite(scr, ENTRY_2 + '\n', TYPE_DELAY) + slowWrite(scr, '>') + curses.napms(INPUT_PAUSE) + slowWrite(scr, ENTRY_3 + '\n', TYPE_DELAY) + + slowWrite(scr, '\n' + MESSAGE_3 + '\n\n') + + if hardMode: + entry = '' + while entry.upper() != ENTRY_4.upper(): + slowWrite(scr, '>') + entry = scr.getstr() + else: + slowWrite(scr, '>') + curses.napms(INPUT_PAUSE) + slowWrite(scr, ENTRY_4 + '\n', TYPE_DELAY) + + curses.napms(INPUT_PAUSE) return True def beginBoot(hardMode): @@ -36,5 +97,5 @@ def beginBoot(hardMode): constants, or if they are entered automatically Returns true if hardMode == false or if the user entered the correct string """ - res = curses.wrapper(runBoot) + res = curses.wrapper(runBoot, hardMode) return res diff --git a/fallout_functions.py b/fallout_functions.py index 0090a6f..8ece4bb 100644 --- a/fallout_functions.py +++ b/fallout_functions.py @@ -1,4 +1,6 @@ import curses +import time +import sys LETTER_PAUSE = 5 diff --git a/fallout_login.py b/fallout_login.py index 3fb8db1..4284ebc 100644 --- a/fallout_login.py +++ b/fallout_login.py @@ -1,5 +1,3 @@ -#! /usr/bin/env python - import curses import random import os @@ -61,8 +59,13 @@ def getPasswords(): Returns an array of strings to be used as the password and the decoys """ groups = [] + + # script file / password file location + __location__ = os.path.realpath(os.path.join(os.getcwd(), + os.path.dirname(__file__))) + # read from passwords.txt - with open("passwords.txt") as pwfile: + with open(os.path.join(__location__, "passwords.txt")) as pwfile: for line in pwfile: if not line.strip(): groups.append([])