Skip to content

Commit

Permalink
fix(cli): various fixes to report commands (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocervell authored Jan 24, 2025
1 parent 6e10e4a commit ee715dd
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions secator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def report_show(report_query, output, runner_type, time_delta, type, query, work
# Load all report paths
load_all_reports = any([not Path(p).exists() for p in report_query])
all_reports = []
if load_all_reports:
if load_all_reports or workspace:
all_reports = list_reports(workspace=workspace, type=runner_type, timedelta=human_to_timedelta(time_delta))
if not report_query:
report_query = all_reports
Expand Down Expand Up @@ -1093,31 +1093,6 @@ def install_tools(cmds):
sys.exit(return_code)


@install.command('cves')
@click.option('--force', is_flag=True)
def install_cves(force):
"""Install CVEs (enables passive vulnerability search)."""
if CONFIG.offline_mode:
console.print('[bold red]Cannot run this command in offline mode.[/]')
return
cve_json_path = f'{CONFIG.dirs.cves}/circl-cve-search-expanded.json'
if not os.path.exists(cve_json_path) or force:
with console.status('[bold yellow]Downloading zipped CVEs from cve.circl.lu ...[/]'):
Command.execute('wget https://cve.circl.lu/static/circl-cve-search-expanded.json.gz', cwd=CONFIG.dirs.cves)
with console.status('[bold yellow]Unzipping CVEs ...[/]'):
Command.execute(f'gunzip {CONFIG.dirs.cves}/circl-cve-search-expanded.json.gz', cwd=CONFIG.dirs.cves)
with console.status(f'[bold yellow]Installing CVEs to {CONFIG.dirs.cves} ...[/]'):
with open(cve_json_path, 'r') as f:
for line in f:
data = json.loads(line)
cve_id = data['id']
cve_path = f'{CONFIG.dirs.cves}/{cve_id}.json'
with open(cve_path, 'w') as f:
f.write(line)
console.print(f'CVE saved to {cve_path}')
console.print(':tada: CVEs installed successfully !', style='bold green')


#--------#
# UPDATE #
#--------#
Expand Down

0 comments on commit ee715dd

Please sign in to comment.