forked from p34709852/monkey
Refactored ScoutSuite into a separate package rather than submodule
This commit is contained in:
parent
2a44cf8ebd
commit
fd058c7ff0
|
@ -4,6 +4,3 @@
|
|||
[submodule "docs/themes/learn"]
|
||||
path = docs/themes/learn
|
||||
url = https://github.com/guardicode/hugo-theme-learn.git
|
||||
[submodule "monkey/infection_monkey/system_info/collectors/scoutsuite"]
|
||||
path = monkey/common/cloud/scoutsuite
|
||||
url = https://github.com/guardicode/ScoutSuite.git
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 9de1e78ba475f925c66c5b645564ec9eb08e2309
|
|
@ -1,15 +1,17 @@
|
|||
# -*- mode: python -*-
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
import sys
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
from PyInstaller.utils.hooks import collect_data_files
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
def main():
|
||||
print(collect_data_files('policyuniverse'))
|
||||
a = Analysis(['main.py'],
|
||||
pathex=['..'],
|
||||
hiddenimports=get_hidden_imports(),
|
||||
|
@ -79,7 +81,12 @@ def get_linux_only_binaries():
|
|||
|
||||
|
||||
def get_hidden_imports():
|
||||
return ['_cffi_backend', 'queue', '_mssql'] if is_windows() else ['_cffi_backend','_mssql']
|
||||
imports = ['ScoutSuite']
|
||||
if is_windows():
|
||||
imports.extend(['_cffi_backend', 'queue', '_mssql'])
|
||||
else:
|
||||
imports.extend(['_cffi_backend', '_mssql'])
|
||||
return imports
|
||||
|
||||
|
||||
def get_sc_binaries():
|
||||
|
|
|
@ -16,3 +16,4 @@ pypykatz==0.3.12
|
|||
pysmb==1.2.5
|
||||
requests>=2.24
|
||||
wmi==1.5.1 ; sys_platform == 'win32'
|
||||
git+https://github.com/guardicode/ScoutSuite
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import pkgutil
|
||||
import sys
|
||||
from pathlib import PurePath
|
||||
|
||||
_scoutsuite_api_package = pkgutil.get_loader('common.cloud.scoutsuite.ScoutSuite.__main__')
|
||||
|
||||
|
||||
def _add_scoutsuite_to_python_path():
|
||||
scoutsuite_path = PurePath(_scoutsuite_api_package.path).parent.parent.__str__()
|
||||
sys.path.append(scoutsuite_path)
|
||||
|
||||
|
||||
# Add ScoutSuite to python path because this way
|
||||
# we don't need to change any imports in ScoutSuite code
|
||||
_add_scoutsuite_to_python_path()
|
|
@ -1,5 +0,0 @@
|
|||
import common.cloud.scoutsuite.ScoutSuite.api_run as scoutsuite_api
|
||||
|
||||
|
||||
def run(*args, **kwargs):
|
||||
return scoutsuite_api.run(*args, **kwargs)
|
|
@ -1,8 +1,9 @@
|
|||
import logging
|
||||
from typing import Union
|
||||
|
||||
import infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_api as scoutsuite_api
|
||||
from common.cloud.scoutsuite.ScoutSuite.providers.base.provider import BaseProvider
|
||||
import ScoutSuite.api_run
|
||||
from ScoutSuite.providers.base.provider import BaseProvider
|
||||
|
||||
from common.cloud.scoutsuite_consts import CloudProviders
|
||||
from common.utils.exceptions import ScoutSuiteScanError
|
||||
from infection_monkey.config import WormConfiguration
|
||||
|
@ -22,7 +23,7 @@ def scan_cloud_security(cloud_type: CloudProviders):
|
|||
|
||||
|
||||
def run_scoutsuite(cloud_type: str) -> Union[BaseProvider, dict]:
|
||||
return scoutsuite_api.run(provider=cloud_type,
|
||||
return ScoutSuite.api_run.run(provider=cloud_type,
|
||||
aws_access_key_id=WormConfiguration.aws_access_key_id,
|
||||
aws_secret_access_key=WormConfiguration.aws_secret_access_key,
|
||||
aws_session_token=WormConfiguration.aws_session_token)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from common.cloud.scoutsuite.ScoutSuite.output.result_encoder import ScoutJsonEncoder
|
||||
from common.cloud.scoutsuite.ScoutSuite.providers.base.provider import BaseProvider
|
||||
from ScoutSuite.output.result_encoder import ScoutJsonEncoder
|
||||
from ScoutSuite.providers.base.provider import BaseProvider
|
||||
from common.common_consts.telem_categories import TelemCategoryEnum
|
||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import pkgutil
|
||||
import sys
|
||||
from pathlib import PurePath
|
||||
|
||||
_scoutsuite_api_package = pkgutil.get_loader('common.cloud.scoutsuite.ScoutSuite.__main__')
|
||||
|
||||
|
||||
def _add_scoutsuite_to_python_path():
|
||||
scoutsuite_path = PurePath(_scoutsuite_api_package.path).parent.parent.__str__()
|
||||
sys.path.append(scoutsuite_path)
|
||||
|
||||
|
||||
_add_scoutsuite_to_python_path()
|
|
@ -14,7 +14,7 @@ def is_cloud_authentication_setup(provider: CloudProviders) -> Tuple[bool, str]:
|
|||
if is_aws_keys_setup():
|
||||
return True, "AWS keys already setup."
|
||||
|
||||
import common.cloud.scoutsuite.ScoutSuite.providers.aws.authentication_strategy as auth_strategy
|
||||
import ScoutSuite.providers.aws.authentication_strategy as auth_strategy
|
||||
try:
|
||||
profile = auth_strategy.AWSAuthenticationStrategy().authenticate()
|
||||
return True, f" Profile \"{profile.session.profile_name}\" is already setup. "
|
||||
|
|
|
@ -26,5 +26,6 @@ tqdm>=4.47
|
|||
virtualenv>=20.0.26
|
||||
werkzeug>=1.0.1
|
||||
wheel>=0.34.2
|
||||
git+https://github.com/guardicode/ScoutSuite
|
||||
|
||||
pyjwt>=1.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||
|
|
Loading…
Reference in New Issue