I'm trying to make a project that scans for MAC addresses in my network and either allows them or ban them from my local network. I wrote this script to get familiar with the re and pynetgear module to accomplish this because I plan to use these addresses to store data to determine which device is which. Everything I've tried doesn't work or I tried looking up the problem on here and other resources but no one has helped me so far.
I've tried looking at documentation of regex but couldn't figure out what this problem is. The first code all the way up to Devices work its just MAC down that calls the TypeError.
from pynetgear import Netgear
import re
netgear = Netgear(password='password')
devices = netgear.get_attached_devices()
MAC = re.search(r"mac=..:..:..:..:..:..", devices)
print(MAC.group(0))
Traceback (most recent call last):
File "/home/z33k/Desktop/python/adhdResearch.py", line 8, in <module>
MAC = re.search(r"mac=..:..:..:..:..:..", devices)
File "/usr/lib/python2.7/re.py", line 146, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or buffer
devices?devices. Maybe the data you seek is already in a form you could use.print(type(devices))to see this