Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tz committed Jun 24, 2020
1 parent fa9bb94 commit d2d1f26
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ For this to match, the function must:
If only one of these features is found in a function, the rule will not match.


## limitations
### circular rule dependencies
While capa supports [matching on prior rule matches](#matching-prior-rule-matches) users should ensure that their rules do not introduce circular dependencies between rules.


# extracted features

## function features
Expand All @@ -249,10 +254,14 @@ though possibly a local function (like `malloc`) extracted via FLIRT.

The parameter is a string describing the function name, specified like `module.functionname` or `functionname`.

Windows API functions that take string arguments come in two API versions. For example `CreateProcessA` takes ANSI strings and `CreateProcessW` takes Unicode strings. capa extracts these API features both with and without the suffix character `A` or `W`. That means you can write a rule to match on both APIs using the base name. If you want to match a specific API version, you can include the suffix.

Example:

api: kernel32.CreateFileA
api: CreateFileA
api: kernel32.CreateFile # matches both Ansi (CreateFileA) and Unicode (CreateFileW) versions
api: CreateFile
api: GetEnvironmentVariableW # only matches on Unicode version


### number
A number used by the logic of the program.
Expand Down
8 changes: 4 additions & 4 deletions capa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,15 +640,15 @@ def main(argv=None):
logger.error("-" * 80)
logger.error(" Input file does not appear to be a PE file.")
logger.error(" ")
logger.error(" Today, capa currently only supports analyzing PE files (or shellcode, when using --format sc32|sc64).")
logger.error(" capa currently only supports analyzing PE files (or shellcode, when using --format sc32|sc64).")
logger.error(" If you don't know the input file type, you can try using the `file` utility to guess it.")
logger.error("-" * 80)
return -1
except UnsupportedRuntimeError:
logger.error("-" * 80)
logger.error(" Unsupported runtime or Python interpreter.")
logger.error(" ")
logger.error(" Today, capa supports running under Python 2.7 using Vivisect for binary analysis.")
logger.error(" capa supports running under Python 2.7 using Vivisect for binary analysis.")
logger.error(" It can also run within IDA Pro, using either Python 2.7 or 3.5+.")
logger.error(" ")
logger.error(" If you're seeing this message on the command line, please ensure you're running Python 2.7.")
Expand Down Expand Up @@ -679,7 +679,7 @@ def main(argv=None):
logger.warning(" ")
logger.warning(" .NET is a cross-platform framework for running managed applications.")
logger.warning(
" Today, capa cannot handle non-native files. This means that the results may be misleading or incomplete.")
" capa cannot handle non-native files. This means that the results may be misleading or incomplete.")
logger.warning(" You may have to analyze the file manually, using a tool like the .NET decompiler dnSpy.")
logger.warning(" ")
logger.warning(" Use -v or -vv if you really want to see the capabilities identified by capa.")
Expand All @@ -698,7 +698,7 @@ def main(argv=None):
logger.warning(" ")
logger.warning(" AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI.")
logger.warning(
" Today, capa cannot handle AutoIt scripts. This means that the results will be misleading or incomplete.")
" capa cannot handle AutoIt scripts. This means that the results will be misleading or incomplete.")
logger.warning(" You may have to analyze the file manually, using a tool like the AutoIt decompiler MyAut2Exe.")
logger.warning(" ")
logger.warning(" Use -v or -vv if you really want to see the capabilities identified by capa.")
Expand Down
2 changes: 1 addition & 1 deletion rules
Submodule rules updated from eaae0e to d34acf
1 change: 1 addition & 0 deletions tests/test_viv_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_api_features(mimikatz):
def test_api_features_64_bit(sample_a198216798ca38f280dc413f8c57f2c2):
features = extract_function_features(viv_utils.Function(sample_a198216798ca38f280dc413f8c57f2c2.vw, 0x4011B0))
assert capa.features.insn.API('kernel32.GetStringTypeA') in features
assert capa.features.insn.API('kernel32.GetStringTypeW') not in features
assert capa.features.insn.API('kernel32.GetStringType') in features
assert capa.features.insn.API('GetStringTypeA') in features
assert capa.features.insn.API('GetStringType') in features
Expand Down

0 comments on commit d2d1f26

Please sign in to comment.