From 6f3593510c4dbb574e40b49273caf1a5b82c4fe7 Mon Sep 17 00:00:00 2001 From: Alexander Rymdeko-Harvey Date: Wed, 20 Dec 2017 08:59:14 -0500 Subject: [PATCH] docker --- Dockerfile | 2 +- empire | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index e310aa8..c9290cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN apt-get update && apt-get install -qy \ sudo \ apt-utils \ lsb-core \ - python2.7 \ + python2.7 # cleanup image RUN apt-get -qy clean \ diff --git a/empire b/empire index 6976b31..9bf0072 100755 --- a/empire +++ b/empire @@ -20,6 +20,16 @@ serverExitCommand = 'restart' # ##################################################### +def database_check_docker(): + """ + Check for docker and setup database if nessary. + """ + if os.path.exists('/.dockerenv'): + if not os.path.exists('data/empire.db'): + print '[*] Fresh start in docker, running reset.sh for you' + subprocess.call(['./setup/reset.sh'] + + def database_connect(): """ Connect with the backend ./empire.db sqlite database and return the @@ -1325,11 +1335,7 @@ if __name__ == '__main__': restGroup.add_argument('--password', nargs=1, help='Start the RESTful API with the specified password instead of pulling from empire.db') args = parser.parse_args() - - if os.path.exists('/.dockerenv'): - if not os.path.exists('data/empire.db'): - print '[*] Fresh start in docker, running reset.sh for you' - subprocess.call(['./setup/reset.sh'] + database_check_docker() if not args.restport: args.restport = '1337'