Agent: Remove option for custom singleton mutex name and add it as a constant

This commit is contained in:
Shreya Malviya 2021-11-15 16:30:39 +05:30
parent bc08ebeebd
commit 4c08bf1a62
3 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -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": [],

View File

@ -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):