forked from p15670423/monkey
Improved gevent related code by using BoundedSemaphore instead of Semaphore and other small style fixes
This commit is contained in:
parent
a9af6fe736
commit
f2b65ecf14
|
@ -1,5 +1,5 @@
|
|||
from gevent import monkey
|
||||
monkey.patch_all()
|
||||
from gevent import monkey as gevent_monkey
|
||||
gevent_monkey.patch_all()
|
||||
|
||||
from monkey_island.cc.main import main
|
||||
|
||||
|
@ -8,8 +8,9 @@ def parse_cli_args():
|
|||
import argparse
|
||||
parser = argparse.ArgumentParser(description="Infection Monkey Island CnC Server. See https://infectionmonkey.com")
|
||||
parser.add_argument("-s", "--setup-only", action="store_true",
|
||||
help="Pass this flag to cause the Island to setup and exit without actually starting. This is useful "
|
||||
"for preparing Island to boot faster later-on, so for compiling/packaging Islands.")
|
||||
help="Pass this flag to cause the Island to setup and exit without actually starting. "
|
||||
"This is useful for preparing Island to boot faster later-on, so for "
|
||||
"compiling/packaging Islands.")
|
||||
args = parser.parse_args()
|
||||
return args.setup_only
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import logging
|
||||
from gevent.lock import Semaphore
|
||||
from gevent.lock import BoundedSemaphore
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -7,9 +7,9 @@ logger = logging.getLogger(__name__)
|
|||
# Report generation can be quite slow if there is a lot of data, and the UI queries the Root service often; without
|
||||
# the locks, these requests would accumulate, overload the server, eventually causing it to crash.
|
||||
logger.debug("Initializing report generation locks.")
|
||||
__report_generating_lock = Semaphore()
|
||||
__attack_report_generating_lock = Semaphore()
|
||||
__regular_report_generating_lock = Semaphore()
|
||||
__report_generating_lock = BoundedSemaphore()
|
||||
__attack_report_generating_lock = BoundedSemaphore()
|
||||
__regular_report_generating_lock = BoundedSemaphore()
|
||||
|
||||
|
||||
def safe_generate_reports():
|
||||
|
|
Loading…
Reference in New Issue