dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit efddb855ddac608d4d16cd5bf01843b4826bdefa
parent d57dee04fdc2a2fbf04792d486f08c7942ceaaa9
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sun,  5 May 2019 16:54:25 +0200

pwnedpass

Check whether a password has been pwned, and how many times.


Former-commit-id: f0bb8752aa9f24124f745f0dcf2ef3ddf6715313
Diffstat:
MREADME.md | 1+
Ascripts/pwnedpass | 9+++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -27,6 +27,7 @@ If you read a script and see some improvements that could be made, let me know. * `pass-import-txt`: imports passwords into `pass` from a text file that's formatted as `username:password` (newline-separated) * `percerr.rb`: a very simple thing for calculating percent error. Just run the Ruby script. * `play`: a command-line music player. Shows album art, or a visualiser if there is no album art. Set a $MUSIC_DIR in your profile, then run `play`. +* `pwnedpass`: test a password against the pwned passwords database, uses k-anonymity * `radio`: a command-line radio player, can play various music streams from the internet, including subreddits. Also has a visualiser, turn it on by passing `-v` on startup. * `rplayer`: a command-line subreddit player. Enter any subreddit that has music, and it'll play all of the links using `mpv` (except for Spotify). * `smack.pl`: change macos spaces by smacking the side of your screen (if you have a laptop). Yeah, like physically. diff --git a/scripts/pwnedpass b/scripts/pwnedpass @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +echo -n "pass> " +read -r -s pass_str +sha1=$(echo -n "$pass_str" | tr -d '\n' | shasum -a 1) +echo +echo "Hash prefix: ${sha1:0:5}" +echo "Hash suffix: ${sha1:5:35}" +result=$(curl https://api.pwnedpasswords.com/range/"${sha1:0:5}" 2>/dev/null | grep -i "${sha1:5:35}") +echo "Count: ${result#*:}"