<filename>main.py
import tenable
import security_center
import report_generation
import logging
from typing import List, Tuple
import concurrent.futures

logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
logger = logging.getLogger(__name__)


# Use the environment to get the vulnerabilities
def fetch(env: str) -> Tuple[List, str]:
    vulnerabilities = {
        'prod': security_center.fetch_vulnerabilities,
        'gcp': tenable.fetch_gcp_vulnerabilities,
        'corp': tenable.fetch_workstation_vulnerabilities
    }
    result = vulnerabilities[env]()
    return result, env


def main():
    tenable_environment = ['gcp', 'corp']

    with concurrent.futures.ProcessPoolExecutor(max_workers=2) as executor:
        fs = [executor.submit(fetch, env) for env in tenable_environment]
        for future in concurrent.futures.as_completed(fs):
            if future.result():
                result, env = future.result()
                if env == 'prod' and result:
                    report_generation.generate_prod_reports(result)
                elif env == 'gcp' and result:
                    report_generation.generate_prod_reports(result, gcp=True)
                elif env == 'corp' and result:
                    report_generation.generate_corp_reports(result)

    nessus_vulns, env = fetch('prod')
    report_generation.generate_prod_reports(nessus_vulns)


if __name__ == '__main__':
    main()

<filename>main.py
import tenable
import security_center
import report_generation
import logging
from typing import List, Tuple
import concurrent.futures

logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
logger = logging.getLogger(__name__)


# Use the environment to get the vulnerabilities
def fetch(env: str) -> Tuple[List, str]:
    vulnerabilities = {
        'prod': security_center.fetch_vulnerabilities,
        'gcp': tenable.fetch_gcp_vulnerabilities,
        'corp': tenable.fetch_workstation_vulnerabilities
    }
    result = vulnerabilities[env]()
    return result, env


def main():
    tenable_environment = ['gcp', 'corp']

    with concurrent.futures.ProcessPoolExecutor(max_workers=2) as executor:
        fs = [executor.submit(fetch, env) for env in tenable_environment]
        for future in concurrent.futures.as_completed(fs):
            if future.result():
                result, env = future.result()
                if env == 'prod' and result:
                    report_generation.generate_prod_reports(result)
                elif env == 'gcp' and result:
                    report_generation.generate_prod_reports(result, gcp=True)
                elif env == 'corp' and result:
                    report_generation.generate_corp_reports(result)

    nessus_vulns, env = fetch('prod')
    report_generation.generate_prod_reports(nessus_vulns)


if __name__ == '__main__':
    main()

# Use the environment to get the vulnerabilities