Skip to content

Commit

Permalink
Use individual arguments rather than passing the cli args for depscan…
Browse files Browse the repository at this point in the history
… compatibility. (#54)

Signed-off-by: Caroline Russell <caroline@appthreat.dev>
  • Loading branch information
cerrussell authored Feb 16, 2024
1 parent 2296933 commit f9ec9fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
24 changes: 13 additions & 11 deletions blint/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def __init__(self):
self.task = None
self.reviewer = None

def start(self, args, files, reports_dir):
def start(self, files, reports_dir, no_reviews=False, suggest_fuzzables=True):
"""Starts the analysis process for the given source files.
This function takes the command-line arguments and the reports
Expand All @@ -380,27 +380,29 @@ def start(self, args, files, reports_dir):
Args:
files (list): The list of source files to be analyzed.
args: The command-line arguments.
reports_dir: The directory where the reports will be stored.
reports_dir (str): The directory where the reports will be stored.
no_reviews (bool): Whether to perform reviews or not.
suggest_fuzzables (bool): Whether to suggest fuzzable targets or not.
Returns:
tuple: A tuple of the findings, reviews, files, and fuzzables.
"""
with self.progress:
self.task = self.progress.add_task(
f"[green] Blinting {len(files)} binaries",
f"[green] BLinting {len(files)} binaries",
total=len(files), start=True, )
for f in files:
self._process_files(f, args, reports_dir)
self._process_files(f, reports_dir, no_reviews, suggest_fuzzables)
return self.findings, self.reviews, self.fuzzables

def _process_files(self, f, args, reports_dir):
def _process_files(self, f, reports_dir, no_reviews, suggest_fuzzables):
"""Processes the given file and generates findings.
Args:
f: The file to be processed.
args: The command-line arguments.
reports_dir: The directory where the reports will be stored.
f (str): The file to be processed.
reports_dir (str): The directory where the reports will be stored.
no_reviews (bool): Whether to perform reviews or not.
suggest_fuzzables (bool): Whether to suggest fuzzable targets or not.
"""
self.progress.update(
Expand All @@ -419,10 +421,10 @@ def _process_files(self, f, args, reports_dir):
if finding := run_checks(f, metadata):
self.findings += finding
# Perform symbol reviews
if not args.no_reviews:
if no_reviews:

This comment has been minimized.

Copy link
@prabhu

prabhu Jun 17, 2024

Member

This condition must have been if not no_reviews:. Unfortunately, this bug has meant that reviews has gotten disabled completely for everyone. :(

This comment has been minimized.

Copy link
@prabhu
self.do_review(exe_name, f, metadata)
# Suggest fuzzable targets
if args.suggest_fuzzable and (fuzzdata := run_prefuzz(metadata)):
if suggest_fuzzables and (fuzzdata := run_prefuzz(metadata)):
self.fuzzables.append(
{
"filename": f,
Expand Down
4 changes: 3 additions & 1 deletion blint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def main():
else:
files = gen_file_list(src_dirs)
analyzer = AnalysisRunner()
findings, reviews, fuzzables = analyzer.start(args, files, reports_dir)
findings, reviews, fuzzables = analyzer.start(
files, reports_dir, args.no_reviews, args.suggest_fuzzable
)
report(src_dirs, reports_dir, findings, reviews, files, fuzzables)

if os.getenv("CI") and not args.noerror:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "blint"
version = "2.0.0"
version = "2.0.0-beta.2"
description = "Linter and SBOM generator for binary files."
authors = ["Prabhu Subramanian <prabhu@appthreat.com>", "Caroline Russell <caroline@appthreat.dev>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -65,4 +65,3 @@ max-line-length = 99
[tool.pylint.design]
max-args = 6
max-nested-blocks = 6

0 comments on commit f9ec9fc

Please sign in to comment.