Untitled
unknown
python
5 years ago
1.9 kB
8
Indexable
def MainLoop():
global tony
tag = False
while True:
mac = os.popen('arp-scan -l').read()
mac = str(mac)
date = os.popen('date').read()
mac_address = re.findall(r'[a-zA-Z0-9][a-zA-Z0-9]\:[a-zA-Z0-9][a-zA-Z0-9]\:[a-zA-Z0-9][a-zA-Z0-9]\:[a-zA-Z0-9][a-zA-Z0-9]\:[a-zA-Z0-9][a-zA-Z0-9]\:[a-zA-Z0-9][a-zA-Z0-9]', mac)
for i in mac_address:
if i not in known_MACs:
if i not in new_MACs:
new_MACs.append(i)
with open('list_MAC.txt', 'a') as file:
sys.stdout = file
print("ACTIVE MACs " + str(new_MACs) + " " + str(date))
print("UNKNOWN MAC added " + str(i) + " " + str(date))
file.close()
if tony in active_MACs:
print("tony in active_MACs")
if tonytag == False:
print("inside tonytag")
tonytag = True
with open('list_MAC.txt', 'a') as f:
sys.stdout = f
print("tony connected to your Access Point")
file.close()
print("open and closed file for tony")
# place for sending message to phone
time.sleep(1)
if tony in active_MACs:
if tony not in mac_address:
print("checking to see if tony is not in mac_address")
time.sleep(30)
mac = os.popen('arp-scan -l').read()
mac = str(mac)
print("did another arp scan")
if tony not in mac_address:
print("checking if tony inst in mac address again")
tonytag = False
active_MACs.remove(tony)
print("tony tag changed and removed from active_MACs")
MainLoop()Editor is loading...