War Games shell scripting fun

+

War Games

While my daughter and I sat across from each other in Starbucks drinking coffee and PIN messaging each other in Leetspeak using our BlackBerries (yes, I realize how drastically nerdy this is), the thought occurred to us that a simple shell script could easily be used to simulate the War Operation Plan Response (WOPR) supercomputer from the movie War Games (1983).

Anyways, we analyzed the frame-by-frame output from the movie and recreated the output on the Sun Enterprise 450 in my classroom running Red Hat Linux.

Basically, we created a user called Joshua with no password (simply remove the !! from the password field in the /etc/shadow file to make a blank password).

Next, we modified the /etc/issue and /etc/issue.net files to remove all existing lines so that only the LOGIN: prompt appears when you connect to the machine (we also had to remove the lines at the end of /etc/rc.d/rc.local that overwrite the /etc/issue and /etc/issue.net files at boot time).

Next, we created the /home/Joshua/.hushlogin file to prevent the typical crap (i.e. last login) from appearing after logging in as Joshua.

Next, we made a shell script called /home/Joshua/wopr and added the line “. /home/Joshua/wopr” to the end of the environment file /home/Joshua/.bash_profile such that it is called into the current environment following login. The shell script is shown below (it is accurate to the movie and uses “sleep 0” commands to slow things down to a 1983 rate):

#!/bin/bash
export PS1=""
clear
echo -e "\0077145    11458                11009       11893       11972        11315"
echo -e "\007PRT CON. 3.4.5.   SECTRAN 9.4.3.                    PORT STAT: SD-345"
sleep 0
echo -e "\007"
echo -e "\007(311) 699-7385"
echo -e "\007\182\182\182\182\182\182\182\182\182\182\182\182"
sleep 0
sleep 0
clear
echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
echo -e "\007(311) 699-7385"
sleep 0 && sleep 0
clear
echo -e "\n\n\n\n\n\n"
echo -e "\007(311) 767-8739"
echo -e "\007(311) 938-2364"
sleep 0
echo -e "\007-            PRT.STAT.                              CRT. DEF."
echo -e "\007           ================================================"
sleep 0
echo -e "\007               3453                                    3594"
echo -e "\007F543.4.50: SDSDKJ: SDFJSL:                     DKSJL: SKFJJ: SDKFJLJ:"
sleep 0 && sleep 0
echo -e "\007SYSPROC FUNCT READY                       ALT NET READY"
echo -e "\007CPU AUTH RV-345-AX8      SYSCOMP STATUS:  ALL PORTS ACTIVE"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
sleep 0
echo -e "(311) 938-2364"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
echo -e "728/34X24 568500291"
sleep 0
clear
echo -e "\00712934-AD-43KJ: CONTR PAK"
echo -e "(311) 767-1083"
sleep 0
echo -e "     FLD CRS: 33.34.544   HPBS: 34/45/56/83/  STATUS FLT   034/304"
sleep 0 && sleep 0
clear
echo -e "\n\n\n\n\n\n\n\n\n\n\n\n"
echo -e "\007\182\182\182\182\182\182\182\182\182\182\182\182"
sleep 0
echo -e "1145-45-F6-3456                   NOPR STATUS: TRAK OFF      PRON ACTIVE"
echo -e "#45:L34:45 11 WER: 45/29/01  XCOMP: 43249582   YCOMP:34929430D  ZCOMP:343906834"
echo -e "\007\182\182\182\182\182\182\182               TRON: 65=65/74/24/65/87"
sleep 0
echo -e "\007-            PRT.STAT.                              CRT. DEF."
echo -e "\007           ================================================"
sleep 0
echo -e "\007               3453                                    3594"
sleep 0
clear
echo -e "\007FL742   TK01   BM93   RG01   PZ90   6J82   FP03   ZW08   JM89"
echo -e "REF TRAPCOM: 43.45342.349"
echo -e "\007SYSPROC FUNCT READY                       ALT NET READY"
sleep 0 && sleep 0
clear
echo -e "\007(311) 767-8739"
echo -e "\007(311) 938-2364"
sleep 0
echo -e "\007-            PRT.STAT.                              CRT. DEF."
echo -e "\007           ================================================"
sleep 0
echo -e "\007               3453                                    3594"
echo -e "\007F543.4.50: SDSDKJ: SDFJSL:                     DKSJL: SKFJJ: SDKFJLJ:"
sleep 0 && sleep 0
echo -e "\007SYSPROC FUNCT READY                       ALT NET READY"
echo -e "\007CPU AUTH RV-345-AX8      SYSCOMP STATUS:  ALL PORTS ACTIVE"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
sleep 0
echo -e "(311) 938-2364"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
echo -e "728/34X24 568500291"
sleep 0
clear
echo -e "\00712934-AD-43KJ: CONTR PAK"
echo -e "(311) 767-1083"
sleep 0
echo -e "     FLD CRS: 33.34.544   HPBS: 34/45/56/83/  STATUS FLT   034/304"
sleep 0
clear
echo -e "\007(311) 767-8739"
echo -e "\007(311) 938-2364"
sleep 0
echo -e "\007-            PRT.STAT.                              CRT. DEF."
echo -e "\007           ================================================"
sleep 0
echo -e "\007               3453                                    3594"
echo -e "\007F543.4.50: SDSDKJ: SDFJSL:                     DKSJL: SKFJJ: SDKFJLJ:"
sleep 0
echo -e "\007SYSPROC FUNCT READY                       ALT NET READY"
echo -e "\007CPU AUTH RV-345-AX8      SYSCOMP STATUS:  ALL PORTS ACTIVE"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
sleep 0
echo -e "(311) 938-2364"
sleep 0
echo -e "22/34534.50/3209                                      11CVB-3904-39490"
echo -e "728/34X24 568500291"
sleep 0
clear
echo -e "\00712934-AD-43KJ: CONTR PAK"
echo -e "(311) 767-1083"
sleep 0
echo -e "     FLD CRS: 33.34.544   HPBS: 34/45/56/83/  STATUS FLT   034/304"
sleep 1
clear
sleep 4
echo -e "G\c"
sleep 0 && sleep 0
echo -e "R\c"
sleep 0 && sleep 0
echo -e "E\c"
sleep 0 && sleep 0
echo -e "E\c"
sleep 0 && sleep 0
echo -e "T\c"
sleep 0 && sleep 0
echo -e "I\c"
sleep 0 && sleep 0
echo -e "N\c"
sleep 0 && sleep 0
echo -e "G\c"
sleep 0 && sleep 0
echo -e "S\c"
sleep 0 && sleep 0
echo -e " \c"
sleep 0 && sleep 0
echo -e "P\c"
sleep 0 && sleep 0
echo -e "R\c"
sleep 0 && sleep 0
echo -e "O\c"
sleep 0 && sleep 0
echo -e "F\c"
sleep 0 && sleep 0
echo -e "E\c"
sleep 0 && sleep 0
echo -e "S\c"
sleep 0 && sleep 0
echo -e "S\c"
sleep 0 && sleep 0
echo -e "O\c"
sleep 0 && sleep 0
echo -e "R\c"
sleep 0 && sleep 0
echo -e " \c"
sleep 0 && sleep 0
echo -e "F\c"
sleep 0 && sleep 0
echo -e "A\c"
sleep 0 && sleep 0
echo -e "L\c"
sleep 0 && sleep 0
echo -e "K\c"
sleep 0 && sleep 0
echo -e "E\c"
sleep 0 && sleep 0
echo -e "N\c"
sleep 0 && sleep 0
echo -e "."
sleep 0 && sleep 0

