Fix brainfart

This commit is contained in:
Niller303
2018-03-20 15:43:07 +01:00
committed by GitHub
parent c7a952b3df
commit 0de54db1ec

View File

@@ -63,22 +63,18 @@ class Airmon(object):
@staticmethod @staticmethod
def start_baddriver(iface): #fix for bad drivers like the rtl8812AU def start_baddriver(iface): #fix for bad drivers like the rtl8812AU
os.system("ifconfig %s down; iwconfig %s mode monitor; ifconfig %s up" % (iface, iface, iface)) os.system("ifconfig %s down; iwconfig %s mode monitor; ifconfig %s up" % (iface, iface, iface))
#You cannot trust the output of the rtl8812AU with open("/sys/class/net/" + iface + "/type", "r") as f:
#it says that interface 10 is the monitor interface, it isn't. if (int(f.read()) == Airmon.ARPHRD_IEEE80211_RADIOTAP):
#its actually just the same name, but lets not trust it anyway return iface
for x in os.listdir("/sys/class/net/."):
with open("/sys/class/net/" + x + "/type", "r") as f:
if (int(f.read()) == Airmon.ARPHRD_IEEE80211_RADIOTAP):
return x
return None return None
@staticmethod @staticmethod
def stop_baddriver(iface): def stop_baddriver(iface):
os.system("ifconfig %s down; iwconfig %s mode managed; ifconfig %s up" % (iface, iface, iface)) os.system("ifconfig %s down; iwconfig %s mode managed; ifconfig %s up" % (iface, iface, iface))
with open("/sys/class/net/" + iface + "/type", "r") as f: with open("/sys/class/net/" + iface + "/type", "r") as f:
if (int(f.read()) == Airmon.ARPHRD_ETHER): if (int(f.read()) == Airmon.ARPHRD_ETHER):
return iface return iface
return None return None