def getdevice(self, num, elapsed): didwait = False bb = BeachBall() try: for i in range(cfg.fw_delay - elapsed, 0, -1): print('[*] Initializing bus and enabling SBP-2, ' + 'please wait %2d seconds or press Ctrl+C\r' % i, end = '') # TODO: Use .format() sys.stdout.flush() bb.draw() didwait = True time.sleep(1) except KeyboardInterrupt: pass d = self._bus.devices()[num] d.open() if didwait: print() # Create a LF so that next print() will start on a new line return d
def getdevice(self, num, elapsed): didwait = False bb = BeachBall() try: for i in range(cfg.fw_delay - elapsed, 0, -1): print('[*] Initializing bus and enabling SBP-2, ' + 'please wait %2d seconds or press Ctrl+C\r' % i, end='') # TODO: Use .format() sys.stdout.flush() bb.draw() didwait = True time.sleep(1) except KeyboardInterrupt: pass d = self._bus.devices()[num] d.open() if didwait: print( ) # Create a LF so that next print() will start on a new line return d
def lurk(): start = cfg.startaddress end = cfg.memsize bb = BeachBall() try: s = '\n'.join(cfg.wrapper.wrap('[-] Lurking in the shrubbery waiting ' + 'for a device to connect. Ctrl-C to ' + 'abort')) + '\r' print(s, end = '') # Initiate FireWire fw = firewire.FireWire() while True: # Loop until aborted, and poll for devices while len(fw.devices) == 0: bb.draw() time.sleep(cfg.polldelay) pass # Do nothing until a device connects print() # Newline info('FireWire device detected') memdump.dump(start, end) except KeyboardInterrupt: print() # TODO: Fix keyboard handling (interrupt handling) raise KeyboardInterrupt