forked from p15670423/monkey
Specified line-wrap option to isort and skipped a file that's not correctly wrapped
This commit is contained in:
parent
930642d6c3
commit
821024035e
|
@ -77,7 +77,7 @@ script:
|
|||
- if [ $(tail -n 1 flake8_warnings.txt) -gt $PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT ]; then echo "Too many python linter warnings! Failing this build. Lower the amount of linter errors in this and try again. " && exit 1; fi
|
||||
|
||||
## Check import order
|
||||
- python -m isort . -c -p common -p infection_monkey -p monkey_island --skip common/cloud/scoutsuite
|
||||
- python -m isort . -c -p common -p infection_monkey -p monkey_island --skip-glob ./common/cloud/scoutsuite --skip ./monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/rule_path_creators_list.py -l 120 --wl 120
|
||||
|
||||
## Run unit tests
|
||||
- cd monkey # This is our source dir
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from common.network.network_utils import (get_host_from_network_location,
|
||||
remove_port)
|
||||
from common.network.network_utils import get_host_from_network_location, remove_port
|
||||
|
||||
|
||||
class TestNetworkUtils(TestCase):
|
||||
|
|
|
@ -14,8 +14,7 @@ from infection_monkey.config import GUID, WormConfiguration
|
|||
from infection_monkey.network.info import check_internet_access, local_ips
|
||||
from infection_monkey.transport.http import HTTPConnectProxy
|
||||
from infection_monkey.transport.tcp import TcpProxy
|
||||
from infection_monkey.utils.exceptions.planned_shutdown_exception import \
|
||||
PlannedShutdownException
|
||||
from infection_monkey.utils.exceptions.planned_shutdown_exception import PlannedShutdownException
|
||||
|
||||
__author__ = 'hoffer'
|
||||
|
||||
|
|
|
@ -12,11 +12,8 @@ from ctypes import c_char_p
|
|||
|
||||
from common.utils.attack_utils import ScanStatus, UsageEnum
|
||||
from infection_monkey.config import WormConfiguration
|
||||
from infection_monkey.exploit.tools.helpers import \
|
||||
build_monkey_commandline_explicitly
|
||||
from infection_monkey.model import (GENERAL_CMDLINE_LINUX,
|
||||
MONKEY_CMDLINE_LINUX,
|
||||
MONKEY_CMDLINE_WINDOWS)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline_explicitly
|
||||
from infection_monkey.model import GENERAL_CMDLINE_LINUX, MONKEY_CMDLINE_LINUX, MONKEY_CMDLINE_WINDOWS
|
||||
from infection_monkey.system_info import OperatingSystem, SystemInfoCollector
|
||||
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ import requests
|
|||
from common.common_consts.network_consts import ES_SERVICE
|
||||
from common.utils.attack_utils import BITS_UPLOAD_STRING, ScanStatus
|
||||
from infection_monkey.exploit.web_rce import WebRCE
|
||||
from infection_monkey.model import (BITSADMIN_CMDLINE_HTTP, CHECK_COMMAND,
|
||||
CMD_PREFIX, DOWNLOAD_TIMEOUT, ID_STRING,
|
||||
from infection_monkey.model import (BITSADMIN_CMDLINE_HTTP, CHECK_COMMAND, CMD_PREFIX, DOWNLOAD_TIMEOUT, ID_STRING,
|
||||
WGET_HTTP_UPLOAD)
|
||||
from infection_monkey.network.elasticfinger import ES_PORT
|
||||
from infection_monkey.telemetry.attack.t1197_telem import T1197Telem
|
||||
|
|
|
@ -11,13 +11,10 @@ import string
|
|||
|
||||
import requests
|
||||
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth
|
||||
from infection_monkey.exploit.tools.http_tools import HTTPTools
|
||||
from infection_monkey.exploit.web_rce import WebRCE
|
||||
from infection_monkey.model import (HADOOP_LINUX_COMMAND,
|
||||
HADOOP_WINDOWS_COMMAND, ID_STRING,
|
||||
MONKEY_ARG)
|
||||
from infection_monkey.model import HADOOP_LINUX_COMMAND, HADOOP_WINDOWS_COMMAND, ID_STRING, MONKEY_ARG
|
||||
|
||||
__author__ = 'VakarisZ'
|
||||
|
||||
|
|
|
@ -5,13 +5,10 @@ from time import sleep
|
|||
|
||||
import pymssql
|
||||
|
||||
from common.utils.exceptions import (ExploitingVulnerableMachineError,
|
||||
FailedExploitationError)
|
||||
from common.utils.exceptions import ExploitingVulnerableMachineError, FailedExploitationError
|
||||
from common.utils.exploit_enum import ExploitType
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_monkey_dest_path)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_monkey_dest_path
|
||||
from infection_monkey.exploit.tools.http_tools import MonkeyHTTPServer
|
||||
from infection_monkey.exploit.tools.payload_parsing import LimitedSizePayload
|
||||
from infection_monkey.model import DROPPER_ARG
|
||||
|
|
|
@ -8,23 +8,18 @@ from io import BytesIO
|
|||
import impacket.smbconnection
|
||||
from impacket.nmb import NetBIOSError
|
||||
from impacket.nt_errors import STATUS_SUCCESS
|
||||
from impacket.smb import (FILE_DIRECTORY_FILE, FILE_NON_DIRECTORY_FILE,
|
||||
FILE_OPEN, FILE_READ_DATA, FILE_SHARE_READ,
|
||||
FILE_WRITE_DATA, SMB, SMB_DIALECT, SessionError,
|
||||
SMBCommand, SMBNtCreateAndX_Data,
|
||||
from impacket.smb import (FILE_DIRECTORY_FILE, FILE_NON_DIRECTORY_FILE, FILE_OPEN, FILE_READ_DATA, FILE_SHARE_READ,
|
||||
FILE_WRITE_DATA, SMB, SMB_DIALECT, SessionError, SMBCommand, SMBNtCreateAndX_Data,
|
||||
SMBNtCreateAndX_Parameters)
|
||||
from impacket.smb3structs import (SMB2_CREATE, SMB2_FLAGS_DFS_OPERATIONS,
|
||||
SMB2_IL_IMPERSONATION,
|
||||
SMB2_OPLOCK_LEVEL_NONE, SMB2Create,
|
||||
from impacket.smb3structs import (
|
||||
SMB2_CREATE, SMB2_FLAGS_DFS_OPERATIONS, SMB2_IL_IMPERSONATION, SMB2_OPLOCK_LEVEL_NONE, SMB2Create,
|
||||
SMB2Create_Response, SMB2Packet)
|
||||
from impacket.smbconnection import SMBConnection
|
||||
|
||||
import infection_monkey.monkeyfs as monkeyfs
|
||||
from common.utils.attack_utils import ScanStatus
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey_by_os)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey_by_os
|
||||
from infection_monkey.model import DROPPER_ARG
|
||||
from infection_monkey.network.smbfinger import SMB_SERVICE
|
||||
from infection_monkey.network.tools import get_interface_to_target
|
||||
|
|
|
@ -9,9 +9,7 @@ import requests
|
|||
from common.utils.attack_utils import ScanStatus
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.shellshock_resources import CGI_FILES
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.http_tools import HTTPTools
|
||||
from infection_monkey.model import DROPPER_ARG
|
||||
from infection_monkey.telemetry.attack.t1222_telem import T1222Telem
|
||||
|
|
|
@ -6,13 +6,9 @@ from impacket.smbconnection import SMB_DIALECT
|
|||
from common.utils.attack_utils import ScanStatus, UsageEnum
|
||||
from common.utils.exploit_enum import ExploitType
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.smb_tools import SmbTools
|
||||
from infection_monkey.model import (DROPPER_CMDLINE_DETACHED_WINDOWS,
|
||||
MONKEY_CMDLINE_DETACHED_WINDOWS,
|
||||
VictimHost)
|
||||
from infection_monkey.model import DROPPER_CMDLINE_DETACHED_WINDOWS, MONKEY_CMDLINE_DETACHED_WINDOWS, VictimHost
|
||||
from infection_monkey.network.smbfinger import SMBFinger
|
||||
from infection_monkey.network.tools import check_tcp_port
|
||||
from infection_monkey.telemetry.attack.t1035_telem import T1035Telem
|
||||
|
|
|
@ -9,12 +9,9 @@ from common.utils.attack_utils import ScanStatus
|
|||
from common.utils.exceptions import FailedExploitationError
|
||||
from common.utils.exploit_enum import ExploitType
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.model import MONKEY_ARG
|
||||
from infection_monkey.network.tools import (check_tcp_port,
|
||||
get_interface_to_target)
|
||||
from infection_monkey.network.tools import check_tcp_port, get_interface_to_target
|
||||
from infection_monkey.telemetry.attack.t1105_telem import T1105Telem
|
||||
from infection_monkey.telemetry.attack.t1222_telem import T1222Telem
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import unittest
|
||||
|
||||
from infection_monkey.exploit.tools.helpers import \
|
||||
build_monkey_commandline_explicitly
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline_explicitly
|
||||
|
||||
|
||||
class TestHelpers(unittest.TestCase):
|
||||
|
|
|
@ -10,12 +10,9 @@ from logging import getLogger
|
|||
|
||||
from common.utils.attack_utils import ScanStatus
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.http_tools import HTTPTools
|
||||
from infection_monkey.model import (
|
||||
CHMOD_MONKEY, DOWNLOAD_TIMEOUT, MONKEY_ARG, RUN_MONKEY, WGET_HTTP_UPLOAD)
|
||||
from infection_monkey.model import CHMOD_MONKEY, DOWNLOAD_TIMEOUT, MONKEY_ARG, RUN_MONKEY, WGET_HTTP_UPLOAD
|
||||
from infection_monkey.telemetry.attack.t1222_telem import T1222Telem
|
||||
|
||||
LOG = getLogger(__name__)
|
||||
|
|
|
@ -5,16 +5,11 @@ from posixpath import join
|
|||
|
||||
from common.utils.attack_utils import BITS_UPLOAD_STRING, ScanStatus
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.http_tools import HTTPTools
|
||||
from infection_monkey.model import (BITSADMIN_CMDLINE_HTTP, CHECK_COMMAND,
|
||||
CHMOD_MONKEY, DOWNLOAD_TIMEOUT,
|
||||
DROPPER_ARG, GET_ARCH_LINUX,
|
||||
GET_ARCH_WINDOWS, ID_STRING, MONKEY_ARG,
|
||||
POWERSHELL_HTTP_UPLOAD, RUN_MONKEY,
|
||||
WGET_HTTP_UPLOAD)
|
||||
from infection_monkey.model import (BITSADMIN_CMDLINE_HTTP, CHECK_COMMAND, CHMOD_MONKEY, DOWNLOAD_TIMEOUT, DROPPER_ARG,
|
||||
GET_ARCH_LINUX, GET_ARCH_WINDOWS, ID_STRING, MONKEY_ARG, POWERSHELL_HTTP_UPLOAD,
|
||||
RUN_MONKEY, WGET_HTTP_UPLOAD)
|
||||
from infection_monkey.network.tools import check_tcp_port, tcp_port_to_service
|
||||
from infection_monkey.telemetry.attack.t1197_telem import T1197Telem
|
||||
from infection_monkey.telemetry.attack.t1222_telem import T1222Telem
|
||||
|
|
|
@ -16,12 +16,9 @@ from impacket.dcerpc.v5 import transport
|
|||
|
||||
from common.utils.shellcode_obfuscator import clarify
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.smb_tools import SmbTools
|
||||
from infection_monkey.model import (DROPPER_CMDLINE_WINDOWS,
|
||||
MONKEY_CMDLINE_WINDOWS)
|
||||
from infection_monkey.model import DROPPER_CMDLINE_WINDOWS, MONKEY_CMDLINE_WINDOWS
|
||||
from infection_monkey.network.smbfinger import SMBFinger
|
||||
from infection_monkey.network.tools import check_tcp_port
|
||||
|
||||
|
|
|
@ -7,14 +7,10 @@ from impacket.dcerpc.v5.rpcrt import DCERPCException
|
|||
|
||||
from common.utils.exploit_enum import ExploitType
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import (build_monkey_commandline,
|
||||
get_monkey_depth,
|
||||
get_target_monkey)
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline, get_monkey_depth, get_target_monkey
|
||||
from infection_monkey.exploit.tools.smb_tools import SmbTools
|
||||
from infection_monkey.exploit.tools.wmi_tools import (AccessDeniedException,
|
||||
WmiTools)
|
||||
from infection_monkey.model import (DROPPER_CMDLINE_WINDOWS,
|
||||
MONKEY_CMDLINE_WINDOWS)
|
||||
from infection_monkey.exploit.tools.wmi_tools import AccessDeniedException, WmiTools
|
||||
from infection_monkey.model import DROPPER_CMDLINE_WINDOWS, MONKEY_CMDLINE_WINDOWS
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ from infection_monkey.config import EXTERNAL_CONFIG_FILE, WormConfiguration
|
|||
from infection_monkey.dropper import MonkeyDrops
|
||||
from infection_monkey.model import DROPPER_ARG, MONKEY_ARG
|
||||
from infection_monkey.monkey import InfectionMonkey
|
||||
from infection_monkey.utils.monkey_log_path import (get_dropper_log_path,
|
||||
get_monkey_log_path)
|
||||
from infection_monkey.utils.monkey_log_path import get_dropper_log_path, get_monkey_log_path
|
||||
|
||||
__author__ = 'itamar'
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ from threading import Thread
|
|||
import infection_monkey.tunnel as tunnel
|
||||
from common.network.network_utils import is_running_on_island
|
||||
from common.utils.attack_utils import ScanStatus, UsageEnum
|
||||
from common.utils.exceptions import (ExploitingVulnerableMachineError,
|
||||
FailedExploitationError)
|
||||
from common.utils.exceptions import ExploitingVulnerableMachineError, FailedExploitationError
|
||||
from common.version import get_version
|
||||
from infection_monkey.config import WormConfiguration
|
||||
from infection_monkey.control import ControlClient
|
||||
|
@ -32,11 +31,8 @@ from infection_monkey.telemetry.system_info_telem import SystemInfoTelem
|
|||
from infection_monkey.telemetry.trace_telem import TraceTelem
|
||||
from infection_monkey.telemetry.tunnel_telem import TunnelTelem
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
from infection_monkey.utils.exceptions.planned_shutdown_exception import \
|
||||
PlannedShutdownException
|
||||
from infection_monkey.utils.monkey_dir import (create_monkey_dir,
|
||||
get_monkey_dir_path,
|
||||
remove_monkey_dir)
|
||||
from infection_monkey.utils.exceptions.planned_shutdown_exception import PlannedShutdownException
|
||||
from infection_monkey.utils.monkey_dir import create_monkey_dir, get_monkey_dir_path, remove_monkey_dir
|
||||
from infection_monkey.utils.monkey_log_path import get_monkey_log_path
|
||||
from infection_monkey.windows_upgrader import WindowsUpgrader
|
||||
|
||||
|
@ -302,8 +298,7 @@ class InfectionMonkey(object):
|
|||
try:
|
||||
status = None
|
||||
if "win32" == sys.platform:
|
||||
from subprocess import (CREATE_NEW_CONSOLE,
|
||||
STARTF_USESHOWWINDOW, SW_HIDE)
|
||||
from subprocess import CREATE_NEW_CONSOLE, STARTF_USESHOWWINDOW, SW_HIDE
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags = CREATE_NEW_CONSOLE | STARTF_USESHOWWINDOW
|
||||
startupinfo.wShowWindow = SW_HIDE
|
||||
|
|
|
@ -3,8 +3,7 @@ import socket
|
|||
|
||||
import infection_monkey.config
|
||||
from infection_monkey.network.HostFinger import HostFinger
|
||||
from infection_monkey.network.tools import (struct_unpack_tracker,
|
||||
struct_unpack_tracker_string)
|
||||
from infection_monkey.network.tools import struct_unpack_tracker, struct_unpack_tracker_string
|
||||
|
||||
MYSQL_PORT = 3306
|
||||
SQL_SERVICE = 'mysqld-3306'
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_SETUID_SETGID
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.setuid_setgid.setuid_setgid import \
|
||||
get_commands_to_change_setuid_setgid
|
||||
from infection_monkey.post_breach.setuid_setgid.setuid_setgid import get_commands_to_change_setuid_setgid
|
||||
|
||||
|
||||
class ChangeSetuidSetgid(PBA):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import subprocess
|
||||
|
||||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_CLEAR_CMD_HISTORY
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_CLEAR_CMD_HISTORY
|
||||
from infection_monkey.post_breach.clear_command_history.clear_command_history import \
|
||||
get_commands_to_clear_command_history
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
|
|
|
@ -3,8 +3,7 @@ import random
|
|||
import string
|
||||
import subprocess
|
||||
|
||||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_COMMUNICATE_AS_NEW_USER
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_COMMUNICATE_AS_NEW_USER
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
||||
from infection_monkey.utils.auto_new_user_factory import create_auto_new_user
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_ACCOUNT_DISCOVERY
|
||||
from infection_monkey.post_breach.account_discovery.account_discovery import \
|
||||
get_commands_to_discover_accounts
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_ACCOUNT_DISCOVERY
|
||||
from infection_monkey.post_breach.account_discovery.account_discovery import get_commands_to_discover_accounts
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@ from common.common_consts.post_breach_consts import POST_BREACH_HIDDEN_FILES
|
|||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
from infection_monkey.utils.hidden_files import (cleanup_hidden_files,
|
||||
get_commands_to_hide_files,
|
||||
from infection_monkey.utils.hidden_files import (cleanup_hidden_files, get_commands_to_hide_files,
|
||||
get_commands_to_hide_folders)
|
||||
from infection_monkey.utils.windows.hidden_files import \
|
||||
get_winAPI_to_hide_files
|
||||
from infection_monkey.utils.windows.hidden_files import get_winAPI_to_hide_files
|
||||
|
||||
HIDDEN_FSO_CREATION_COMMANDS = [get_commands_to_hide_files,
|
||||
get_commands_to_hide_folders]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import subprocess
|
||||
|
||||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.shell_startup_files.shell_startup_files_modification import \
|
||||
get_commands_to_modify_shell_startup_files
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_JOB_SCHEDULING
|
||||
from infection_monkey.post_breach.job_scheduling.job_scheduling import (
|
||||
get_commands_to_schedule_jobs, remove_scheduled_jobs)
|
||||
from infection_monkey.post_breach.job_scheduling.job_scheduling import (get_commands_to_schedule_jobs,
|
||||
remove_scheduled_jobs)
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_TIMESTOMPING
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.timestomping.timestomping import \
|
||||
get_timestomping_commands
|
||||
from infection_monkey.post_breach.timestomping.timestomping import get_timestomping_commands
|
||||
|
||||
|
||||
class Timestomping(PBA):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import logging
|
||||
import subprocess
|
||||
|
||||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.signed_script_proxy.signed_script_proxy import (
|
||||
cleanup_changes, get_commands_to_proxy_execution_using_signed_script)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_TRAP_COMMAND
|
||||
from infection_monkey.post_breach.pba import PBA
|
||||
from infection_monkey.post_breach.trap_command.trap_command import \
|
||||
get_trap_commands
|
||||
from infection_monkey.post_breach.trap_command.trap_command import get_trap_commands
|
||||
|
||||
|
||||
class TrapCommand(PBA):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from infection_monkey.post_breach.clear_command_history.linux_clear_command_history import (
|
||||
get_linux_command_history_files,
|
||||
get_linux_commands_to_clear_command_history, get_linux_usernames)
|
||||
get_linux_command_history_files, get_linux_commands_to_clear_command_history, get_linux_usernames)
|
||||
|
||||
|
||||
def get_commands_to_clear_command_history():
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import subprocess
|
||||
|
||||
from infection_monkey.post_breach.job_scheduling.linux_job_scheduling import \
|
||||
get_linux_commands_to_schedule_jobs
|
||||
from infection_monkey.post_breach.job_scheduling.linux_job_scheduling import get_linux_commands_to_schedule_jobs
|
||||
from infection_monkey.post_breach.job_scheduling.windows_job_scheduling import (
|
||||
get_windows_commands_to_remove_scheduled_jobs,
|
||||
get_windows_commands_to_schedule_jobs)
|
||||
get_windows_commands_to_remove_scheduled_jobs, get_windows_commands_to_schedule_jobs)
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.post_breach.setuid_setgid.linux_setuid_setgid import \
|
||||
get_linux_commands_to_setuid_setgid
|
||||
from infection_monkey.post_breach.setuid_setgid.linux_setuid_setgid import get_linux_commands_to_setuid_setgid
|
||||
|
||||
|
||||
def get_commands_to_change_setuid_setgid():
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import subprocess
|
||||
|
||||
from infection_monkey.post_breach.signed_script_proxy.windows.signed_script_proxy import (
|
||||
get_windows_commands_to_delete_temp_comspec,
|
||||
get_windows_commands_to_proxy_execution_using_signed_script,
|
||||
get_windows_commands_to_delete_temp_comspec, get_windows_commands_to_proxy_execution_using_signed_script,
|
||||
get_windows_commands_to_reset_comspec)
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from infection_monkey.post_breach.timestomping.linux.timestomping import \
|
||||
get_linux_timestomping_commands
|
||||
from infection_monkey.post_breach.timestomping.windows.timestomping import \
|
||||
get_windows_timestomping_commands
|
||||
from infection_monkey.post_breach.timestomping.linux.timestomping import get_linux_timestomping_commands
|
||||
from infection_monkey.post_breach.timestomping.windows.timestomping import get_windows_timestomping_commands
|
||||
|
||||
|
||||
def get_timestomping_commands():
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.post_breach.trap_command.linux_trap_command import \
|
||||
get_linux_trap_commands
|
||||
from infection_monkey.post_breach.trap_command.linux_trap_command import get_linux_trap_commands
|
||||
|
||||
|
||||
def get_trap_commands():
|
||||
|
|
|
@ -4,13 +4,11 @@ from enum import IntEnum
|
|||
|
||||
import psutil
|
||||
|
||||
from common.common_consts.system_info_collectors_names import \
|
||||
AZURE_CRED_COLLECTOR
|
||||
from common.common_consts.system_info_collectors_names import AZURE_CRED_COLLECTOR
|
||||
from infection_monkey.network.info import get_host_subnets
|
||||
from infection_monkey.system_info.azure_cred_collector import AzureCollector
|
||||
from infection_monkey.system_info.netstat_collector import NetstatCollector
|
||||
from infection_monkey.system_info.system_info_collectors_handler import \
|
||||
SystemInfoCollectorsHandler
|
||||
from infection_monkey.system_info.system_info_collectors_handler import SystemInfoCollectorsHandler
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -4,10 +4,8 @@ from common.cloud.aws.aws_instance import AwsInstance
|
|||
from common.cloud.scoutsuite_consts import PROVIDERS
|
||||
from common.common_consts.system_info_collectors_names import AWS_COLLECTOR
|
||||
from common.network.network_utils import is_running_on_island
|
||||
from infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_collector import \
|
||||
scan_cloud_security
|
||||
from infection_monkey.system_info.system_info_collector import \
|
||||
SystemInfoCollector
|
||||
from infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_collector import scan_cloud_security
|
||||
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
from common.cloud.all_instances import get_all_cloud_instances
|
||||
from common.cloud.environment_names import Environment
|
||||
from common.common_consts.system_info_collectors_names import \
|
||||
ENVIRONMENT_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import \
|
||||
SystemInfoCollector
|
||||
from common.common_consts.system_info_collectors_names import ENVIRONMENT_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
|
||||
|
||||
|
||||
def get_monkey_environment() -> str:
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import logging
|
||||
import socket
|
||||
|
||||
from common.common_consts.system_info_collectors_names import \
|
||||
HOSTNAME_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import \
|
||||
SystemInfoCollector
|
||||
from common.common_consts.system_info_collectors_names import HOSTNAME_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@ import logging
|
|||
|
||||
import psutil
|
||||
|
||||
from common.common_consts.system_info_collectors_names import \
|
||||
PROCESS_LIST_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import \
|
||||
SystemInfoCollector
|
||||
from common.common_consts.system_info_collectors_names import PROCESS_LIST_COLLECTOR
|
||||
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import logging
|
||||
from typing import Sequence
|
||||
|
||||
from infection_monkey.system_info.system_info_collector import \
|
||||
SystemInfoCollector
|
||||
from infection_monkey.system_info.system_info_collector import SystemInfoCollector
|
||||
from infection_monkey.telemetry.system_info_telem import SystemInfoTelem
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import logging
|
||||
from typing import List
|
||||
|
||||
from infection_monkey.system_info.windows_cred_collector import \
|
||||
pypykatz_handler
|
||||
from infection_monkey.system_info.windows_cred_collector.windows_credentials import \
|
||||
WindowsCredentials
|
||||
from infection_monkey.system_info.windows_cred_collector import pypykatz_handler
|
||||
from infection_monkey.system_info.windows_cred_collector.windows_credentials import WindowsCredentials
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ from typing import Any, Dict, List, NewType
|
|||
|
||||
from pypykatz.pypykatz import pypykatz
|
||||
|
||||
from infection_monkey.system_info.windows_cred_collector.windows_credentials import \
|
||||
WindowsCredentials
|
||||
from infection_monkey.system_info.windows_cred_collector.windows_credentials import WindowsCredentials
|
||||
|
||||
CREDENTIAL_TYPES = ['msv_creds', 'wdigest_creds', 'ssp_creds', 'livessp_creds', 'dpapi_creds',
|
||||
'kerberos_creds', 'credman_creds', 'tspkg_creds']
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from infection_monkey.system_info.windows_cred_collector.pypykatz_handler import \
|
||||
_get_creds_from_pypykatz_session
|
||||
from infection_monkey.system_info.windows_cred_collector.pypykatz_handler import _get_creds_from_pypykatz_session
|
||||
|
||||
|
||||
class TestPypykatzHandler(TestCase):
|
||||
|
|
|
@ -2,10 +2,8 @@ import logging
|
|||
import os
|
||||
import sys
|
||||
|
||||
from common.common_consts.system_info_collectors_names import \
|
||||
MIMIKATZ_COLLECTOR
|
||||
from infection_monkey.system_info.windows_cred_collector.mimikatz_cred_collector import \
|
||||
MimikatzCredentialCollector
|
||||
from common.common_consts.system_info_collectors_names import MIMIKATZ_COLLECTOR
|
||||
from infection_monkey.system_info.windows_cred_collector.mimikatz_cred_collector import MimikatzCredentialCollector
|
||||
|
||||
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
|
||||
import infection_monkey.config # noqa: E402
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from common.cloud.scoutsuite.ScoutSuite.output.result_encoder import \
|
||||
ScoutJsonEncoder
|
||||
from common.cloud.scoutsuite.ScoutSuite.output.result_encoder import ScoutJsonEncoder
|
||||
from common.common_consts.telem_categories import TelemCategoryEnum
|
||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ import requests
|
|||
import infection_monkey.control
|
||||
import infection_monkey.monkeyfs as monkeyfs
|
||||
from infection_monkey.network.tools import get_interface_to_target
|
||||
from infection_monkey.transport.base import (TransportProxyBase,
|
||||
update_last_serve_time)
|
||||
from infection_monkey.transport.base import TransportProxyBase, update_last_serve_time
|
||||
|
||||
__author__ = 'hoffer'
|
||||
|
||||
|
@ -191,8 +190,7 @@ class HTTPServer(threading.Thread):
|
|||
def run(self):
|
||||
class TempHandler(FileServHTTPRequestHandler):
|
||||
from common.utils.attack_utils import ScanStatus
|
||||
from infection_monkey.telemetry.attack.t1105_telem import \
|
||||
T1105Telem
|
||||
from infection_monkey.telemetry.attack.t1105_telem import T1105Telem
|
||||
|
||||
filename = self._filename
|
||||
|
||||
|
@ -246,8 +244,7 @@ class LockedHTTPServer(threading.Thread):
|
|||
def run(self):
|
||||
class TempHandler(FileServHTTPRequestHandler):
|
||||
from common.utils.attack_utils import ScanStatus
|
||||
from infection_monkey.telemetry.attack.t1105_telem import \
|
||||
T1105Telem
|
||||
from infection_monkey.telemetry.attack.t1105_telem import T1105Telem
|
||||
filename = self._filename
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -3,8 +3,7 @@ import socket
|
|||
from logging import getLogger
|
||||
from threading import Thread
|
||||
|
||||
from infection_monkey.transport.base import (TransportProxyBase,
|
||||
update_last_serve_time)
|
||||
from infection_monkey.transport.base import TransportProxyBase, update_last_serve_time
|
||||
|
||||
READ_BUFFER_SIZE = 8192
|
||||
DEFAULT_TIMEOUT = 30
|
||||
|
|
|
@ -7,8 +7,7 @@ from threading import Thread
|
|||
from infection_monkey.model import VictimHost
|
||||
from infection_monkey.network.firewall import app as firewall
|
||||
from infection_monkey.network.info import get_free_tcp_port, local_ips
|
||||
from infection_monkey.network.tools import (check_tcp_port,
|
||||
get_interface_to_target)
|
||||
from infection_monkey.network.tools import check_tcp_port, get_interface_to_target
|
||||
from infection_monkey.transport.base import get_last_serve_time
|
||||
|
||||
__author__ = 'hoffer'
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import subprocess
|
||||
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
from infection_monkey.utils.linux.hidden_files import (
|
||||
get_linux_commands_to_delete, get_linux_commands_to_hide_files,
|
||||
from infection_monkey.utils.linux.hidden_files import (get_linux_commands_to_delete, get_linux_commands_to_hide_files,
|
||||
get_linux_commands_to_hide_folders)
|
||||
from infection_monkey.utils.windows.hidden_files import (
|
||||
get_windows_commands_to_delete, get_windows_commands_to_hide_files,
|
||||
from infection_monkey.utils.windows.hidden_files import (get_windows_commands_to_delete,
|
||||
get_windows_commands_to_hide_files,
|
||||
get_windows_commands_to_hide_folders)
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import \
|
||||
TestPlugin # noqa: F401
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin # noqa: F401
|
||||
|
||||
|
||||
class SomeDummyPlugin:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import \
|
||||
TestPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin
|
||||
|
||||
|
||||
class BadPluginInit(TestPlugin):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import \
|
||||
TestPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin
|
||||
|
||||
|
||||
class NoInheritance:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import \
|
||||
TestPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin
|
||||
|
||||
|
||||
class PluginWorking(TestPlugin):
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from infection_monkey.utils.plugins.pluginTests.BadImport import \
|
||||
SomeDummyPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.BadImport import SomeDummyPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.BadInit import BadPluginInit
|
||||
from infection_monkey.utils.plugins.pluginTests.ComboFile import (BadInit,
|
||||
ProperClass)
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import \
|
||||
TestPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginWorking import \
|
||||
PluginWorking
|
||||
from infection_monkey.utils.plugins.pluginTests.ComboFile import BadInit, ProperClass
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import TestPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginWorking import PluginWorking
|
||||
|
||||
|
||||
class PluginTester(TestCase):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from infection_monkey.utils.linux.users import get_linux_commands_to_add_user
|
||||
from infection_monkey.utils.windows.users import \
|
||||
get_windows_commands_to_add_user
|
||||
from infection_monkey.utils.windows.users import get_windows_commands_to_add_user
|
||||
|
||||
|
||||
def get_commands_to_add_user(username, password):
|
||||
|
|
|
@ -7,12 +7,9 @@ import time
|
|||
import infection_monkey.monkeyfs as monkeyfs
|
||||
from infection_monkey.config import WormConfiguration
|
||||
from infection_monkey.control import ControlClient
|
||||
from infection_monkey.exploit.tools.helpers import \
|
||||
build_monkey_commandline_explicitly
|
||||
from infection_monkey.exploit.tools.helpers import build_monkey_commandline_explicitly
|
||||
from infection_monkey.model import MONKEY_CMDLINE_WINDOWS
|
||||
from infection_monkey.utils.environment import (is_64bit_python,
|
||||
is_64bit_windows_os,
|
||||
is_windows_os)
|
||||
from infection_monkey.utils.environment import is_64bit_python, is_64bit_windows_os, is_windows_os
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -24,10 +24,8 @@ from monkey_island.cc.resources.local_run import LocalRun
|
|||
from monkey_island.cc.resources.log import Log
|
||||
from monkey_island.cc.resources.monkey import Monkey
|
||||
from monkey_island.cc.resources.monkey_configuration import MonkeyConfiguration
|
||||
from monkey_island.cc.resources.monkey_control.remote_port_check import \
|
||||
RemotePortCheck
|
||||
from monkey_island.cc.resources.monkey_control.started_on_island import \
|
||||
StartedOnIsland
|
||||
from monkey_island.cc.resources.monkey_control.remote_port_check import RemotePortCheck
|
||||
from monkey_island.cc.resources.monkey_control.started_on_island import StartedOnIsland
|
||||
from monkey_island.cc.resources.monkey_download import MonkeyDownload
|
||||
from monkey_island.cc.resources.netmap import NetMap
|
||||
from monkey_island.cc.resources.node import Node
|
||||
|
@ -37,20 +35,16 @@ from monkey_island.cc.resources.pba_file_upload import FileUpload
|
|||
from monkey_island.cc.resources.remote_run import RemoteRun
|
||||
from monkey_island.cc.resources.reporting.report import Report
|
||||
from monkey_island.cc.resources.root import Root
|
||||
from monkey_island.cc.resources.T1216_pba_file_download import \
|
||||
T1216PBAFileDownload
|
||||
from monkey_island.cc.resources.T1216_pba_file_download import T1216PBAFileDownload
|
||||
from monkey_island.cc.resources.telemetry import Telemetry
|
||||
from monkey_island.cc.resources.telemetry_feed import TelemetryFeed
|
||||
from monkey_island.cc.resources.test.clear_caches import ClearCaches
|
||||
from monkey_island.cc.resources.test.log_test import LogTest
|
||||
from monkey_island.cc.resources.test.monkey_test import MonkeyTest
|
||||
from monkey_island.cc.resources.version_update import VersionUpdate
|
||||
from monkey_island.cc.resources.zero_trust.finding_event import \
|
||||
ZeroTrustFindingEvent
|
||||
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.aws_keys import \
|
||||
AWSKeys
|
||||
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.scoutsuite_auth import \
|
||||
ScoutSuiteAuth
|
||||
from monkey_island.cc.resources.zero_trust.finding_event import ZeroTrustFindingEvent
|
||||
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.aws_keys import AWSKeys
|
||||
from monkey_island.cc.resources.zero_trust.scoutsuite_auth.scoutsuite_auth import ScoutSuiteAuth
|
||||
from monkey_island.cc.services.database import Database
|
||||
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
|
||||
from monkey_island.cc.services.representations import output_json
|
||||
|
|
|
@ -6,8 +6,7 @@ from datetime import timedelta
|
|||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
from common.utils.exceptions import (AlreadyRegisteredError,
|
||||
CredentialsNotRequiredError,
|
||||
from common.utils.exceptions import (AlreadyRegisteredError, CredentialsNotRequiredError,
|
||||
InvalidRegistrationCredentialsError)
|
||||
from monkey_island.cc.environment.environment_config import EnvironmentConfig
|
||||
from monkey_island.cc.environment.user_creds import UserCreds
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import logging
|
||||
|
||||
import monkey_island.cc.resources.auth.user_store as user_store
|
||||
from monkey_island.cc.environment import (EnvironmentConfig, aws, password,
|
||||
standard, testing)
|
||||
from monkey_island.cc.environment import EnvironmentConfig, aws, password, standard, testing
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -5,12 +5,9 @@ from unittest import TestCase
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import monkey_island.cc.testing.environment.server_config_mocks as config_mocks
|
||||
from common.utils.exceptions import (AlreadyRegisteredError,
|
||||
CredentialsNotRequiredError,
|
||||
InvalidRegistrationCredentialsError,
|
||||
RegistrationNotNeededError)
|
||||
from monkey_island.cc.environment import (Environment, EnvironmentConfig,
|
||||
UserCreds)
|
||||
from common.utils.exceptions import (AlreadyRegisteredError, CredentialsNotRequiredError,
|
||||
InvalidRegistrationCredentialsError, RegistrationNotNeededError)
|
||||
from monkey_island.cc.environment import Environment, EnvironmentConfig, UserCreds
|
||||
|
||||
|
||||
def get_server_config_file_path_test_version():
|
||||
|
|
|
@ -21,15 +21,12 @@ logger = logging.getLogger(__name__)
|
|||
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
|
||||
from common.version import get_version # noqa: E402
|
||||
from monkey_island.cc.app import init_app # noqa: E402
|
||||
from monkey_island.cc.bootloader_server import \
|
||||
BootloaderHttpServer # noqa: E402
|
||||
from monkey_island.cc.bootloader_server import BootloaderHttpServer # noqa: E402
|
||||
from monkey_island.cc.database import get_db_version # noqa: E402
|
||||
from monkey_island.cc.database import is_db_server_up # noqa: E402
|
||||
from monkey_island.cc.network_utils import local_ip_addresses # noqa: E402
|
||||
from monkey_island.cc.resources.monkey_download import \
|
||||
MonkeyDownload # noqa: E402
|
||||
from monkey_island.cc.services.reporting.exporter_init import \
|
||||
populate_exporter_list # noqa: E402
|
||||
from monkey_island.cc.resources.monkey_download import MonkeyDownload # noqa: E402
|
||||
from monkey_island.cc.services.reporting.exporter_init import populate_exporter_list # noqa: E402
|
||||
from monkey_island.cc.setup import setup # noqa: E402
|
||||
|
||||
MINIMUM_MONGO_DB_VERSION_REQUIRED = "4.2.0"
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from typing import Dict
|
||||
|
||||
from mongoengine import (Document, DoesNotExist, EmbeddedDocumentField,
|
||||
ListField, StringField)
|
||||
from mongoengine import Document, DoesNotExist, EmbeddedDocumentField, ListField, StringField
|
||||
from stix2 import AttackPattern, CourseOfAction
|
||||
|
||||
from monkey_island.cc.models.attack.mitigation import Mitigation
|
||||
from monkey_island.cc.services.attack.test_mitre_api_interface import \
|
||||
MitreApiInterface
|
||||
from monkey_island.cc.services.attack.test_mitre_api_interface import MitreApiInterface
|
||||
|
||||
|
||||
class AttackMitigations(Document):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from mongoengine import EmbeddedDocument, StringField
|
||||
from stix2 import CourseOfAction
|
||||
|
||||
from monkey_island.cc.services.attack.test_mitre_api_interface import \
|
||||
MitreApiInterface
|
||||
from monkey_island.cc.services.attack.test_mitre_api_interface import MitreApiInterface
|
||||
|
||||
|
||||
class Mitigation(EmbeddedDocument):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from mongoengine import (BooleanField, Document, DynamicField, ListField,
|
||||
ObjectIdField, StringField)
|
||||
from mongoengine import BooleanField, Document, DynamicField, ListField, ObjectIdField, StringField
|
||||
|
||||
|
||||
class Edge(Document):
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
Define a Document Schema for the Monkey document.
|
||||
"""
|
||||
import ring
|
||||
from mongoengine import (BooleanField, DateTimeField, Document, DoesNotExist,
|
||||
DynamicField, EmbeddedDocumentField, ListField,
|
||||
ReferenceField, StringField)
|
||||
from mongoengine import (BooleanField, DateTimeField, Document, DoesNotExist, DynamicField, EmbeddedDocumentField,
|
||||
ListField, ReferenceField, StringField)
|
||||
|
||||
from common.cloud import environment_names
|
||||
from monkey_island.cc.consts import \
|
||||
DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS
|
||||
from monkey_island.cc.models.command_control_channel import \
|
||||
CommandControlChannel
|
||||
from monkey_island.cc.models.monkey_ttl import (MonkeyTtl,
|
||||
create_monkey_ttl_document)
|
||||
from monkey_island.cc.consts import DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS
|
||||
from monkey_island.cc.models.command_control_channel import CommandControlChannel
|
||||
from monkey_island.cc.models.monkey_ttl import MonkeyTtl, create_monkey_ttl_document
|
||||
from monkey_island.cc.network_utils import local_ip_addresses
|
||||
|
||||
MAX_MONKEYS_AMOUNT_TO_CACHE = 100
|
||||
|
|
|
@ -9,10 +9,8 @@ from mongoengine import Document, GenericLazyReferenceField, StringField
|
|||
import common.common_consts.zero_trust_consts as zero_trust_consts
|
||||
# Dummy import for mongoengine.
|
||||
# noinspection PyUnresolvedReferences
|
||||
from monkey_island.cc.models.zero_trust.monkey_finding_details import \
|
||||
MonkeyFindingDetails
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import \
|
||||
ScoutSuiteFindingDetails
|
||||
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindingDetails
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails
|
||||
|
||||
|
||||
class Finding(Document):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from mongoengine import (DynamicField, EmbeddedDocument, IntField, ListField,
|
||||
StringField)
|
||||
from mongoengine import DynamicField, EmbeddedDocument, IntField, ListField, StringField
|
||||
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts import rule_consts
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ from packaging import version
|
|||
import common.common_consts.zero_trust_consts as zero_trust_consts
|
||||
from monkey_island.cc.models.zero_trust.event import Event
|
||||
from monkey_island.cc.models.zero_trust.finding import Finding
|
||||
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
|
||||
MonkeyFindingService
|
||||
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
|
||||
from monkey_island.cc.testing.IslandTestCase import IslandTestCase
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import common.common_consts.zero_trust_consts as zero_trust_consts
|
||||
from monkey_island.cc.models.zero_trust.event import Event
|
||||
from monkey_island.cc.models.zero_trust.segmentation_finding import \
|
||||
SegmentationFinding
|
||||
from monkey_island.cc.models.zero_trust.segmentation_finding import SegmentationFinding
|
||||
from monkey_island.cc.testing.IslandTestCase import IslandTestCase
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ import flask_restful
|
|||
from flask import make_response, request
|
||||
|
||||
import monkey_island.cc.environment.environment_singleton as env_singleton
|
||||
from common.utils.exceptions import (InvalidRegistrationCredentialsError,
|
||||
RegistrationNotNeededError)
|
||||
from common.utils.exceptions import InvalidRegistrationCredentialsError, RegistrationNotNeededError
|
||||
from monkey_island.cc.environment.user_creds import UserCreds
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import dateutil.parser
|
|||
import flask_restful
|
||||
from flask import request
|
||||
|
||||
from monkey_island.cc.consts import \
|
||||
DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS
|
||||
from monkey_island.cc.consts import DEFAULT_MONKEY_TTL_EXPIRY_DURATION_IN_SECONDS
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.models.monkey_ttl import create_monkey_ttl_document
|
||||
from monkey_island.cc.resources.test.utils.telem_store import TestTelemStore
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import flask_restful
|
||||
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.utils.node_states import \
|
||||
NodeStates as NodeStateList
|
||||
from monkey_island.cc.services.utils.node_states import NodeStates as NodeStateList
|
||||
|
||||
|
||||
class NodeStates(flask_restful.Resource):
|
||||
|
|
|
@ -8,9 +8,8 @@ from werkzeug.utils import secure_filename
|
|||
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.post_breach_files import (
|
||||
PBA_LINUX_FILENAME_PATH, PBA_UPLOAD_PATH, PBA_WINDOWS_FILENAME_PATH,
|
||||
UPLOADS_DIR)
|
||||
from monkey_island.cc.services.post_breach_files import (PBA_LINUX_FILENAME_PATH, PBA_UPLOAD_PATH,
|
||||
PBA_WINDOWS_FILENAME_PATH, UPLOADS_DIR)
|
||||
|
||||
__author__ = 'VakarisZ'
|
||||
|
||||
|
|
|
@ -3,13 +3,11 @@ import http.client
|
|||
import flask_restful
|
||||
from flask import Response, jsonify
|
||||
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import \
|
||||
ScoutSuiteDataJson
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_data_json import ScoutSuiteDataJson
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.reporting.report import ReportService
|
||||
from monkey_island.cc.services.zero_trust.finding_service import FindingService
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_service import \
|
||||
ZeroTrustService
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_service import ZeroTrustService
|
||||
|
||||
ZERO_TRUST_REPORT_TYPE = "zero_trust"
|
||||
SECURITY_REPORT_TYPE = "security"
|
||||
|
|
|
@ -12,8 +12,7 @@ from monkey_island.cc.models.monkey import Monkey
|
|||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.resources.test.utils.telem_store import TestTelemStore
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.services.telemetry.processing.processing import \
|
||||
process_telemetry
|
||||
from monkey_island.cc.services.telemetry.processing.processing import process_telemetry
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ import json
|
|||
import flask_restful
|
||||
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.zero_trust.monkey_finding_service import \
|
||||
MonkeyFindingService
|
||||
from monkey_island.cc.services.zero_trust.monkey_finding_service import MonkeyFindingService
|
||||
|
||||
|
||||
class ZeroTrustFindingEvent(flask_restful.Resource):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import flask_restful
|
||||
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import \
|
||||
get_aws_keys
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import get_aws_keys
|
||||
|
||||
|
||||
class AWSKeys(flask_restful.Resource):
|
||||
|
|
|
@ -6,8 +6,8 @@ from flask import request
|
|||
from common.cloud.scoutsuite_consts import PROVIDERS
|
||||
from common.utils.exceptions import InvalidAWSKeys
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import (
|
||||
is_cloud_authentication_setup, set_aws_keys)
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import (is_cloud_authentication_setup,
|
||||
set_aws_keys)
|
||||
|
||||
|
||||
class ScoutSuiteAuth(flask_restful.Resource):
|
||||
|
|
|
@ -3,26 +3,12 @@ import logging
|
|||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.models import Monkey
|
||||
from monkey_island.cc.services.attack.attack_config import AttackConfig
|
||||
from monkey_island.cc.services.attack.technique_reports import (T1003, T1005,
|
||||
T1016, T1018,
|
||||
T1021, T1035,
|
||||
T1041, T1053,
|
||||
T1059, T1064,
|
||||
T1065, T1075,
|
||||
T1082, T1086,
|
||||
T1087, T1090,
|
||||
T1099, T1105,
|
||||
T1106, T1107,
|
||||
T1110, T1129,
|
||||
T1136, T1145,
|
||||
T1146, T1154,
|
||||
T1156, T1158,
|
||||
T1166, T1168,
|
||||
T1188, T1197,
|
||||
T1210, T1216,
|
||||
T1222, T1504)
|
||||
from monkey_island.cc.services.reporting.report_generation_synchronisation import \
|
||||
safe_generate_attack_report
|
||||
from monkey_island.cc.services.attack.technique_reports import (T1003, T1005, T1016, T1018, T1021, T1035, T1041, T1053,
|
||||
T1059, T1064, T1065, T1075, T1082, T1086, T1087, T1090,
|
||||
T1099, T1105, T1106, T1107, T1110, T1129, T1136, T1145,
|
||||
T1146, T1154, T1156, T1158, T1166, T1168, T1188, T1197,
|
||||
T1210, T1216, T1222, T1504)
|
||||
from monkey_island.cc.services.reporting.report_generation_synchronisation import safe_generate_attack_report
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from common.utils.attack_utils import ScanStatus
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.attack.technique_reports import AttackTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.technique_report_tools import \
|
||||
parse_creds
|
||||
from monkey_island.cc.services.attack.technique_reports.technique_report_tools import parse_creds
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from monkey_island.cc.services.attack.technique_reports.usage_technique import \
|
||||
UsageTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.usage_technique import UsageTechnique
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_JOB_SCHEDULING
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.attack.technique_reports.usage_technique import \
|
||||
UsageTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.usage_technique import UsageTechnique
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ from monkey_island.cc.services.config import ConfigService
|
|||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
from monkey_island.cc.services.config_schema.config_value_paths import \
|
||||
CURRENT_SERVER_PATH
|
||||
from monkey_island.cc.services.config_schema.config_value_paths import CURRENT_SERVER_PATH
|
||||
|
||||
|
||||
class T1065(AttackTechnique):
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_ACCOUNT_DISCOVERY
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_ACCOUNT_DISCOVERY
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_TIMESTOMPING
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from monkey_island.cc.services.attack.technique_reports.usage_technique import \
|
||||
UsageTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.usage_technique import UsageTechnique
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from common.utils.attack_utils import ScanStatus
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.attack.technique_reports import AttackTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.technique_report_tools import \
|
||||
parse_creds
|
||||
from monkey_island.cc.services.attack.technique_reports.technique_report_tools import parse_creds
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from monkey_island.cc.services.attack.technique_reports.usage_technique import \
|
||||
UsageTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.usage_technique import UsageTechnique
|
||||
|
||||
__author__ = "VakarisZ"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import (
|
||||
POST_BREACH_BACKDOOR_USER, POST_BREACH_COMMUNICATE_AS_NEW_USER)
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_BACKDOOR_USER, POST_BREACH_COMMUNICATE_AS_NEW_USER
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_CLEAR_CMD_HISTORY
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_CLEAR_CMD_HISTORY
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_TRAP_COMMAND
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_HIDDEN_FILES
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_SETUID_SETGID
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import POST_BREACH_JOB_SCHEDULING
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_SIGNED_SCRIPT_PROXY_EXEC
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from common.common_consts.post_breach_consts import \
|
||||
POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||
PostBreachTechnique
|
||||
from common.common_consts.post_breach_consts import POST_BREACH_SHELL_STARTUP_FILE_MODIFICATION
|
||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import PostBreachTechnique
|
||||
|
||||
__author__ = "shreyamalviya"
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ import abc
|
|||
|
||||
from common.utils.attack_utils import UsageEnum
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.attack.technique_reports import (
|
||||
AttackTechnique, logger)
|
||||
from monkey_island.cc.services.attack.technique_reports import AttackTechnique, logger
|
||||
|
||||
|
||||
class UsageTechnique(AttackTechnique, metaclass=abc.ABCMeta):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue