forked from p15670423/monkey
Agent: Remove option for custom singleton mutex name and add it as a constant
This commit is contained in:
parent
bc08ebeebd
commit
4c08bf1a62
|
@ -99,9 +99,6 @@ class Configuration(object):
|
|||
# sets whether or not the monkey is alive. if false will stop scanning and exploiting
|
||||
alive = True
|
||||
|
||||
# string of the mutex name for single instance
|
||||
singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}"
|
||||
|
||||
# how long to wait between scan iterations
|
||||
timeout_between_iterations = 100
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
"smb_service_name": "InfectionMonkey",
|
||||
"retry_failed_explotation": true,
|
||||
"self_delete_in_cleanup": true,
|
||||
"singleton_mutex_name": "{2384ec59-0df8-4ab9-918c-843740924a28}",
|
||||
"skip_exploit_if_file_exist": false,
|
||||
"exploit_user_list": [],
|
||||
"exploit_password_list": [],
|
||||
|
|
|
@ -3,11 +3,12 @@ import logging
|
|||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
from infection_monkey.config import WormConfiguration
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
SINGLETON_MUTEX_NAME = "{2384ec59-0df8-4ab9-918c-843740924a28}"
|
||||
|
||||
|
||||
class _SystemSingleton(object, metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def try_lock(self):
|
||||
|
@ -20,7 +21,7 @@ class _SystemSingleton(object, metaclass=ABCMeta):
|
|||
|
||||
class WindowsSystemSingleton(_SystemSingleton):
|
||||
def __init__(self):
|
||||
self._mutex_name = r"Global\%s" % (WormConfiguration.singleton_mutex_name,)
|
||||
self._mutex_name = r"Global\%s" % (SINGLETON_MUTEX_NAME,)
|
||||
self._mutex_handle = None
|
||||
|
||||
def try_lock(self):
|
||||
|
@ -55,7 +56,7 @@ class WindowsSystemSingleton(_SystemSingleton):
|
|||
|
||||
class LinuxSystemSingleton(_SystemSingleton):
|
||||
def __init__(self):
|
||||
self._unix_sock_name = str(WormConfiguration.singleton_mutex_name)
|
||||
self._unix_sock_name = str(SINGLETON_MUTEX_NAME)
|
||||
self._sock_handle = None
|
||||
|
||||
def try_lock(self):
|
||||
|
|
Loading…
Reference in New Issue