def __init__(self): ''' Constructor Initializes the bus and sets device, OUI variables ''' self._bus = Bus() try: self._bus.enable_sbp2() except IOError: poll('FireWire modules do not seem to be loaded. Load them? ' + '[Y/n]: ') answer = input().lower() if answer in ['y', '']: status = call('modprobe firewire-ohci', shell=True) if status == 0: try: self._bus.enable_sbp2() except IOError: time.sleep(2) # Give some more time self._bus.enable_sbp2() # If this fails, fail hard info('FireWire modules loaded successfully') else: fail('Could not load FireWire modules') else: fail('FireWire modules not loaded') # Enable SBP-2 support to ensure we get DMA self._devices = self._bus.devices() self._oui = self.init_OUI() self._vendors = [] self._max_request_size = cfg.PAGESIZE
def __init__(self, delay): ''' Constructor Initializes the bus and sets device, OUI variables ''' # Warn OS X users if cfg.os == cfg.OSX: term.warn('Attacking from OS X may cause host and/or target ' 'system crashes, and is not recommended') self.delay = delay self._bus = Bus() try: self._bus.enable_sbp2() except IOError as e: if os.geteuid() == 0: # Check if we are running as root answer = term.poll( 'FireWire modules are not loaded. Try ' 'loading them? [y/n]:', default='y') if answer in ['y', '']: status_modprobe = call('modprobe firewire-ohci', shell=True) status_rescan = call('echo 1 > /sys/bus/pci/rescan', shell=True) if status_modprobe == 0 and status_rescan == 0: try: self._bus.enable_sbp2() except IOError as e: time.sleep(2) # Give some more time try: self._bus.enable_sbp2() except IOError as e: raise InceptionException( 'Unable to detect any local FireWire ' 'ports.', e) term.info('FireWire modules loaded successfully') else: raise InceptionException( 'Could not load FireWire ' 'modules, try running ' 'inception as root', e) else: raise InceptionException('FireWire modules not loaded per ' 'user\'s request') else: raise InceptionException( 'FireWire modules are not loaded and ' 'we have insufficient privileges to ' 'load them. Try running inception as ' 'root', e) # Enable SBP-2 support to ensure we get DMA self._devices = self._bus.devices() self._oui = self.init_OUI() self._vendors = [] self._max_request_size = cfg.PAGESIZE
def __init__(self): ''' Constructor Initializes the bus and sets device, OUI variables ''' self._bus = Bus() try: self._bus.enable_sbp2() except IOError: if os.geteuid() == 0: # Check if we are running as root term.poll( 'FireWire modules are not loaded. Try loading them? [Y/n]: ' ) answer = input().lower() if answer in ['y', '']: status_modprobe = call('modprobe firewire-ohci', shell=True) status_rescan = call('echo 1 > /sys/bus/pci/rescan', shell=True) if status_modprobe == 0 and status_rescan == 0: try: self._bus.enable_sbp2() except IOError: time.sleep(2) # Give some more time try: self._bus.enable_sbp2( ) # If this fails, fail hard except IOError: term.fail( 'Unable to detect any local FireWire ports. Please make ' + 'sure FireWire is enabled in BIOS, and connected ' + 'to this system. If you are using an adapter, please make ' + 'sure it is properly connected, and re-run inception' ) term.info('FireWire modules loaded successfully') else: term.fail( 'Could not load FireWire modules, try running inception as root' ) else: term.fail('FireWire modules not loaded') else: term.fail( 'FireWire modules are not loaded and we have insufficient privileges ' + 'to load them. Try running inception as root') # Enable SBP-2 support to ensure we get DMA self._devices = self._bus.devices() self._oui = self.init_OUI() self._vendors = [] self._max_request_size = cfg.PAGESIZE