forked from p15670423/monkey
Minor scoutsuite code refactorings
This commit is contained in:
parent
22194c566a
commit
de69d167ba
|
@ -8,7 +8,7 @@ class ScoutSuiteTelem(BaseTelem):
|
|||
def __init__(self, data):
|
||||
"""
|
||||
Default ScoutSuite telemetry constructor
|
||||
:param data: Data gathered via ScoutSuite (
|
||||
:param data: Data gathered via ScoutSuite
|
||||
"""
|
||||
super().__init__()
|
||||
self.data = data
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
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()
|
|
@ -1,24 +1,13 @@
|
|||
import pkgutil
|
||||
import sys
|
||||
from pathlib import PurePath
|
||||
from typing import Tuple
|
||||
|
||||
from ScoutSuite.providers.base.authentication_strategy import AuthenticationException
|
||||
|
||||
from common.cloud.scoutsuite_consts import CloudProviders
|
||||
from common.utils.exceptions import InvalidAWSKeys
|
||||
from monkey_island.cc.server_utils.encryptor import encryptor
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.config_schema.config_value_paths import AWS_KEYS_PATH
|
||||
|
||||
_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()
|
||||
|
||||
|
||||
def is_cloud_authentication_setup(provider: CloudProviders) -> Tuple[bool, str]:
|
||||
if provider == CloudProviders.AWS.value:
|
||||
|
@ -30,7 +19,7 @@ def is_cloud_authentication_setup(provider: CloudProviders) -> Tuple[bool, str]:
|
|||
profile = auth_strategy.AWSAuthenticationStrategy().authenticate()
|
||||
return True, f" Profile \"{profile.session.profile_name}\" is already setup. " \
|
||||
f"Run Monkey on Island to start the scan."
|
||||
except Exception:
|
||||
except AuthenticationException:
|
||||
return False, ""
|
||||
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ const getContents = (props) => {
|
|||
.then(res => {
|
||||
if (res['error_msg'] === '') {
|
||||
setSuccessMessage('AWS keys saved!');
|
||||
} else if (res['message'] === 'Internal Server Error') {
|
||||
setErrorMessage('Something went wrong, double check keys and contact support if problem persists.');
|
||||
} else {
|
||||
setErrorMessage(res['error_msg']);
|
||||
}
|
||||
|
@ -79,11 +81,12 @@ const getContents = (props) => {
|
|||
<div className={'key-creation-tutorial'}>
|
||||
<h5>Tips</h5>
|
||||
<p>Consider creating a new user account just for this activity. Assign only <b>ReadOnlyAccess</b> and
|
||||
<b>SecurityAudit</b> policies.</p>
|
||||
<b>SecurityAudit</b> policies.</p>
|
||||
|
||||
<h5>Keys for custom user</h5>
|
||||
<p>1. Open the IAM console at <a href={'https://console.aws.amazon.com/iam/'}
|
||||
target={'_blank'} rel="noopener noreferrer">https://console.aws.amazon.com/iam/</a>.</p>
|
||||
target={'_blank'}
|
||||
rel="noopener noreferrer">https://console.aws.amazon.com/iam/</a>.</p>
|
||||
<p>2. In the navigation pane, choose Users.</p>
|
||||
<p>3. Choose the name of the user whose access keys you want to create, and then choose the Security credentials
|
||||
tab.</p>
|
||||
|
@ -157,7 +160,7 @@ const getContents = (props) => {
|
|||
{
|
||||
successMessage ?
|
||||
<div className="alert alert-success" role="alert">{successMessage}
|
||||
Go back and
|
||||
Go back and
|
||||
<Button variant={'link'} onClick={() => props.setComponent()} className={'link-in-success-message'}>
|
||||
run Monkey from the Island server </Button> to start AWS scan!</div>
|
||||
:
|
||||
|
|
|
@ -29,5 +29,5 @@ const ImageModal = (props) => {
|
|||
export default ImageModal;
|
||||
|
||||
ImageModal.propTypes = {
|
||||
image: PropTypes.element
|
||||
image: PropTypes.string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue