I want to turn on and off the internet access of a certain IP or MAC address in my network with Python. I researched, but mostly they are interested in getting rid of Mac filtering (Mac spoof). Is it possible to do this without using the router? Without using ARP poisoning, of course!
import wmi
import time
from datetime import datetime
def kontrol_zamani():
su_an = datetime.now()
gun_sonu = su_an.replace(hour=20, minute=0, second=0, microsecond=0)
gun_basi = su_an.replace(hour=16, minute=30, second=0, microsecond=0)
if gun_basi <= su_an <= gun_sonu:
return True
else:
return False
def wifi_kapat():
c = wmi.WMI()
for interface in c.Win32_NetworkAdapter():
if "Wireless" in interface.Name:
interface.Disable()
def wifi_ac():
c = wmi.WMI()
for interface in c.Win32_NetworkAdapter():
if "Wireless" in interface.Name:
interface.Enable()
while True:
if kontrol_zamani():
print("Wi-Fi erişimi aktif.")
wifi_ac()
else:
print("Wi-Fi erişimi kapalı.")
wifi_kapat()
time.sleep(60) # Her dakika kontrol etmek için