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'