Ejemplo n.º 1
0
 def analyseGadgets(self, fileObject):
     gadgets = fileObject.gadgets
     analyser = Analyser()
     cb = None
     lg = len(gadgets)
     if self.__callbacks and hasattr(self.__callbacks, '__analyseGadgetsProgress__'):
         cb = self.__callbacks.__analyseGadgetsProgress__
     for i,g in enumerate(gadgets):
         g.info = analyser.analyse(g)
         if cb:
             cb(g, float(i)/lg)
     if cb:
          cb(None, 1.0)
     self.__saveCache(fileObject)
     fileObject.analysed = True
Ejemplo n.º 2
0
 def analyseGadgets(self, fileObject):
     gadgets = fileObject.gadgets
     analyser = Analyser()
     cb = None
     lg = len(gadgets)
     if self.__callbacks and hasattr(self.__callbacks, '__analyseGadgetsProgress__'):
         cb = self.__callbacks.__analyseGadgetsProgress__
     for i,g in enumerate(gadgets):
         g.info = analyser.analyse(g)
         if cb:
             cb(g, float(i)/lg)
     if cb:
          cb(None, 1.0)
     self.__saveCache(fileObject)
     fileObject.analysed = True
Ejemplo n.º 3
0
    rg_len = len(rg_gadgets)
    rp = True
    gadgets = rp_gadgets
    if rp_len < rg_len:
        gadgets = rg_gadgets
        rp = False
    rep = (len(gadgets) / 5000) + 1
    for r in xrange(rep):
        _map = dict()
        _map['PE_info'] = pe_info
        for gn, g in enumerate(gadgets[r * 5000:(r + 1) * 5000]):
            print '{} rep of {} - {} of 5000'.format(r, rep, gn)
            _g_dict = dict()
            if rp:
                _g_dict['Gadget'] = '{}'.format(g)
                g.info = analyser.analyse(g)
                _g_dict['spOffset'] = g.info.spOffset if g.info else 'undef'
                _map[g.address] = _g_dict
            else:
                g_addr = g['vaddr'] - pe_info['ImageBase']
                _g_dict['Gadget'] = '0x{:08x}: {}'.format(
                    g_addr, g['gadget'].replace(' ; ', '; '))
                analysis = ropper_analyser(g)
                _g_dict[
                    'spOffset'] = analysis.spOffset if analysis else 'undef'
                _map[g_addr] = _g_dict

        with open(
                os.path.join(
                    os.getcwd(),
                    OUTFILE_PATTERN.format(