From 8c1653dc74ae939faa6c7e6b94db8f2096d373d7 Mon Sep 17 00:00:00 2001 From: Michael Scalzetti Date: Tue, 25 Oct 2022 21:11:45 -0400 Subject: [PATCH] Initial commit --- main.py | 8 ++++++++ packet_processer.py | 33 +++++++++++++++++++++++++++++++++ reporter.py | 0 3 files changed, 41 insertions(+) create mode 100755 main.py create mode 100644 packet_processer.py create mode 100644 reporter.py diff --git a/main.py b/main.py new file mode 100755 index 0000000..110b638 --- /dev/null +++ b/main.py @@ -0,0 +1,8 @@ +#! /usr/bin/python +import packet_processer, reporter + +def main(): + packet_processer.sniff("walfa0", 200) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/packet_processer.py b/packet_processer.py new file mode 100644 index 0000000..be1b1b4 --- /dev/null +++ b/packet_processer.py @@ -0,0 +1,33 @@ +import pcap, dpkt +from scapy.all import Ether, ARP +from time import sleep + +def process_packet(info, timestamp, packet): + src = packet.src + dst = packet.dst + print(f"{timestamp} | {src}[{1 if is_ap(src) else 0}] --> {packet.dst}[{1 if is_ap(dst) else 0}]") + #packet.display() + #sleep(.5) + +def get_scapy_packet(raw_packet): + eth_frame = dpkt.ethernet.Ethernet(raw_packet) + + return Ether(raw_packet) + +def is_ap(mac_address): + aruba_ouis = ['94:60:D5', '48:2F:6B', '94:64:24', 'A8:5B:F7', 'F0:61:C0', 'EC:50:AA', '6C:C4:9F'] + for oui in aruba_ouis: + if oui in mac_address: + return True + return False + +def sniff(interface, timeout_ms=500): + info = {} + + sniff = pcap.pcap(name=interface, promisc=True, timeout_ms=timeout_ms) + + for timestamp, raw_packet in sniff: + packet = get_scapy_packet(raw_packet) + info = process_packet(info, timestamp, packet) + + diff --git a/reporter.py b/reporter.py new file mode 100644 index 0000000..e69de29