Merge pull request #698 from dadav/feature/usr1_handler

Add signal handler
This commit is contained in:
evilsocket 2019-12-07 14:09:36 +02:00 committed by GitHub
commit b79c59c639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ import logging
import argparse
import time
import yaml
import signal
import pwnagotchi
import pwnagotchi.grid as grid
@ -12,6 +13,7 @@ import pwnagotchi.plugins as plugins
from pwnagotchi.identity import KeyPair
from pwnagotchi.agent import Agent
from pwnagotchi.ui.display import Display
from pwnagotch import restart
def do_clear(display):
@ -134,6 +136,12 @@ if __name__ == '__main__':
agent = Agent(view=display, config=config, keypair=KeyPair(view=display))
def usr1_handler(*unused):
logging.info('Received USR1 singal. Restart process ...')
restart("MANU" if args.do_manual else "AUTO")
signal.signal(signal.SIGUSR1, usr1_handler)
if args.do_manual:
do_manual_mode(agent)
else: