forked from redrays-io/ABAP-Code-Scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (29 loc) · 1.23 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# main.py
import argparse
from config import Config
from generate_xlsx_report import generate_xlsx_report, ScanResult
from scanner import Scanner
def main():
parser = argparse.ArgumentParser(description="ABAP Code Scanner")
parser.add_argument("path", help="Path to the ABAP code directory or file")
parser.add_argument("-c", "--config", help="Path to configuration file", default="config.yml")
parser.add_argument("-t", "--threads", type=int, help="Number of threads to use for scanning", default=48)
args = parser.parse_args()
config = Config(args.config)
scanner = Scanner(config)
results = scanner.scan(args.path, num_threads=args.threads)
# Convert scanner results to ScanResult objects, now including severity
report_results = [
ScanResult(
file_path=result.file_path,
line_number=result.line_number,
title=result.title,
message=result.message,
severity=result.severity
) for result in results
]
# Generate the XLSX report
generate_xlsx_report(report_results, "abap_security_scan_report.xlsx")
print(f"Scan complete. XLSX report generated: abap_security_scan_report.xlsx")
if __name__ == "__main__":
main()