Next, we decided to create a login called HELP GAMES that also has a blank password (we had to place double quotes around each backquoted section in /etc/profile to prevent errors setting variables after login). Next, we created a “/home/HELP GAMES/games” shell script that has the lines below and added the line “. /home/HELP GAMES/wopr” to the end of “/home/HELP GAMES/.bash_profile” to have it load after login:

#!/bin/bash
export PS1=""
clear
echo -e "'GAMES' REFERS TO MODELS, SIMULATIONS, AND GAMES"
echo -e "WHICH HAVE TACTICAL, AND STRATEGIC APPLICATIONS."
echo -e
echo -e "\n\n"
sleep 1
echo -e "FALKEN'S MAZE "
sleep 1
echo -e "BLACK JACK "
sleep 1
echo -e "GIN RUMMY "
sleep 1
echo -e "HEARTS "
sleep 1
echo -e "BRIDGE "
sleep 1
echo -e "CHECKERS "
sleep 1
echo -e "CHESS "
sleep 1
echo -e "POKER "
sleep 1
echo -e "FIGHTER COMBAT "
sleep 1
echo -e "GUERRILLA ENGAGEMENT "
sleep 1
echo -e "DESERT WARFARE "
sleep 1
echo -e "AIR-TO-GROUND ACTIONS "
sleep 1
echo -e "THEATERWIDE TACTICAL WARFARE "
sleep 1
echo -e "THEATERWIDE BIOTOXIC AND CHEMICAL WARFARE "
sleep 1
echo -e "\n "
echo -e "GLOBAL THERMONUCLEAR WAR "
sleep 5
exit 0

Now, you can simply type HELP GAMES to get a list of games or type Joshua to get the same screens that Matthew Broderick got in the War Games movie.