Skip to content
Snippets Groups Projects
Commit a7726738 authored by Andri Joos's avatar Andri Joos :blush:
Browse files

add Attack base class

parent 24f2663a
No related branches found
No related tags found
No related merge requests found
import abc
import signal
from typing import List
from multiprocessing import Process
class Attack(object):
_processes: List[Process]
def __init__(self) -> None:
self._processes = []
@abc.abstractmethod
def run(self):
""""""
def _wait_for_sigint(self):
signal.signal(signal.SIGINT, self._sig_handler)
print("Press Ctrl+C to exit")
signal.pause()
def _sig_handler(self, sig, frame):
print("Exiting")
for process in self._processes:
if process is not None and process.is_alive():
process.kill()
process.join()
def _wait_for_processes(self):
for proc in self._processes:
proc.join()
from attacks.Attack import Attack
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment