mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
Merge branch 'feature-571' of github.com:fireeye/capa into feature-571
This commit is contained in:
@@ -10,6 +10,7 @@ It includes many new rules, including all new techniques introduced in MITRE ATT
|
||||
- main: auto detect shellcode based on file extension #516 @mr-tz
|
||||
- main: use FLIRT signatures to identify and ignore library code #446 @williballenthin
|
||||
- explorer: IDA 7.6 support #497 @williballenthin
|
||||
- scripts: capa2yara.py convert capa rules to YARA rules #561 @ruppde
|
||||
|
||||
### New Rules (69)
|
||||
|
||||
@@ -95,13 +96,14 @@ It includes many new rules, including all new techniques introduced in MITRE ATT
|
||||
- explorer: document IDA 7.6sp1 as alternative to the patch #536 @Ana06
|
||||
- rules: update ATT&CK and MBC mappings https://github.com/fireeye/capa-rules/pull/317 @williballenthin
|
||||
- tests: update test cases and caching #545 @mr-tz
|
||||
- linter: summarize results at the end #571 @williballenthin
|
||||
- show-features: don't show features from library functions #569 @williballenthin
|
||||
|
||||
### Development
|
||||
|
||||
- ci: add capa release link to capa-rules tag #517 @Ana06
|
||||
- ci, changelog: update `New Rules` section in CHANGELOG automatically https://github.com/fireeye/capa-rules/pull/374 #549 @Ana06
|
||||
- ci, changelog: support multiple author in sync GH https://github.com/fireeye/capa-rules/pull/378 @Ana06
|
||||
- ci, lint: check statements for single child statements #563 @mr-tz
|
||||
|
||||
### Raw diffs
|
||||
|
||||
|
||||
2
rules
2
rules
Submodule rules updated: b06c2a316a...021b7efdf4
@@ -218,6 +218,29 @@ class DoesntMatchExample(Lint):
|
||||
return True
|
||||
|
||||
|
||||
class StatementWithSingleChildStatement(Lint):
|
||||
name = "rule contains one or more statements with a single child statement"
|
||||
recommendation = "remove the superfluous parent statement"
|
||||
recommendation_template = "remove the superfluous parent statement: {:s}"
|
||||
violation = False
|
||||
|
||||
def check_rule(self, ctx, rule):
|
||||
self.violation = False
|
||||
|
||||
def rec(statement, is_root=False):
|
||||
if isinstance(statement, (capa.engine.And, capa.engine.Or)):
|
||||
children = list(statement.get_children())
|
||||
if not is_root and len(children) == 1 and isinstance(children[0], capa.engine.Statement):
|
||||
self.recommendation = self.recommendation_template.format(str(statement))
|
||||
self.violation = True
|
||||
for child in children:
|
||||
rec(child)
|
||||
|
||||
rec(rule.statement, is_root=True)
|
||||
|
||||
return self.violation
|
||||
|
||||
|
||||
class UnusualMetaField(Lint):
|
||||
name = "unusual meta field"
|
||||
recommendation = "Remove the meta field"
|
||||
@@ -472,7 +495,10 @@ def get_rule_features(rule):
|
||||
return features
|
||||
|
||||
|
||||
LOGIC_LINTS = (DoesntMatchExample(),)
|
||||
LOGIC_LINTS = (
|
||||
DoesntMatchExample(),
|
||||
StatementWithSingleChildStatement(),
|
||||
)
|
||||
|
||||
|
||||
def lint_logic(ctx, rule):
|
||||
|
||||
@@ -182,6 +182,13 @@ def ida_main():
|
||||
|
||||
def print_features(functions, extractor):
|
||||
for f in functions:
|
||||
function_address = int(f)
|
||||
|
||||
if extractor.is_library_function(function_address):
|
||||
function_name = extractor.get_function_name(function_address)
|
||||
logger.debug("skipping library function 0x%x (%s)", function_address, function_name)
|
||||
continue
|
||||
|
||||
for feature, va in extractor.extract_function_features(f):
|
||||
print("func: 0x%08x: %s" % (va, feature))
|
||||
|
||||
|
||||
Submodule tests/data updated: b5ee7ac7b9...dbcc4ca51f
Reference in New Issue
Block a user