mirror of
https://github.com/mandiant/capa.git
synced 2025-12-23 15:37:37 -08:00
pep8
This commit is contained in:
@@ -140,7 +140,7 @@ class Feature(abc.ABC):
|
|||||||
return Result(self in ctx, self, [], locations=ctx.get(self, set()))
|
return Result(self in ctx, self, [], locations=ctx.get(self, set()))
|
||||||
|
|
||||||
def freeze_serialize(self):
|
def freeze_serialize(self):
|
||||||
return (self.__class__.__name__, (self.value, ))
|
return (self.__class__.__name__, (self.value,))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def freeze_deserialize(cls, args):
|
def freeze_deserialize(cls, args):
|
||||||
@@ -377,7 +377,7 @@ class Bytes(Feature):
|
|||||||
return hex_string(bytes_to_str(self.value))
|
return hex_string(bytes_to_str(self.value))
|
||||||
|
|
||||||
def freeze_serialize(self):
|
def freeze_serialize(self):
|
||||||
return (self.__class__.__name__, (bytes_to_str(self.value).upper(), ))
|
return (self.__class__.__name__, (bytes_to_str(self.value).upper(),))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def freeze_deserialize(cls, args):
|
def freeze_deserialize(cls, args):
|
||||||
|
|||||||
@@ -138,9 +138,7 @@ def main(argv=None):
|
|||||||
# TODO fix
|
# TODO fix
|
||||||
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
||||||
else:
|
else:
|
||||||
function_handles = tuple(
|
function_handles = tuple(filter(lambda fh: v.format_address(fh.address) == args.function, function_handles))
|
||||||
filter(lambda fh: v.format_address(fh.address) == args.function, function_handles)
|
|
||||||
)
|
|
||||||
|
|
||||||
if args.function not in [v.format_address(fh.address) for fh in function_handles]:
|
if args.function not in [v.format_address(fh.address) for fh in function_handles]:
|
||||||
print("%s not a function" % args.function)
|
print("%s not a function" % args.function)
|
||||||
@@ -188,9 +186,7 @@ def print_features(functions, extractor: capa.features.extractors.base_extractor
|
|||||||
for f in functions:
|
for f in functions:
|
||||||
if extractor.is_library_function(f.address):
|
if extractor.is_library_function(f.address):
|
||||||
function_name = extractor.get_function_name(f.address)
|
function_name = extractor.get_function_name(f.address)
|
||||||
logger.debug(
|
logger.debug("skipping library function %s (%s)", v.format_address(f.address), function_name)
|
||||||
"skipping library function %s (%s)", v.format_address(f.address), function_name
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("func: %s" % (v.format_address(f.address)))
|
print("func: %s" % (v.format_address(f.address)))
|
||||||
@@ -221,7 +217,15 @@ def print_features(functions, extractor: capa.features.extractors.base_extractor
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if insn.address != addr:
|
if insn.address != addr:
|
||||||
print(" insn: %s: %s: %s -> %s" % (v.format_address(f.address), v.format_address(insn.address), feature, v.format_address(addr)))
|
print(
|
||||||
|
" insn: %s: %s: %s -> %s"
|
||||||
|
% (
|
||||||
|
v.format_address(f.address),
|
||||||
|
v.format_address(insn.address),
|
||||||
|
feature,
|
||||||
|
v.format_address(addr),
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print(" insn: %s: %s" % (v.format_address(insn.address), feature))
|
print(" insn: %s: %s" % (v.format_address(insn.address), feature))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user