예제 #1
0
def printdetails(target): # TODO: Fix this fugly method
    '''
    Prints details about a target
    '''
    term.info('The target module contains the following signatures:')
    term.separator()
    print('\tVersions:\t' + ', '.join(target['versions']).rstrip(', '))
    print('\tArchitectures:\t' + ', '
          .join(target['architectures']).rstrip(', '))
    for signature in target['signatures']:
        offsets = '\n\t\tOffsets:\t'
        for offset in signature['offsets']:
            offsets += hex(offset)
            if not offset is signature['offsets'][-1]: offsets += ', '
        print(offsets)
        sig = '\t\tSignature:\t0x'
        ioffs = 0
        patch = 0
        poffs = 0
        for chunk in signature['chunks']:
            diff = chunk['internaloffset'] - util.bytelen(chunk['chunk']) - 1 - ioffs
            sig += '__' * diff
            ioffs = chunk['internaloffset']
            sig += '{0:x}'.format(chunk['chunk'])
            try:
                patch = chunk['patch']
                poffs = chunk['patchoffset']
            except KeyError: pass
        print(sig)
        print('\t\tPatch:\t\t{0:#x}'.format(patch))
        print('\t\tPatch offset:\t{0:#x}'.format(poffs))
        
    term.separator()
예제 #2
0
 def businfo(self):
     '''
     Prints all available information of the devices connected to the FW
     bus, looks up missing vendor names & populates the internal vendor
     list
     '''
     if not self._devices:
         term.fail(
             'Could not detect any FireWire devices connected to this system'
         )
     term.info('FireWire devices on the bus (names may appear blank):')
     term.separator()
     for n, device in enumerate(self._devices, 1):
         vid = device.vendor_id
         # In the current version of libforensic1394, the
         # device.vendor_name.decode() method cannot be trusted (it often
         # returns erroneous data. We'll rely on OUI lookups instead
         # vendorname = device.vendor_name.decode(cfg.encoding)
         vendorname = self.resolve_oui(vid)
         self._vendors.append(vendorname)
         pid = device.product_id
         productname = device.product_name.decode(cfg.encoding)
         term.info('Vendor (ID): {0} ({1:#x}) | Product (ID): {2} ({3:#x})'.
                   format(vendorname, vid, productname, pid),
                   sign=n)
     term.separator()
예제 #3
0
def list_targets(targets, details=False):
    term.info('Available targets:')
    term.separator()
    for number, target in enumerate(targets, 1):
                term.info(target['OS'] + ': ' + target['name'], sign = number)
                if details:
                    printdetails(target)
    if not details: # Avoid duplicate separator
        term.separator()
예제 #4
0
파일: firewire.py 프로젝트: npk/inception
 def businfo(self):
     '''
     Prints all available information of the devices connected to the FW
     bus, looks up missing vendor names & populates the internal vendor
     list
     '''
     if not self._devices:
         term.fail('No FireWire devices detected on the bus')
     term.info('FireWire devices on the bus (names may appear blank):')
     term.separator()
     for n, device in enumerate(self._devices, 1):
         vid = device.vendor_id
         vendorname = device.vendor_name.decode(cfg.encoding)
         # Resolve if name not given by device vendor ID
         if not vendorname:
             vendorname = self.resolve_oui(vid) 
         self._vendors.append(vendorname)
         pid = device.product_id
         productname = device.product_name.decode(cfg.encoding)
         term.info('Vendor (ID): {0} ({1:#x}) | Product (ID): {2} ({3:#x})'
                   .format(vendorname, vid, productname, pid), sign = n)
     term.separator()
예제 #5
0
파일: firewire.py 프로젝트: a-ha/inception
 def businfo(self):
     '''
     Prints all available information of the devices connected to the FW
     bus, looks up missing vendor names & populates the internal vendor
     list
     '''
     if not self._devices:
         term.fail('No FireWire devices detected on the bus')
     term.info('FireWire devices on the bus (names may appear blank):')
     term.separator()
     for n, device in enumerate(self._devices, 1):
         vid = device.vendor_id
         # In the current version of libforensic1394, the 
         # device.vendor_name.decode() method cannot be trusted (it  ofen
         # returns erroneous data. We'll rely on OUI lookups instead
         # vendorname = device.vendor_name.decode(cfg.encoding)
         vendorname = self.resolve_oui(vid)
         self._vendors.append(vendorname)
         pid = device.product_id
         productname = device.product_name.decode(cfg.encoding)
         term.info('Vendor (ID): {0} ({1:#x}) | Product (ID): {2} ({3:#x})'
                   .format(vendorname, vid, productname, pid), sign = n)
     term.separator()