A CLI-based hacking strategy game/MMO which is deployed on a Linux SSH server. Clients interact through an SSH client. The game should be hosted on a *nix server.
-
Install an SSH server and allow remote connections: 1.1. Enter the command
sudo apt-get install openssh-server1.2. Make a copy of the config file before changing it:sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults sudo chmod a-w /etc/ssh/sshd_config.factory-defaults -
Install other dependencies with
sudo apt install mysql-server python-dev python-pip python-mysqldb libmysqlclient-dev. During installation ofmysql-server, make note of the default database password you set. -
Log into MySQL with the command
mysql -u [username] -p, then create the HTP database withCREATE DATABASE htp;and exit MySQL. -
Load the schema into MySQL with
mysql -u [username] -p htp < db.sql -
Install necessary Python libraries with
pip install MySQLdb termcolor yagmail -
If you are setting up a production server, uncomment lines 36–37 in game.py to disable keyboard interrupts (Ctrl-C, Ctrl-D, Ctrl-Z)
-
Set the
htpuserandhtppassenvironment variables to the database credentials the game should use. For example, to set thehtpuserpassword tosecr3tyou could add the lineexport htpuser='secr3t'to your~/.bashrcfile. -
Run the game with
python game.py.
Email can optionally be used for password resets. It uses the yagmail Python library. If you are enabling email, emailuser environment variable should be set to a valid Gmail address, and emailpass should be set to the password for that address.
You may also need to enable Allow Less Secure Apps and Display Unlock Captcha on your Gmail account.
- Create a UNIX user account on the server, e.g.
guest. - Edit the user's
.bashrcfile to contain onlypython /path/to/game.py - Run
touch .hushloginin the user's home directory to suppress the login banner - Install
lshellwithsudo apt install lshell. This is used to restrict access to the file system and shell. - Add the
guestuser account to thelshellgroup withsudo usermod -a -G lshell guest. - Enter the command
sudo chsh -s /usr/bin/lshell guestto setlshellas the default shell forguest. - Edit the file
/etc/lshell.confto look like this:[guest] login_script : "clear && python /path/to/game.py" path : /path/to forbidden : ["ls", "echo", "cd"] scp : 0 sftp : 0 - Test by connecting to the server via SSH using the username
guest. Ensure that you are not able to run any shell commands or view system files.
- Browser-based SSH client which connects to the game
- Website with connection instructions and information about the game
- APIs which allow the website to interface with the backend code
- Fully-featured browser application which can be used in place of the SSH client