Skip to content

Commit

Permalink
Merge branch 'master' into feat/1755
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tz committed May 28, 2024
2 parents 3ed0075 + 0622f45 commit 6449520
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/mypy/mypy.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[mypy]

[mypy-halo.*]
ignore_missing_imports = True

[mypy-tqdm.*]
ignore_missing_imports = True

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- add function in capa/helpers to load plain and compressed JSON reports #1883 @Rohit1123
- document Antivirus warnings and VirusTotal false positive detections #2028 @RionEV @mr-tz
- replace Halo spinner with Rich #2086 @s-ff

### Breaking Changes

Expand Down
10 changes: 7 additions & 3 deletions capa/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from typing import Set, Dict, List, Optional
from pathlib import Path

import halo
from rich.console import Console
from typing_extensions import assert_never

import capa.perf
Expand Down Expand Up @@ -179,6 +179,10 @@ def get_extractor(
UnsupportedArchError
UnsupportedOSError
"""

# stderr=True is used here to redirect the spinner banner to stderr, so that users can redirect capa's output.
console = Console(stderr=True, quiet=disable_progress)

if backend == BACKEND_CAPE:
import capa.features.extractors.cape.extractor

Expand Down Expand Up @@ -225,7 +229,7 @@ def get_extractor(
if os_ == OS_AUTO and not is_supported_os(input_path):
raise UnsupportedOSError()

with halo.Halo(text="analyzing program", spinner="simpleDots", stream=sys.stderr, enabled=not disable_progress):
with console.status("analyzing program...", spinner="dots"):
bv: BinaryView = binaryninja.load(str(input_path))
if bv is None:
raise RuntimeError(f"Binary Ninja cannot open file {input_path}")
Expand All @@ -250,7 +254,7 @@ def get_extractor(
if os_ == OS_AUTO and not is_supported_os(input_path):
raise UnsupportedOSError()

with halo.Halo(text="analyzing program", spinner="simpleDots", stream=sys.stderr, enabled=not disable_progress):
with console.status("analyzing program...", spinner="dots"):
vw = get_workspace(input_path, input_format, sigpaths)

if should_save_workspace:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies = [
"wcwidth==0.2.13",
"ida-settings==2.1.0",
"viv-utils[flirt]==0.7.9",
"halo==0.0.31",
"networkx==3.1",
"ruamel.yaml==0.18.6",
"vivisect==1.1.1",
Expand All @@ -50,6 +49,7 @@ dependencies = [
"dncil==1.0.2",
"pydantic==2.7.1",
"protobuf==5.26.1",
"rich==13.4.2"
]
dynamic = ["version"]

Expand Down Expand Up @@ -78,7 +78,7 @@ dev = [
"flake8-simplify==0.21.0",
"flake8-use-pathlib==0.3.0",
"flake8-copyright==0.2.4",
"ruff==0.4.4",
"ruff==0.4.5",
"black==24.4.2",
"isort==5.13.2",
"mypy==1.10.0",
Expand Down

0 comments on commit 6449520

Please sign in to comment.