Initial commit
This commit is contained in:
commit
8c1653dc74
8
main.py
Executable file
8
main.py
Executable file
@ -0,0 +1,8 @@
|
||||
#! /usr/bin/python
|
||||
import packet_processer, reporter
|
||||
|
||||
def main():
|
||||
packet_processer.sniff("walfa0", 200)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
33
packet_processer.py
Normal file
33
packet_processer.py
Normal file
@ -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)
|
||||
|
||||
|
0
reporter.py
Normal file
0
reporter.py
Normal file
Loading…
Reference in New Issue
Block a user