Exemplo n.º 1
0
    def __init__(self, max_number_sniffers=1, baudrate=115200, devices=None, v5=False):
        super().__init__(None)
        self.interfaces = []

        # Enumerate available interfaces
        self.devices = []
        if devices is None:
            for port in comports():
                if type(port) is tuple:
                    if "VID:PID=0d28:0204" in port[-1]:
                        self.devices.append(port[0])
                elif port.vid == 0x0D28 and port.pid == 0x0204:
                    self.devices.append(port.device)
        else:
            for device in devices:
                self.devices.append(device)

        # Cannot continue if no device is connected :/
        if len(self.devices) == 0:
            raise DeviceError("No compatible device found")

        #print('new sniffer, reset active link')
        self.active_link = None
        self.v5 = v5
        self.connect(max_number_sniffers, baudrate)
        self.reset()
Exemplo n.º 2
0
    def __init__(self, devices=None, baudrate=115200):
        super().__init__()

        # Pick first device as we don't need more
        if devices is not None:
            if len(devices) >= 1:
                self.interface = SingleSnifferInterface(devices[0], baudrate)
            else:
                raise DeviceError('No device provided')
        else:
            self.interface = SingleSnifferInterface()

        # reset interface
        self.interface.reset()

        # reset AA dictionary
        self.aad = {}
        self.interface.scan_access_addresses()