當前位置: 首頁>>代碼示例>>Python>>正文


Python Config.getStructsCacheDir方法代碼示例

本文整理匯總了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
開發者ID:Macdawr,項目名稱:python-haystack,代碼行數:52,代碼來源:reversers.py

示例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()
開發者ID:Macdawr,項目名稱:python-haystack,代碼行數:16,代碼來源:structure.py

示例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]
開發者ID:f9tech,項目名稱:twiler-site-packages,代碼行數:18,代碼來源:structure.py

示例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)])
開發者ID:Macdawr,項目名稱:python-haystack,代碼行數:7,代碼來源:structure.py


注:本文中的haystack.config.Config.getStructsCacheDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。