mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
feat(organizations): Extract Metadata from Management Account ID (-O) (#1248)
* feat(organizations): add organizations funtion to provider * feat(organizations): add organizations -O option * fix(comments): Resolve comments. * feat(test): add test * fix(pipfile): update pipfile Co-authored-by: sergargar <sergio@verica.io>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from dataclasses import asdict, dataclass
|
||||
|
||||
from config.config import timestamp
|
||||
from lib.check.models import Check_Report, Organizations_Info
|
||||
from lib.check.models import Check_Report
|
||||
from providers.aws.models import AWS_Organizations_Info
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -65,7 +66,7 @@ class Check_Output_CSV:
|
||||
account: str,
|
||||
profile: str,
|
||||
report: Check_Report,
|
||||
organizations: Organizations_Info,
|
||||
organizations: AWS_Organizations_Info,
|
||||
):
|
||||
self.assessment_start_time = timestamp.isoformat()
|
||||
self.finding_unique_id = ""
|
||||
@@ -181,9 +182,3 @@ class Check_Output_CSV:
|
||||
groups = ""
|
||||
|
||||
return unrolled_compliance
|
||||
|
||||
def get_csv_header(self):
|
||||
csv_header = []
|
||||
for key in asdict(self):
|
||||
csv_header = csv_header.append(key)
|
||||
return csv_header
|
||||
|
||||
@@ -3,12 +3,11 @@ from csv import DictWriter
|
||||
from colorama import Fore, Style
|
||||
|
||||
from config.config import csv_file_suffix
|
||||
from lib.check.models import Organizations_Info
|
||||
from lib.outputs.models import Check_Output_CSV
|
||||
from lib.utils.utils import file_exists, open_file
|
||||
|
||||
|
||||
def report(check_findings, output_options, audit_info, organizations_info):
|
||||
def report(check_findings, output_options, audit_info):
|
||||
check_findings.sort(key=lambda x: x.region)
|
||||
|
||||
csv_fields = []
|
||||
@@ -45,9 +44,8 @@ def report(check_findings, output_options, audit_info, organizations_info):
|
||||
audit_info.audited_account,
|
||||
audit_info.profile,
|
||||
finding,
|
||||
organizations_info,
|
||||
audit_info.organizations_metadata,
|
||||
)
|
||||
|
||||
csv_writer = DictWriter(
|
||||
file_descriptors["csv"], fieldnames=csv_fields, delimiter=";"
|
||||
)
|
||||
@@ -106,14 +104,3 @@ def generate_csv_fields():
|
||||
for field in Check_Output_CSV.__dict__["__annotations__"].keys():
|
||||
csv_fields.append(field)
|
||||
return csv_fields
|
||||
|
||||
|
||||
def get_orgs_info():
|
||||
organizations_info = Organizations_Info(
|
||||
account_details_email="",
|
||||
account_details_name="",
|
||||
account_details_arn="",
|
||||
account_details_org="",
|
||||
account_details_tags="",
|
||||
)
|
||||
return organizations_info
|
||||
|
||||
Reference in New Issue
Block a user