Skip to content

Commit

Permalink
move API name normalization to helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-hunhoff committed Apr 6, 2022
1 parent 6947497 commit 834d751
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions capa/features/extractors/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def generate_symbols(dll: str, symbol: str) -> Iterator[str]:
- CreateFileA
- CreateFile
"""
# normalize dll name
dll = dll.lower()

# kernel32.CreateFileA
yield "%s.%s" % (dll, symbol)

Expand Down
6 changes: 1 addition & 5 deletions capa/features/insn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@

class API(Feature):
def __init__(self, name: str, description=None):
# Downcase library name if given
if "." in name:
modname, _, impname = name.rpartition(".")
name = modname.lower() + "." + impname

super(API, self).__init__(name, description=description)



class Number(Feature):
def __init__(self, value: int, bitness=None, description=None):
super(Number, self).__init__(value, bitness=bitness, description=description)
Expand Down

0 comments on commit 834d751

Please sign in to comment.