Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def pway ():
- all = set(Functions(MinEA(), MaxEA()))
- leaf = all.copy()
- for ea in all:
- for xref in CodeRefsTo(ea, 1):
- func = GetFunctionAttr(ea, FUNCATTR_START)
- try:
- leaf.remove(func)
- except KeyError, e:
- # already removed.
- pass
- return leaf
- def away ():
- ea = SegByName(".text")
- end = SegEnd(ea)
- allFuncs = list(Functions(ea, end))
- while True:
- if ea > end:
- break
- call = FindBinary(ea, SEARCH_DOWN, "E8", 16)
- if call == -1:
- print "wtf -1\n"
- break
- funcStart = GetFunctionAttr(call, FUNCATTR_START)
- try:
- allFuncs.remove(funcStart)
- ea = GetFunctionAttr(call, FUNCATTR_END)
- except ValueError:
- ea = call+1
- pass
- return allFuncs
- start = time.clock()
- for i in xrange(100):
- away()
- print "away took %.2f clock cycles" % (time.clock() - start)
- start = time.clock()
- for i in xrange(100):
- pway()
- print "pway took %.2f clock cycles" % (time.clock() - start)
Add Comment
Please, Sign In to add comment