Package: enosimulator
AboutThis software can be used to simulate an attack/defense cybersecurity competition using the game engine and services provided byEnowars. For further information on how to use it, please refer to thedocumentation.Getting StartedPrerequisitesDownload and install the latest versions ofPythonandPip.Download and install the latest version ofTerraform.Download and install the latest version ofPacker.Create an account with your preferred cloud provider (currently supportingMicrosoft AzureandHetzner Cloud).If you are using Windows, make sure to installGit Bashand addC:\Program Files\Git\binto yourPATHenvironment variable to be able to run shell scripts.SetupPipInstall the package via pip:pipinstall--userenosimulatorStart the simulation with the following command:enosimulator-c/path/to/config.json-s/path/to/secrets.json-vManualClone the repository to your local machine as follows:gitclonehttps://github.com/ashiven/enosimulator.gitInstall the necessary dependencies:pipinstall--user-rrequirements.txtStart the program (paths to the configuration files can also be defined in the environment variablesENOSIMULATOR_CONFIGandENOSIMULATOR_SECRETS):pythonenosimulator-c/path/to/config.json-s/path/to/secrets.jsonNavigate to the frontend directory and start the frontend:cd./frontend&&npminstall&&npmrunbuild&&npmrunstartA graphical user interface is available athttp://localhost:3000to monitor the simulation. (It may take up to 20 minutes for the simulation to start.)DockerClone the repository to your local machine as follows:gitclonehttps://github.com/ashiven/enosimulator.gitCreate an SSH key pair in theconfigdirectory:ssh-keygen-f./enosimulator/config/simkeySpecify simulation details inenosimulator/config/config.jsonandenosimulator/config/secrets.jsonwith the following SSH key paths.{"vm-secrets":{"ssh-public-key-path":"/app/enosimulator/config/simkey.pub","ssh-private-key-path":"/app/enosimulator/config/simkey"}}{"setup":{"ssh-config-path":"/app/enosimulator/config/simconfig"}}Start the docker containers:dockercomposeup-dA graphical user interface is available athttp://localhost:3000to monitor the simulation. (It may take up to 20 minutes for the simulation to start.)ConfigurationThere are two configuration files that need to be supplied before launching the simulation (examples can be foundhere).secrets.json{"vm-secrets":{"github-personal-access-token":"<string> <required> <a github personal access token that will be used on machines to pull repositories>","ssh-public-key-path":"<string> <required> <path to the public key that will be stored on machines>","ssh-private-key-path":"<string> <required> <path to the matching private key that will be used to connect to machines>"},"cloud-secrets":{"azure-service-principal":{"subscription-id":"<string> <required> <the azure subscription id>","client-id":"<string> <required> <the azure service principal client id>","client-secret":"<string> <required> <the azure service principal client secret>","tenant-id":"<string> <required> <the azure service principal tenant id>"},"hetzner-api-token":"<string> <required> <the hetzner api token>"}}config.json{"setup":{"ssh-config-path":"<string> <required> <the path, including filename, where the ssh config for the simulation should be saved locally>","location":"<string> <required> <'local' or the name of the cloud provider to be used for the simulation setup>","vm-sizes":{"vulnbox":"<string> <required> <the size of the vms that should be used for the vulnboxes>","checker":"<string> <required> <the size of the vms that should be used for the checkers>","engine":"<string> <required> <the size of the vms that should be used for the engine>"},"vm-image-references":{"vulnbox":"<string> <optional> <a vm image that should be used for vulnboxes>","checker":"<string> <optional> <a vm image that should be used for checkers>","engine":"<string> <optional> <a vm image that should be used for the engine>"}},"settings":{"duration-in-minutes":"<int> <required> <the duration of the simulation in minutes>","teams":"<int> <required> <the number of teams that should participate in the simulation>","services":"<List(string)> <required> <the repository names of the services that should be used for the simulation>","checker-ports":"<List(int)> <required> <the port numbers of the service checkers. the order should be the same as in services>","simulation-type":"<string> <required> <the type of simulation to run. choose between 'realistic', 'basic-stress-test', 'stress-test' and 'intensive-stress-test'>","scoreboard-file":"<string> <optional> <the path to a scoreboard file in json format from a past competition that will be used to derive a team experience distribution for the simulation>"},"ctf-json":{"title":"<string> <required> <the title of the ctf>","flag-validity-in-rounds":"<int> <required> <the number of rounds a flag is valid>","checked-rounds-per-round":"<int> <required> <the number of rounds checked per round>","round-length-in-seconds":"<int> <required> <the length of a round in seconds>"}}Packer ImagesThe deployment process can be sped up considerably by using virtual machine images that were created withPacker. The following steps describe how to create such images.Navigate to thepackerdirectory for your chosen cloud provider. For example, for Hetzner Cloud:cd./packer/hetznerInstall the Hetzner plugin for Packer:packerpluginsinstallgithub.com/hashicorp/hcloudModify the available provisioning scripts and build templates to your liking. For example, you can add the specific services to be played during the simulation.Make sure to also add yourGitHub Personal Access Tokento the provisioning script so it can be used to pull repositories from GitHub. For this, modify the following line in the provisioning script:pat="<insert-your-token-here>"Build the image:packerbuild-var'hcloud_token=<insert-your-token-here>'your-packer-template.jsonMonitoringBrowser UIThere is a browser UI available athttp://localhost:3000that can be used to monitor the simulation.CLITo receive detailed information about the current state of the simulation in the CLI, start the program with the-vflag. The following command should be used:pythonenosimulator-c/path/to/config.json-s/path/to/secrets.json-vScoreboardThe current state of the scoreboard can be monitored via the public IP address of the engine VM. It is available athttp://<engine-ip>:5001/scoreboard.Direct connections via SSHDuring the process of building the simulation infrastructure, an SSH configuration file will be generated in the location specified insideconfig.json. To connect to a specific VM via SSH, use the following command:ssh-F/path/to/simconfig<vm-name>GitHub@ashiven· 
Twitterashiven_