Skip to content

Commit

Permalink
Merge pull request #250 from nccgroup/cleanup/more-cleanup-post-opinel
Browse files Browse the repository at this point in the history
Moved contents of aws.py to utils.py and removed profiles.py
  • Loading branch information
vifor2 committed Mar 14, 2019
2 parents ad96713 + 417c9be commit 27e432d
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 331 deletions.
30 changes: 4 additions & 26 deletions ScoutSuite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
# -*- coding: utf-8 -*-

import copy
import json
import os
import webbrowser

from ScoutSuite.core.console import config_debug_level, print_info, print_debug
from ScoutSuite.providers.aws.profiles import AWSProfiles

from ScoutSuite.core.cli_parser import ScoutSuiteArgumentParser
from ScoutSuite import AWSCONFIG
from ScoutSuite.output.html import Scout2Report
from ScoutSuite.core.cli_parser import ScoutSuiteArgumentParser
from ScoutSuite.core.console import config_debug_level, print_info, print_debug
from ScoutSuite.core.exceptions import RuleExceptions
from ScoutSuite.core.ruleset import Ruleset
from ScoutSuite.core.processingengine import ProcessingEngine
from ScoutSuite.core.ruleset import Ruleset
from ScoutSuite.output.html import Scout2Report
from ScoutSuite.providers import get_provider


Expand Down Expand Up @@ -128,25 +125,6 @@ def main(args=None):
# Finalize
cloud_provider.postprocessing(report.current_time, finding_rules)

# TODO: this is AWS-specific - move to postprocessing?
# This is partially implemented
# Get organization data if it exists
try:
profile = AWSProfiles.get(args.get('profile'))[0]
if 'source_profile' in profile.attributes:
organization_info_file = os.path.join(os.path.expanduser('~/.aws/recipes/%s/organization.json' %
profile.attributes['source_profile']))
if os.path.isfile(organization_info_file):
with open(organization_info_file, 'rt') as f:
org = {}
accounts = json.load(f)
for account in accounts:
account_id = account.pop('Id')
org[account_id] = account
setattr(cloud_provider, 'organization', org)
except Exception as e:
pass

# Save config and create HTML report
html_report_path = report.save(cloud_provider, exceptions, args.get('force_write'), args.get('debug'))

Expand Down
145 changes: 0 additions & 145 deletions ScoutSuite/providers/aws/aws.py

This file was deleted.

2 changes: 1 addition & 1 deletion ScoutSuite/providers/aws/configs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
from queue import Queue

from ScoutSuite.providers.aws.aws import handle_truncated_response
from ScoutSuite.providers.aws.utils import handle_truncated_response
from ScoutSuite.providers.base.configs.base import BaseConfig


Expand Down
5 changes: 2 additions & 3 deletions ScoutSuite/providers/aws/configs/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
except ImportError:
from queue import Queue

from ScoutSuite.providers.aws.aws import build_region_list, connect_service, get_aws_account_id, get_name, \
handle_truncated_response
from ScoutSuite.core.console import print_exception, print_info

from ScoutSuite.providers.base.configs import resource_id_map
from ScoutSuite.providers.base.configs.threads import thread_configs
from ScoutSuite.providers.aws.configs.vpc import VPCConfig
from ScoutSuite.utils import format_service_name, manage_dictionary
from ScoutSuite.providers.aws.utils import is_throttled
from ScoutSuite.providers.aws.utils import is_throttled, build_region_list, connect_service, get_name, \
get_aws_account_id, handle_truncated_response
from ScoutSuite.providers.aws.configs.base import BaseConfig
from ScoutSuite.output.console import FetchStatusLogger

Expand Down
126 changes: 0 additions & 126 deletions ScoutSuite/providers/aws/profiles.py

This file was deleted.

3 changes: 1 addition & 2 deletions ScoutSuite/providers/aws/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import boto3

from ScoutSuite.core.console import print_debug, print_error, print_exception, print_info
from ScoutSuite.providers.aws.aws import get_aws_account_id
from ScoutSuite.providers.aws.configs.services import AWSServicesConfig
from ScoutSuite.providers.aws.services.vpc import put_cidr_name
from ScoutSuite.providers.base.configs.browser import combine_paths, get_object_at, get_value_at
from ScoutSuite.providers.base.provider import BaseProvider
from ScoutSuite.utils import manage_dictionary
from ScoutSuite.providers.aws.utils import ec2_classic
from ScoutSuite.providers.aws.utils import ec2_classic, get_aws_account_id


class AWSProvider(BaseProvider):
Expand Down
3 changes: 1 addition & 2 deletions ScoutSuite/providers/aws/services/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import netaddr

from ScoutSuite.core.console import print_exception, print_info
from ScoutSuite.providers.aws.aws import get_name
from ScoutSuite.providers.aws.configs.regions import RegionalServiceConfig, RegionConfig, api_clients
from ScoutSuite.providers.aws.configs.vpc import VPCConfig
from ScoutSuite.providers.base.configs.browser import get_attribute_at
from ScoutSuite.utils import manage_dictionary
from ScoutSuite.providers.aws.utils import ec2_classic, get_keys
from ScoutSuite.providers.aws.utils import ec2_classic, get_keys, get_name
from ScoutSuite.core.fs import load_data

########################################
Expand Down
2 changes: 1 addition & 1 deletion ScoutSuite/providers/aws/services/efs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
EFS-related classes and functions
"""
from ScoutSuite.providers.aws.aws import handle_truncated_response
from ScoutSuite.providers.aws.utils import handle_truncated_response

from ScoutSuite.providers.aws.configs.regions import RegionalServiceConfig, RegionConfig, api_clients

Expand Down
Loading

0 comments on commit 27e432d

Please sign in to comment.