Update network.py
This commit is contained in:
parent
98bd7bab1a
commit
4b9413ba37
@ -344,14 +344,17 @@ class Network(object):
|
|||||||
Deduce the channel to have for the AP in order to prevent
|
Deduce the channel to have for the AP in order to prevent
|
||||||
kind of jamming between the two wifi interfaces.
|
kind of jamming between the two wifi interfaces.
|
||||||
"""
|
"""
|
||||||
if self.iface_out[0] == "w":
|
try:
|
||||||
# Get the channel of the connected interface
|
if self.iface_out[0] == "w":
|
||||||
sh = sp.Popen(["iw", self.iface_out, "info"],
|
# Get the channel of the connected interface
|
||||||
stdout=sp.PIPE, stderr=sp.PIPE).communicate()
|
sh = sp.Popen(["iw", self.iface_out, "info"],
|
||||||
res = re.search("channel ([0-9]{1,2})", sh[0].decode('utf8'))
|
stdout=sp.PIPE, stderr=sp.PIPE).communicate()
|
||||||
chn = res.group(1)
|
res = re.search("channel ([0-9]{1,2})", sh[0].decode('utf8'))
|
||||||
|
chn = res.group(1)
|
||||||
|
|
||||||
# Return a good candidate.
|
# Return a good candidate.
|
||||||
return "11" if int(chn) < 7 else "1"
|
return "11" if int(chn) < 7 else "1"
|
||||||
else:
|
else:
|
||||||
|
return "1"
|
||||||
|
except:
|
||||||
return "1"
|
return "1"
|
||||||
|
Loading…
Reference in New Issue
Block a user