Merge pull request #65 from KasperskyLab/dev
Adding Wi-Fi network priority
This commit is contained in:
commit
1f0a9e8c68
@ -92,7 +92,8 @@ class Network(object):
|
|||||||
net = {}
|
net = {}
|
||||||
for line in block.splitlines():
|
for line in block.splitlines():
|
||||||
if line and line != "}":
|
if line and line != "}":
|
||||||
key, val = line.strip().split("=")
|
if "priority=10" not in line.strip():
|
||||||
|
key, val = line.strip().split("=")
|
||||||
if key != "disabled":
|
if key != "disabled":
|
||||||
net[key] = val.replace("\"", "")
|
net[key] = val.replace("\"", "")
|
||||||
networks.append(net)
|
networks.append(net)
|
||||||
@ -100,13 +101,15 @@ class Network(object):
|
|||||||
for net in networks:
|
for net in networks:
|
||||||
if net["ssid"] == ssid:
|
if net["ssid"] == ssid:
|
||||||
net["psk"] = password.replace('"', '\\"')
|
net["psk"] = password.replace('"', '\\"')
|
||||||
|
net["priority"] = "10"
|
||||||
found = True
|
found = True
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
networks.append({
|
networks.append({
|
||||||
"ssid": ssid,
|
"ssid": ssid,
|
||||||
"psk": password.replace('"', '\\"'),
|
"psk": password.replace('"', '\\"'),
|
||||||
"key_mgmt": "WPA-PSK"
|
"key_mgmt": "WPA-PSK",
|
||||||
|
"priority": "10"
|
||||||
})
|
})
|
||||||
|
|
||||||
with open("/etc/wpa_supplicant/wpa_supplicant.conf", "w+") as f:
|
with open("/etc/wpa_supplicant/wpa_supplicant.conf", "w+") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user