From 955b38c6f308511006394c6edb9fc202a293f19a Mon Sep 17 00:00:00 2001 From: valeth Date: Thu, 21 Apr 2016 22:18:14 +0200 Subject: [PATCH] remove useless arguments in getWPAPassphraseHash --- pythonx/ultisnips/all.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pythonx/ultisnips/all.py b/pythonx/ultisnips/all.py index c6f718b..bdd6223 100644 --- a/pythonx/ultisnips/all.py +++ b/pythonx/ultisnips/all.py @@ -13,8 +13,7 @@ def getUsername(username, gecos = True, passwd = "/etc/passwd"): def getWPAPassphraseHash(ssid, passphrase): if len(passphrase) >= 8: - cmds = ["wpa_passphrase", ssid, passphrase, "|", "grep", "-E", "'^\s*psk.*'", "|", "cut", "-d=", "-f2"] - proc = subprocess.Popen(cmds, stdout=subprocess.PIPE) + proc = subprocess.Popen(["wpa_passphrase", ssid, passphrase], stdout=subprocess.PIPE) proc.wait() for line in proc.stdout.readlines(): match = re.match("^\s*psk.*$", line.decode("utf-8")) @@ -22,3 +21,6 @@ def getWPAPassphraseHash(ssid, passphrase): return match.string.split("=")[1].strip() return "" +if __name__ == "__main__": + print(getWPAPassphraseHash("MySSID", "MySecurePassword")) +