mirror of
https://github.com/casterbyte/Sara.git
synced 2026-08-02 22:41:35 +00:00
Merge e30ae12b99 into d4362252a9
This commit is contained in:
commit
8cd941c3e4
1 changed files with 13 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
# This project is not affiliated with or endorsed by SIA Mikrotīkls
|
# This project is not affiliated with or endorsed by SIA Mikrotīkls
|
||||||
|
|
||||||
import json, re, os, requests, time
|
import json, re, os, requests, time
|
||||||
|
from datetime import datetime
|
||||||
from packaging.version import Version, InvalidVersion
|
from packaging.version import Version, InvalidVersion
|
||||||
from colorama import Fore, Style
|
from colorama import Fore, Style
|
||||||
|
|
||||||
|
|
@ -13,6 +14,7 @@ NVD_URL = "https://services.nvd.nist.gov/rest/json/cves/2.0"
|
||||||
KEYWORD = "routeros"
|
KEYWORD = "routeros"
|
||||||
RESULTS_PER_PAGE = 2000
|
RESULTS_PER_PAGE = 2000
|
||||||
OUTPUT_FILE = "routeros_cves.json"
|
OUTPUT_FILE = "routeros_cves.json"
|
||||||
|
TIMEDRIFT = 900 # 900 seconds
|
||||||
GUTTER = 2 # spaces between columns
|
GUTTER = 2 # spaces between columns
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -261,8 +263,17 @@ def load_cve_data():
|
||||||
fetch_all_cves()
|
fetch_all_cves()
|
||||||
else:
|
else:
|
||||||
print(Fore.YELLOW + f"[?] {OUTPUT_FILE} already exists.")
|
print(Fore.YELLOW + f"[?] {OUTPUT_FILE} already exists.")
|
||||||
answer = input(Fore.YELLOW + " Overwrite it with fresh CVE data? [yes/no]: ").strip().lower()
|
# Get file last change date
|
||||||
if answer == "yes":
|
file_mtime = os.path.getmtime(OUTPUT_FILE)
|
||||||
|
current_time = time.time()
|
||||||
|
time_diff = current_time - file_mtime
|
||||||
|
#answer = input(Fore.YELLOW + " Overwrite it with fresh CVE data? [yes/no]: ").strip().lower()
|
||||||
|
#if answer == "no":
|
||||||
|
if time_diff < TIMEDRIFT:
|
||||||
|
print(Fore.GREEN + f" File is recent (modified {time_diff:.0f}s ago). Skipping download.")
|
||||||
|
else:
|
||||||
|
#if answer == "yes":
|
||||||
|
print(Fore.YELLOW + f" File is old (modified {time_diff:.0f}s ago). Downloading fresh data...")
|
||||||
fetch_all_cves()
|
fetch_all_cves()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue