joxeankoret icon

Untitled

joxeankoret | PRO | 11/30/18 02:24:30 PM UTC | 0 ⭐ | 457 👁️ | Never ⏰ | []
Python |

680 B

|

None

|

0 👍

/

0 👎

#!/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)

Comments