Reports mac address now.

This commit is contained in:
Tristan Smith 2024-05-30 15:00:20 -04:00
parent f7962edfa9
commit 39e6a8ec5a

View file

@ -1,4 +1,4 @@
from scapy.all import IP, UDP, sniff from scapy.all import IP, UDP, Ether, sniff
# Define the destination IP address and UDP ports to filter # Define the destination IP address and UDP ports to filter
destination_ip = '255.255.255.255' # Destination IP address destination_ip = '255.255.255.255' # Destination IP address
@ -17,9 +17,13 @@ def extract_packet_info(packet):
if (packet[IP].dst == destination_ip and if (packet[IP].dst == destination_ip and
udp_source_port == source_port and udp_source_port == source_port and
udp_destination_port == destination_port): udp_destination_port == destination_port):
print("Miner IP:", source_ip) # Extract and print the MAC address from the Ethernet layer
#print("UDP Source Port:", udp_source_port) source_mac = packet[Ether].src
#print("UDP Destination Port:", udp_destination_port) print(f"Miner IP: {source_ip}")
print(f"Source MAC Address: {source_mac}")
#print(f"UDP Source Port: {udp_source_port}")
#print(f"UDP Destination Port: {udp_destination_port}")
print("-" * 40)
def listen_for_packets(): def listen_for_packets():
# Sniff network traffic and invoke the callback function for each packet # Sniff network traffic and invoke the callback function for each packet