Beispiel #1
0
def playback_packets_to_server(capfile, server_ip, server_port):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.connect((server_ip, int(server_port)))
    for packet in capfile.packets:
        print packet.packet_len
        print packet.packet
        print to_hex(packet.raw()[_UDP_HEADER_LEN:])
        s.send(packet.raw()[_UDP_HEADER_LEN:])
Beispiel #2
0
 def log_receive(self, binary, ip, port):
     logger.debug("Trying to read %d bytes: %s from %s:%s over %s" %
                  (len(binary), to_hex(binary), ip, port,
                   self._transport_layer_name))
Beispiel #3
0
 def log_send(self, binary, ip, port):
     logger.debug("Send %d bytes: %s to %s:%s over %s" %
                  (len(binary), to_hex(binary), ip, port,
                   self._transport_layer_name))
Beispiel #4
0
 def log_receive(self, binary, ip, port):
     logger.debug("Trying to read %d bytes: %s from %s:%s over %s" % (len(binary), to_hex(binary), ip, port, self._transport_layer_name))
Beispiel #5
0
 def log_send(self, binary, ip, port):
     logger.debug("Send %d bytes: %s to %s:%s over %s" % (len(binary), to_hex(binary), ip, port, self._transport_layer_name))