def __init__(self, portnum=None, callbacks=[]): Notifications.Notifier.__init__(self, callbacks) self.portnum = portnum self.exit = False try: self.uart = UART.Uart(portnum) except serial.SerialException as e: logging.exception("Error opening UART.") self.uart = UART.Uart() self.packetCounter = 0 self.lastReceivedPacketCounter = 0 self.lastReceivedPacket = None
def get_interfaces(): if not hasattr(serial, "__version__") or not serial.__version__.startswith('3.'): raise RuntimeError( "Too old version of python 'serial' Library. Version 3 required.") devices = UART.find_sniffer( write_data=False) # Try non-intrusive search first if len(devices) == 0: devices = UART.find_sniffer(write_data=True) return devices
def setup(): global mySniffer # Find connected sniffers ports = UART.find_sniffer() if len(ports) > 0: # Initialize the sniffer on the first COM port found with baudrate 1000000. # If you are using an old firmware version <= 2.0.0, simply remove the baudrate parameter here. mySniffer = Sniffer.Sniffer(portnum=ports[0], baudrate=1000000) else: print("No sniffers found!") return # Start the sniffer module. This call is mandatory. mySniffer.start() # Wait to allow the sniffer to discover device mySniffer. time.sleep(5) # Retrieve list of discovered devicemySniffer. d = mySniffer.getDevices() # Find device with name "Example". dev = d.find('Example') if dev is not None: # Follow (sniff) device "Example". This call sends a REQ_FOLLOW command over UART. mySniffer.follow(dev) else: print("Could not find device")
def setup(): # Find connected sniffers ports = UART.find_sniffer() if len(ports) > 0: # Initialize the sniffer on the first port found with baudrate 1000000. # If you are using an old firmware version <= 2.0.0, simply remove the baudrate parameter here. sniffer = Sniffer.Sniffer(portnum=ports[0], baudrate=1000000) else: print("No sniffers found!") return sniffer.start() tls_dev_addr = [0xde, 0xde, 0x96, 0xdf, 0x92, 0x4a, True] for _ in range(10): time.sleep(1) devlist = sniffer.getDevices() found_dev = [ dev for dev in devlist.devices if dev.address == tls_dev_addr ] if found_dev: follow(sniffer, found_dev[0]) break
def get_baud_rates(interface): if not hasattr(serial, "__version__") or not serial.__version__.startswith('3.'): raise RuntimeError( "Too old version of python 'serial' Library. Version 3 required.") return UART.find_sniffer_baudrates(interface)
def get_interfaces(self): devices = UART.find_sniffer(write_data=False) return devices
def get_baud_rates(self, interface): return UART.find_sniffer_baudrates(interface)