Skip to content

Instantly share code, notes, and snippets.

@mhils
Last active December 15, 2015 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhils/5242278 to your computer and use it in GitHub Desktop.
Save mhils/5242278 to your computer and use it in GitHub Desktop.
untested
from bottle import route, run, debug
from os import system
from time import time
import psutil
debug(False)
auth = 'changeme'
@route('/restart/:secret')
def restart(secret):
if secret != auth:
return "wrong secret"
honeyproxy_processes = filter(lambda x: x.name in "python" and any("honeyproxy.py" in y for y in x.cmdline), psutil.process_iter())
for p in honeyproxy_processes:
p.kill()
t = time()
system("nohup python honeyproxy/honeyproxy.py --api-auth %s -w %d.dump > %d.log 2> %d.err < /dev/null &" % (auth, t, t, t))
return "instance resetted."
run(host='0.0.0.0', port=8000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment