7
7
8
8
from dotenv import load_dotenv
9
9
10
+ from util .http import ping_backend
11
+
10
12
path_root = os .getcwd ()
11
13
if path_root not in sys .path :
12
14
sys .path .append (path_root )
13
15
14
16
15
17
import client .cli .report as report # noqa: E402
16
18
from client .cli .console import ConsoleWriter , MessageStatus # noqa: E402
17
- from client .cli .prospector_client import DEFAULT_BACKEND # noqa: E402
18
19
from client .cli .prospector_client import TIME_LIMIT_AFTER # noqa: E402
19
20
from client .cli .prospector_client import TIME_LIMIT_BEFORE # noqa: E402
20
21
from client .cli .prospector_client import prospector # noqa: E402; noqa: E402
@@ -51,7 +52,7 @@ def main(argv): # noqa: C901
51
52
)
52
53
return
53
54
54
- # if args.get(" ping") :
55
+ # if config. ping:
55
56
# return ping_backend(backend, get_level() < logging.INFO)
56
57
57
58
config .pub_date = (
@@ -62,55 +63,32 @@ def main(argv): # noqa: C901
62
63
pretty_log (logger , config .__dict__ )
63
64
64
65
logger .debug ("Vulnerability ID: " + config .cve_id )
65
- logger .debug (f"time-limit before: { TIME_LIMIT_BEFORE } " )
66
- logger .debug (f"time-limit after: { TIME_LIMIT_AFTER } " )
67
66
68
67
results , advisory_record = prospector (
69
68
vulnerability_id = config .cve_id ,
70
69
repository_url = config .repository ,
71
70
publication_date = config .pub_date ,
72
71
vuln_descr = config .description ,
73
- tag_interval = config .tag_interval ,
72
+ # tag_interval=config.tag_interval,
74
73
version_interval = config .version_interval ,
75
74
modified_files = config .modified_files ,
76
75
advisory_keywords = config .keywords ,
77
- time_limit_before = TIME_LIMIT_BEFORE ,
78
- time_limit_after = TIME_LIMIT_AFTER ,
79
76
use_nvd = config .use_nvd ,
80
- nvd_rest_endpoint = "" ,
81
77
fetch_references = config .fetch_references ,
82
78
backend_address = config .backend ,
83
79
use_backend = config .use_backend ,
84
80
git_cache = config .git_cache ,
85
81
limit_candidates = config .max_candidates ,
86
- rules = ["ALL" ],
87
82
)
88
83
89
84
if config .preprocess_only :
90
85
return
91
86
92
- with ConsoleWriter ("Generating report\n " ) as console :
93
- match config .report :
94
- case "console" :
95
- report .console_ (results , advisory_record , get_level () < logging .INFO )
96
- case "json" :
97
- report .json_ (results , advisory_record , config .report_filename )
98
- case "html" :
99
- report .html_ (results , advisory_record , config .report_filename )
100
- case "all" :
101
- report .json_ (results , advisory_record , config .report_filename )
102
- report .html_ (results , advisory_record , config .report_filename )
103
- case _:
104
- logger .warning ("Invalid report type specified, using 'console'" )
105
- console .set_status (MessageStatus .WARNING )
106
- console .print (
107
- f"{ config .report } is not a valid report type, 'console' will be used instead" ,
108
- )
109
- report .console_ (results , advisory_record , get_level () < logging .INFO )
110
-
111
- logger .info ("\n " + execution_statistics .generate_console_tree ())
112
- execution_time = execution_statistics ["core" ]["execution time" ][0 ]
113
- console .print (f"Report saved in { config .report_filename } " )
87
+ report .generate_report (
88
+ results , advisory_record , config .report , config .report_filename
89
+ )
90
+
91
+ execution_time = execution_statistics ["core" ]["execution time" ][0 ]
114
92
ConsoleWriter .print (f"Execution time: { execution_time :.3f} s" )
115
93
116
94
return
0 commit comments