This project provides a basic Unix shell emulator that operates on a tar archive as a virtual filesystem.
- Emulates basic Unix commands:
ls
,cd
,pwd
,exit
,history
. - Operates on a tar archive without unpacking.
- Customizable username and computer name in the prompt.
- Logging of commands with timestamps and username.
- Support for executing a startup script.
To run the emulator, use the following command:
python emulator.py -u [username] -c [computername] [filesystem.tar] -l [logfile.csv] -s [script.txt]
-u, --user
: Username (default: user)-c, --computer
: Computer name (default: localhost)<filesystem.tar>
: Required. Path to the tar archive containing the virtual filesystem.-l, --log
: Path to the log file (default: log.csv).-s, --script
: Path to a script file to execute on startup.
Example:
python emulator.py -u myuser -c mycomputer myfilesystem.tar -l mylog.csv -s myscript.txt
You can easily run the UnixShellEmulator using Docker. This allows for a consistent environment without needing to install dependencies on your local machine.
- Install Docker on your system. Follow the instructions at Docker Installation.
Navigate to the project directory where your Dockerfile
is located, and build the Docker image with the following command:
docker build -t unixshell-emulator .
To run the emulator, you can mount a local directory containing your tar archive and log file. Use the following command:
docker run -it --rm -v /path/to/local/directory:/app/data unixshell-emulator /app/data/filesystem.tar -u [username] -c [computername] -l /app/data/logfile.csv -s /app/data/script.txt