File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1414from yaspin .spinners import Spinners
1515from rich import print_json
1616
17+ def __request_epss (cve_id : str ) -> Any :
18+ res = requests .get (
19+ f'https://api.first.org/data/v1/epss?cve={ cve_id } ' ,
20+ timeout = 10
21+ )
22+ return res .json ()
23+
1724def __request_cve (cve_id : str ) -> Any :
1825 """Request CVE information from First (api.first.org)
1926
@@ -24,7 +31,6 @@ def __request_cve(cve_id: str) -> Any:
2431 _type_: _description_
2532 """
2633 res = requests .get (
27- # f'https://api.first.org/data/v1/epss?cve={cve_id}',
2834 f'https://services.nvd.nist.gov/rest/json/cves/2.0?cveId={ cve_id } ' ,
2935 timeout = 10
3036 )
@@ -54,6 +60,9 @@ def main():
5460 cve_lookup = subparsers .add_parser ("lookup" , help = "Request a single CVE" )
5561 cve_lookup .add_argument ("--id" , type = str )
5662
63+ epss_lookup = subparsers .add_parser ("epss" , help = "Request EPSS info for CVE" )
64+ epss_lookup .add_argument ("--id" , type = str )
65+
5766 args = parser .parse_args ()
5867
5968 if args .command == "lookup" :
@@ -78,6 +87,9 @@ def main():
7887
7988 print ("\n " )
8089 custom_cve .display_cve ()
90+ elif args .command == "epss" :
91+ data = __request_epss (args .id )
92+ print_json (json .dumps (data ))
8193 else :
8294 parser .print_help ()
8395
You can’t perform that action at this time.
0 commit comments