DEV Community

Lyle Olsen
Lyle Olsen

Posted on

Showing Intruders with Python

Well that took longer than expected.
Remember his to do things in python wasn’t to bad, not was scanning the network for unknown MAC addresses. The hardest part for me was sending the message to my discord server.

To get the MAC address I had to run the script as root. But that way the web-hooks wouldn’t work. So if I just ran the script in normal python mode the web-hooks would work but the MAC address would come through. It was all very frustrating.

But I finally figured it out. Instead of getting the MAC addresses through nmap, it had to grab all the IP addresses nmap saw and then use arp call on the IP to get the MAC. It's not exactly how I want it to work, it's slower than just using nmap to get them, but hey this is the only way I could get both parts working consistently.

Alt Text

Is this a perfect solution? Far from it. I'm sure there's better ways to do this but for my purposes, learning and not having a ton of time, it works for me.

Alt Text

If you're interested here's the link to the repo. I'm open to suggestions if you have any ideas to make it better!

https://gitlab.com/keskidev/tabatha

Top comments (0)