Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.7
- """
- Example IDA Python script to get "names" (functions, variables, etc...) from string constants
- using Natural Language Processing.
- """
- from __future__ import print_function
- import pprint
- import idautils
- import nltk
- from nltk.tokenize import word_tokenize
- from nltk.tag import pos_tag
- def preprocess(sent):
- sent = nltk.word_tokenize(sent)
- sent = nltk.pos_tag(sent)
- return sent
- strings = Strings()
- strings.setup(strtypes=[0, 1])
- s = "\n".join(map(str, list(strings)))
- results = preprocess(s)
- for value, type in results:
- if len(value) > 4 and (type == "NN" or type.startswith("VB")):
- print("Found", value, "type", type)
Advertisement
Add Comment
Please, Sign In to add comment