mirror of
https://github.com/mandiant/capa.git
synced 2025-12-22 07:10:29 -08:00
black -l 120 .
This commit is contained in:
@@ -244,6 +244,7 @@ def render_default(meta, rules, capabilities):
|
|||||||
doc = convert_capabilities_to_result_document(meta, rules, capabilities)
|
doc = convert_capabilities_to_result_document(meta, rules, capabilities)
|
||||||
return capa.render.default.render_default(doc)
|
return capa.render.default.render_default(doc)
|
||||||
|
|
||||||
|
|
||||||
class CapaJsonObjectEncoder(json.JSONEncoder):
|
class CapaJsonObjectEncoder(json.JSONEncoder):
|
||||||
"""JSON encoder that emits Python sets as sorted lists"""
|
"""JSON encoder that emits Python sets as sorted lists"""
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ def render_meta(doc, ostream):
|
|||||||
ostream["sha256"] = doc["meta"]["sample"]["sha256"]
|
ostream["sha256"] = doc["meta"]["sample"]["sha256"]
|
||||||
ostream["path"] = doc["meta"]["sample"]["path"]
|
ostream["path"] = doc["meta"]["sample"]["path"]
|
||||||
|
|
||||||
|
|
||||||
def find_subrule_matches(doc):
|
def find_subrule_matches(doc):
|
||||||
"""
|
"""
|
||||||
collect the rule names that have been matched as a subrule match.
|
collect the rule names that have been matched as a subrule match.
|
||||||
@@ -83,6 +84,7 @@ def render_capabilities(doc, ostream):
|
|||||||
ostream["CAPABILITY"].setdefault(rule["meta"]["namespace"], list())
|
ostream["CAPABILITY"].setdefault(rule["meta"]["namespace"], list())
|
||||||
ostream["CAPABILITY"][rule["meta"]["namespace"]].append(capability)
|
ostream["CAPABILITY"][rule["meta"]["namespace"]].append(capability)
|
||||||
|
|
||||||
|
|
||||||
def render_attack(doc, ostream):
|
def render_attack(doc, ostream):
|
||||||
"""
|
"""
|
||||||
example::
|
example::
|
||||||
@@ -174,6 +176,7 @@ def render_mbc(doc, ostream):
|
|||||||
raise RuntimeError("unexpected MBC spec format")
|
raise RuntimeError("unexpected MBC spec format")
|
||||||
ostream["MBC"].setdefault(objective.upper(), inner_rows)
|
ostream["MBC"].setdefault(objective.upper(), inner_rows)
|
||||||
|
|
||||||
|
|
||||||
def render_dictionary(doc):
|
def render_dictionary(doc):
|
||||||
ostream = dict()
|
ostream = dict()
|
||||||
render_meta(doc, ostream)
|
render_meta(doc, ostream)
|
||||||
@@ -183,8 +186,9 @@ def render_dictionary(doc):
|
|||||||
|
|
||||||
return ostream
|
return ostream
|
||||||
|
|
||||||
|
|
||||||
# ==== render dictionary helpers
|
# ==== render dictionary helpers
|
||||||
def capa_details(file_path: str, output_format: str="dictionary") -> dict:
|
def capa_details(file_path: str, output_format: str = "dictionary") -> dict:
|
||||||
|
|
||||||
# extract features and find capabilities
|
# extract features and find capabilities
|
||||||
extractor = capa.main.get_extractor(file_path, "auto", disable_progress=True)
|
extractor = capa.main.get_extractor(file_path, "auto", disable_progress=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user