diff options
author | Ranieri Althoff | 2021-02-09 14:40:42 +0100 |
---|---|---|
committer | Ranieri Althoff | 2021-02-09 14:40:42 +0100 |
commit | 9471c3c8881f0c0961e00950d9c5752212da3c66 (patch) | |
tree | 9e2045366f23c87060c37d78303c7dbadad15f6b | |
parent | 5c75617725b61b2679ec85ec95733b1f00f65fca (diff) | |
download | aur-9471c3c8881f0c0961e00950d9c5752212da3c66.tar.gz |
upgpkg: wpa-psk 0.3.0-1
upstream release
Log errors to stderr and handle SIGINT
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | wpa-psk.py | 12 |
3 files changed, 13 insertions, 7 deletions
@@ -1,13 +1,13 @@ pkgbase = wpa-psk pkgdesc = Generate a WPA PSK from an ASCII passphrase for a SSID - pkgver = 0.2.0 + pkgver = 0.3.0 pkgrel = 1 url = https://aur.archlinux.org/packages/wpa-psk arch = any license = MIT depends = python source = wpa-psk.py - sha256sums = 61e387b8af78d4aad16c2b8727008982e987a694e31c4f3814ef422e045f4b09 + sha256sums = 706e15e85519e6013beb66895ec9f1e18e0c09319a7fc1d34a8b196c927e7e9a pkgname = wpa-psk @@ -1,6 +1,6 @@ # Maintainer: Ranieri Althoff <@domain.com> pkgname=wpa-psk -pkgver=0.2.0 +pkgver=0.3.0 pkgrel=1 pkgdesc='Generate a WPA PSK from an ASCII passphrase for a SSID' arch=('any') @@ -8,7 +8,7 @@ url="https://aur.archlinux.org/packages/$pkgname" license=('MIT') depends=('python') source=("$pkgname.py") -sha256sums=('61e387b8af78d4aad16c2b8727008982e987a694e31c4f3814ef422e045f4b09') +sha256sums=('706e15e85519e6013beb66895ec9f1e18e0c09319a7fc1d34a8b196c927e7e9a') package() { install -Dm755 "$srcdir/$pkgname.py" "$pkgdir/usr/bin/$pkgname" diff --git a/wpa-psk.py b/wpa-psk.py index 0881ae30a416..9089cafc79c7 100644 --- a/wpa-psk.py +++ b/wpa-psk.py @@ -4,6 +4,12 @@ import sys from argparse import ArgumentParser from getpass import getpass from hashlib import pbkdf2_hmac +from signal import signal, SIGINT + +def die(*_, **__): + sys.exit() + +signal = signal(SIGINT, die) iwd = """[Security] PreSharedKey={psk}""" @@ -35,14 +41,14 @@ parser.add_argument( args = parser.parse_args() if not args.passphrase: - print("# reading passphrase from stdin") + print("# reading passphrase from stdin", file=sys.stderr) args.passphrase = getpass(prompt="") if not 8 <= len(args.passphrase) <= 63: - print("Passphrase must be 8..63 characters") + print("Passphrase must be 8..63 characters", file=sys.stderr) sys.exit(1) passphrase = args.passphrase.encode() if any(b < 32 or b == 127 for b in passphrase): - print("Invalid passphrase character") + print("Invalid passphrase character", file=sys.stderr) sys.exit(1) ssid = args.ssid.encode() |