本文整理匯總了Python中haystack.config.Config.getStructsCacheDir方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.getStructsCacheDir方法的具體用法?Python Config.getStructsCacheDir怎麽用?Python Config.getStructsCacheDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類haystack.config.Config
的用法示例。
在下文中一共展示了Config.getStructsCacheDir方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: reverseInstances
# 需要導入模塊: from haystack.config import Config [as 別名]
# 或者: from haystack.config.Config import getStructsCacheDir [as 別名]
def reverseInstances(dumpname):
from haystack.reverse import context
log.debug ('[+] Loading the memory dump ')
ctx = context.get_context(dumpname)
try:
if not os.access(Config.getStructsCacheDir(ctx.dumpname), os.F_OK):
os.mkdir(Config.getStructsCacheDir(ctx.dumpname))
# we use common allocators to find structures.
#log.debug('Reversing malloc')
#mallocRev = MallocReverser()
#ctx = mallocRev.reverse(ctx)
#mallocRev.check_inuse(ctx)
# try to find some logical constructs.
log.debug('Reversing DoubleLinkedListReverser')
doublelink = DoubleLinkedListReverser()
ctx = doublelink.reverse(ctx)
# decode bytes contents to find basic types.
log.debug('Reversing Fields')
fr = FieldReverser()
ctx = fr.reverse(ctx)
# identify pointer relation between structures
log.debug('Reversing PointerFields')
pfr = PointerFieldReverser()
ctx = pfr.reverse(ctx)
# graph pointer relations between structures
log.debug('Reversing PointerGraph')
ptrgraph = PointerGraphReverser()
ctx = ptrgraph.reverse(ctx)
ptrgraph._saveStructures(ctx)
#save to file
save_headers(ctx)
#fr._saveStructures(ctx)
##libRev = KnowStructReverser('libQt')
##ctx = libRev.reverse(ctx)
# we have more enriched context
# etc
except KeyboardInterrupt,e:
#except IOError,e:
log.warning(e)
log.info('[+] %d structs extracted'%( context.structuresCount()) )
raise e
pass
示例2: saveme
# 需要導入模塊: from haystack.config import Config [as 別名]
# 或者: from haystack.config.Config import getStructsCacheDir [as 別名]
def saveme(self):
if not self._dirty:
return
sdir = Config.getStructsCacheDir(self._context.dumpname)
if not os.path.isdir(sdir):
os.mkdir(sdir)
fname = makeFilename(self._context, self)
try:
# FIXME : loops create pickle loops
#print self.__dict__.keys()
pickle.dump(self, file(fname,'w'))
except RuntimeError,e:
log.error(e)
print self.toString()
示例3: saveme
# 需要導入模塊: from haystack.config import Config [as 別名]
# 或者: from haystack.config.Config import getStructsCacheDir [as 別名]
def saveme(self):
if not self._dirty:
return
sdir = Config.getStructsCacheDir(self._context.dumpname)
if not os.path.isdir(sdir):
os.mkdir(sdir)
fname = makeFilename(self._context, self)
try:
pickle.dump(self, file(fname,'w'))
except KeyboardInterrupt, e:
# clean it, its stale
os.remove(fname)
log.warning('removing %s'%(fname))
import sys
ex = sys.exc_info()
raise ex[1], None, ex[2]
示例4: makeFilename
# 需要導入模塊: from haystack.config import Config [as 別名]
# 或者: from haystack.config.Config import getStructsCacheDir [as 別名]
def makeFilename(context, st):
sdir = Config.getStructsCacheDir(context.dumpname)
if not os.path.isdir(sdir):
os.mkdir(sdir)
return os.path.sep.join([sdir, str(st)])