remove useless arguments in getWPAPassphraseHash
This commit is contained in:
parent
d0b0ba634b
commit
955b38c6f3
@ -13,8 +13,7 @@ def getUsername(username, gecos = True, passwd = "/etc/passwd"):
|
|||||||
|
|
||||||
def getWPAPassphraseHash(ssid, passphrase):
|
def getWPAPassphraseHash(ssid, passphrase):
|
||||||
if len(passphrase) >= 8:
|
if len(passphrase) >= 8:
|
||||||
cmds = ["wpa_passphrase", ssid, passphrase, "|", "grep", "-E", "'^\s*psk.*'", "|", "cut", "-d=", "-f2"]
|
proc = subprocess.Popen(["wpa_passphrase", ssid, passphrase], stdout=subprocess.PIPE)
|
||||||
proc = subprocess.Popen(cmds, stdout=subprocess.PIPE)
|
|
||||||
proc.wait()
|
proc.wait()
|
||||||
for line in proc.stdout.readlines():
|
for line in proc.stdout.readlines():
|
||||||
match = re.match("^\s*psk.*$", line.decode("utf-8"))
|
match = re.match("^\s*psk.*$", line.decode("utf-8"))
|
||||||
@ -22,3 +21,6 @@ def getWPAPassphraseHash(ssid, passphrase):
|
|||||||
return match.string.split("=")[1].strip()
|
return match.string.split("=")[1].strip()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(getWPAPassphraseHash("MySSID", "MySecurePassword"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user