def read(self, length):
     data, address = self.socket.recvfrom(length)
     logger.log_raw(
         f"{self.bind_ip}:{self.bind_port} < {address[0]}:{address[1]}",
         data.hex(),
     )
     return data
Exemple #2
0
 def read(self, length):
     data, address = self.socket.recvfrom(length)
     logger.log_raw(
         "{}:{} < {}:{}".format(self.bind_ip, self.bind_port, address[0],
                                address[1]),
         data.hex(),
     )
     return data
 def write(self, data):
     bytes_sent = self.socket.sendto(
         data, ((self.destination_ip, self.destination_port)))
     assert bytes_sent == len(data)
     logger.log_raw(
         f"{self.destination_ip}:{self.destination_port} < {self.bind_ip}:{self.bind_port}",
         data.hex(),
     )
Exemple #4
0
 def write(self, data):
     bytes_sent = self.socket.sendto(
         data, ((self.destination_ip, self.destination_port)))
     assert bytes_sent == len(data)
     logger.log_raw(
         "{}:{} < {}:{}".format(self.destination_ip, self.destination_port,
                                self.bind_ip, self.bind_port),
         data.hex(),
     )
Exemple #5
0
 def __uhid_write(self, data):
     bytes_written = os.write(self.file_descriptor, data)
     assert bytes_written == len(data)
     logger.log_raw("{} <".format(HIDInterface.uhid_device), data.hex())
Exemple #6
0
 def __uhid_read(self, length):
     data = os.read(self.file_descriptor, length)
     logger.log_raw("{} >".format(HIDInterface.uhid_device), data.hex())
     return data
Exemple #7
0
 def __uhid_read(self, length):
     data = os.read(self.file_descriptor, length)
     logger.log_raw(f"{HIDInterface.uhid_device} >", data.hex())
     return data