Skip to content

Commit

Permalink
dynamic: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Oct 17, 2023
1 parent 7205bc2 commit 5475020
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion capa/features/freeze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ def main(argv=None):
parser.add_argument("output", type=str, help="Path to output file")
args = parser.parse_args(args=argv)
capa.main.handle_common_args(args)
capa.main.handle_signatures_arg(args)

sigpaths = capa.main.get_signatures(args.signatures)

Expand Down
6 changes: 0 additions & 6 deletions capa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
FORMAT_DOTNET,
FORMAT_FREEZE,
FORMAT_RESULT,
DYNAMIC_FORMATS,
)
from capa.features.address import NO_ADDRESS, Address
from capa.features.extractors.base_extractor import (
Expand Down Expand Up @@ -1360,8 +1359,6 @@ def handle_common_args(args):

args.rules = rules_paths


def handle_signatures_arg(args):
if hasattr(args, "signatures"):
if args.signatures == SIGNATURES_PATH_DEFAULT_STRING:
logger.debug("-" * 80)
Expand Down Expand Up @@ -1556,9 +1553,6 @@ def main(argv: Optional[List[str]] = None):
# and use those for extracting.

try:
if format_ not in DYNAMIC_FORMATS:
# signatures are loaded only for static anaylsis
handle_signatures_arg(args)
if format_ == FORMAT_PE:
sig_paths = get_signatures(args.signatures)
else:
Expand Down
4 changes: 2 additions & 2 deletions capa/render/vverbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,13 @@ def render_rules(ostream, doc: rd.ResultDocument):
ostream.write(" @ ")
ostream.write(capa.render.verbose.format_address(location))

if capa.rules.Scope.BASIC_BLOCK in rule.meta.scopes:
if doc.meta.flavor == rd.Flavor.STATIC and rule.meta.scopes.static == capa.rules.Scope.BASIC_BLOCK:
ostream.write(
" in function "
+ capa.render.verbose.format_address(frz.Address.from_capa(functions_by_bb[location.to_capa()]))
)

if capa.rules.Scope.THREAD in rule.meta.scopes:
if doc.meta.flavor == rd.Flavor.DYNAMIC and rule.meta.scopes.dynamic == capa.rules.Scope.THREAD:
ostream.write(
" in process "
+ capa.render.verbose.format_address(
Expand Down

0 comments on commit 5475020

Please sign in to comment.