Modify monkey_island/linux/run.sh to use pipenv

This commit is contained in:
Mike Salvatore 2021-04-19 19:37:46 -04:00
parent de8e306786
commit 051621bdfa
2 changed files with 20 additions and 15 deletions

View File

@ -60,8 +60,8 @@ You may also pass in an optional third `false` parameter to disable downloading
After the `deploy_linux.sh` script completes, you can start the monkey island. After the `deploy_linux.sh` script completes, you can start the monkey island.
```sh ```sh
cd infection_monkey/monkey cd infection_monkey/monkey/monkey_island
./monkey_island/linux/run.sh pipenv run ./linux/run.sh
``` ```
## Pre-commit hooks ## Pre-commit hooks

View File

@ -1,16 +1,21 @@
#!/bin/bash #!/bin/bash
# Detecting command that calls python 3.7 start_mongo() {
python_cmd="" # TODO: Handle starting and cleaning up mongo inside monkey_island.py or
if [[ $(python --version 2>&1) == *"Python 3.7"* ]]; then # monkey_island/main.py.
python_cmd="python" ./bin/mongodb/bin/mongod --dbpath ./bin/mongodb/db &
fi }
if [[ $(python37 --version 2>&1) == *"Python 3.7"* ]]; then
python_cmd="python37"
fi
if [[ $(python3.7 --version 2>&1) == *"Python 3.7"* ]]; then
python_cmd="python3.7"
fi
./monkey_island/bin/mongodb/bin/mongod --dbpath ./monkey_island/bin/mongodb/db & cd_to_monkey() {
${python_cmd} ./monkey_island.py # Pipenv must be run from monkey/monkey/monkey_island, but monkey_island.py
# must be executed from monkey/monkey.
cd ..
}
start_monkey_island() {
cd_to_monkey
python ./monkey_island.py
}
start_mongo
start_monkey_island