def send_arp_packet(self, iface, dest_ip, source_ip=None, command='request', source_mac=None, dest_mac=None, packet_options=None, count=1): tcps = TCPSender() opt_map = {'command': command} if source_mac is not None: opt_map = {'smac': source_mac} if dest_mac is not None: opt_map = {'tmac': dest_mac} if source_ip is not None: opt_map = {'sip': source_ip} if dest_ip is not None: opt_map = {'tip': dest_ip} opt_map += packet_options return tcps.send_packet(self.cli, interface=iface, dest_ip=dest_ip, packet_type='arp', packet_options=opt_map, count=count)
def send_tcp_packet(self, iface, dest_ip, source_port, dest_port, packet_options=None, count=1): tcps = TCPSender() return tcps.send_packet(self.cli, interface=iface, dest_ip=dest_ip, packet_type='tcp', source_port=source_port, dest_port=dest_port, packet_options=packet_options, count=count)
def send_custom_packet(self, iface, **kwargs): tcps = TCPSender() return tcps.send_packet(self.cli, interface=iface, **kwargs)