Esempio n. 1
0
 def get_injectable_tracepoints(self, iid):
     payload = Payload()
     payload.put_u32('iid', iid)
     response = self.request('INJT', payload)
     for i in xrange(response.get('tptc', 0)):
         postfix = '[%i]' % i
         yield Tracepoint(response.get('tpta' + postfix), response.get('tpth' + postfix))
Esempio n. 2
0
 def iter_injectable_symbols(self, iid, which):
     if which not in 'EIA':
         raise ValueError
     payload = Payload()
     payload.put_u32('iid', iid)
     response = self.request('INJ' + which, payload)
     for i in xrange(response.get('symc', 0)):
         postfix = '[%i]' % i
         yield Symbol(response.get('symad' + postfix), response.get('symnm' + postfix))
Esempio n. 3
0
    def get_memory(self, pid):
        payload = Payload()
        payload.put_u32('pid', pid)
        response = self.request('MAPS', payload)

        def iter_segments():
            for i in xrange(response.get('segc', 0)):
                def get(what):
                    return response.get('seg{:}[{:}]'.format(what, i))
                yield get('lo'), get('hi'), get('type'), get('file'), get('off')
        return sorted(iter_segments())
Esempio n. 4
0
 def dump(self, pid, address, size):
     payload = Payload()
     payload.put_u32('pid', pid)
     payload.put_u64('address', address)
     payload.put_u32('size', size)
     response = self.request('MEMD', payload)
     words = (response.get('word[%i]' % x) for x in xrange(response.get('size', 0)))
     def tobytes(word):
         a = (word >> 24) & 0xff
         b = (word >> 16) & 0xff
         c = (word >> 8) & 0xff
         d = (word) & 0xff
         return ''.join(chr(x) for x in (d, c, b, a))
     bytes = (tobytes(x) for x in words)
     return ''.join(bytes)
Esempio n. 5
0
 def explain_address(self, pid, address):
     payload = Payload()
     payload.put_u32('pid', pid)
     payload.put_u64('address', address)
     return self.request('ADDR', payload)
Esempio n. 6
0
 def kill(self, pid):
     payload = Payload()
     payload.put_u32('pid', pid)
     return self.request('KILL', payload)
Esempio n. 7
0
 def injectable_unload(self, iid):
     payload = Payload()
     payload.put_u32('iid', iid)
     return self.request('INJU', payload)
Esempio n. 8
0
 def spawn(self, args):
     payload = Payload()
     payload.put_u32('argc', len(args))
     for i, v in enumerate(args):
         payload.put_str('argv[{:}]'.format(i), v)
     return self.request('SPWN', payload)
Esempio n. 9
0
 def detach(self, pid):
     payload = Payload()
     payload.put_u32('pid', pid)
     return self.request('DETC', payload)
Esempio n. 10
0
 def loglevel(self, loglevel):
     payload = Payload()
     payload.put_u32('loglevel', loglevel)
     return self.request('LLEV', payload)