Beispiel #1
0
def send(raw_data):
    ip_id = randint(0, 65535)  # To simulate real packets
    handler_ip, self_ip, icmp_seq, icmp_id, timestamp = packet_info[
        0]  # extract the data from the packet that will be answered
    paylaod = timestamp + raw_data  # the payload starts with UNIX time to simulate real ping
    pkt = IP(dst=handler_ip, src=self_ip, id=ip_id) / ICMP(
        type="echo-reply", seq=icmp_seq, id=icmp_id) / Raw(paylaod)
    scapy_send(pkt, verbose=False)  # Make and send a Raw Packet
Beispiel #2
0
def send(raw_data):  # Networking Wrapper function needed for the handler
    sleep(delay_secs)  # Delay before next Ping
    ip_id = randint(
        0, 65535)  # Calculate random header values to simulate real packets
    payload = get_icmp_timestamp(
    ) + raw_data  # the payload starts with UNIX time to simulate real ping
    pkt = IP(dst=agent_address, id=ip_id, flags='DF') / ICMP(
        type="echo-request", id=icmp_id, seq=icmp_seq) / Raw(payload)
    scapy_send(pkt, verbose=False)  # Make and send a Raw Packet
Beispiel #3
0
def send(dest_ip, port, src_ip, payload, count=1):
    if dest_ip in ("127.0.0.1", "localhost"):
        conf.L3socket = L3RawSocket
    ip = IP(dst=dest_ip, src=src_ip)
    udp = UDP(dport=port)
    scapy_send(ip/udp/str(payload), count=count)
Beispiel #4
0
def send(dest_ip, port, src_ip, payload, count=1):
    if dest_ip in ("127.0.0.1", "localhost"):
        conf.L3socket = L3RawSocket
    ip = IP(dst=dest_ip, src=src_ip)
    udp = UDP(dport=port)
    scapy_send(ip / udp / str(payload), count=count)
Beispiel #5
0
	def send(self, hwsrc, psrc, pdst):
		if config.cfg.args.verbose:
			print "\n>>> to: %-15s > ARP %-15s who-has %s" % (psrc, pdst, hwsrc),

		packet = Ether()/ARP(op="who-has", hwsrc=hwsrc, psrc=psrc, pdst=pdst)
		scapy_send(packet, verbose=0)