def main():
banner = "PyMal - Python Interactive Shell for Malware Analysis.\nUse Object \"pm\" to access the malware analysis related functions!\nAuthor: Amit Malik\nhttp://www.securityxploded.com\n"
pm = PyMal()
class pymalcomplete(rlcompleter.Completer):
# Code segment from scapy - It is neat and mature
def attr_matches(self, text):
m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
if not m:
return
expr, attr = m.group(1, 3)
try:
object = eval(expr)
except:
object = eval(expr, session)
words = dir(object)
if hasattr(pm,"__class__" ):
words = words + rlcompleter.get_class_members(pm.__class__)
matches = []
n = len(attr)
for word in words:
if word[:n] == attr:
matches.append("%s.%s" % (expr, word))
return matches
readline.set_completer(pymalcomplete().complete)
readline.parse_and_bind("C-o: operate-and-get-next")
readline.parse_and_bind('tab: complete')
code.interact(banner=banner,local = locals())
评论列表
文章目录