Commit 0d9c6124 authored by Ondřej Borýsek's avatar Ondřej Borýsek
Browse files

Refactor several big ifs

parent aedfa07c
Loading
Loading
Loading
Loading
+124 −116
Original line number Diff line number Diff line
@@ -469,7 +469,9 @@ def combine_plugin_output_and_description(s2r: Scan2ReportData):
    hostnames = s2r.hostnames

    for fid in sorted(findings.keys(), key=lambda x: (-(findings[x]['severity']), locale.strxfrm(findings[x]['name'].lower()))):
        if findings[fid]['plugin_output']:
        if not findings[fid]['plugin_output']:
            continue

        description_text = PROOF_SEPARATOR
        for key in findings[fid]['plugin_output'].keys():
            description_text += '\n'
@@ -488,7 +490,9 @@ def create_missing_templates(s2r: Scan2ReportData):
    lang = s2r.config.lang

    missing_as_list = []
    if len(missingPlugins) > 0:
    if len(missingPlugins) == 0:
        return missing_as_list

    unique = []
    for item in missingPlugins:
        if item not in unique:
@@ -1754,8 +1758,10 @@ def resolve_http_redirects(debug: bool, s2r: Scan2ReportData):
    findings = s2r.findings
    resolveRedirects = s2r.config.resolveRedirects

    if not findings or not resolveRedirects:
        return

    # resolve redirects via http://www.nessus.org/u?e2452f2e
    if findings and resolveRedirects:
    print(f"Resolving links' redirects")
    with tqdm(total=len(findings)) as pbar:
        for fid in findings.keys():
@@ -1801,7 +1807,9 @@ def output_csv(debug: bool, s2r: Scan2ReportData):
    #    df = pandas.DataFrame(data=findingsSummary).T
    #    df.to_csv(outfile, index=False)
    # print findings
    if findings:
    if not findings:
        return

    print('Generating findings')
    findingsList = {}
    with tqdm(total=len(findings)) as pbar: