feat(user/bkmpv2):Add bkshuf wrapper for mpv
[BK-2020-03.git] / unitproc / bkgenpass
CommitLineData
fdf917e1
SBS
1#!/bin/bash
2
3# 2019-08-23T00:36Z; baltakatei>
4
5# This bash script should prompt the user for a URL, email address,
6# user name, text notes, and then generate a password, push this
7# password into the x clipboard, and then save a text file containing
8# the prompted details. This script should be run by Debian-based
9# GNU/Linux machines owned by baltakatei.
10
11# This file by Steven Baltakatei Sandoval is licensed under CC BY-SA 4.0.
12
13# Ask user for registration fields
14echo "What is the URL for whose website you are registering? (omit https://)"
15read input_URL
16echo "input_URL is:"$input_URL
17
18echo "What is your email address?"
19read input_EMAIL
20echo "input_EMAIL is:"$input_EMAIL
21
22echo "What is your user name (if any)?"
23read input_USERNAME
24echo "input_USERNAME is:"$input_USERNAME
25
26echo "Notes?"
27read input_NOTE
28echo "input_NOTE is:"$input_NOTE
29
30# Determine long date
31LONGDATE=$(date +%Y%m%dT%H%M%S.%N%z)
32echo "Current time is:"$LONGDATE
33
34# Determine hostname
35HOSTNAME=$(hostname)
36echo "HOSTNAME is:"$HOSTNAME
37
38# Perform superstitious PRNG spells
39echo $LONGDATE$HOSTNAME > /dev/random
40echo $(cat /proc/sys/kernel/random/entropy_avail)" bits of entropy in /dev/random"
41
42# Determine random 128-bit entropy password
43PASS1=$(LC_ALL=C tr -dc "[:graph:]" < /dev/urandom | head -c ${1:-8})
44PASS2=$(LC_ALL=C tr -dc "[:graph:]" < /dev/urandom | head -c ${1:-8})
45PASS3=$(LC_ALL=C tr -dc "[:graph:]" < /dev/urandom | head -c ${1:-4})
46PASSPHRASE=$PASS1" "$PASS2" "$PASS3
47echo "PASSPHRASE is:"$PASSPHRASE
48
49# Print fields to temporary file
50#echo "PASSPHRASE="$PASSPHRASE >> $PATHFILENAME
51#echo "URL="$input_URL >> $PATHFILENAME
52#echo "EMAIL="$input_EMAIL >> $PATHFILENAME
53#echo "USERNAME="$input_USERNAME >> $PATHFILENAME
54#echo "NOTE="$input_NOTE >> $PATHFILENAME
55#echo "DATE="$LONGDATE >> $PATHFILE
56
57# Push passphrase to clipboard
58echo -n $PASSPHRASE | xclip -selection clipboard
59
60echo "Passphrase copied to clipboard via xclip."
61
62# Push passphrase to `pass`
63#printf "$PASSPHRASE\nURL=$input_URL\nEMAIL=$input_EMAIL\nUSERNAME=$input_USERNAME\nNOTE=$input_NOTE\nDATE=$LONGDATE\n" | pass insert -m 01\ Online\ Services/$input_URL
64
65echo "$PASSPHRASE
66URL=$input_URL
67EMAIL=$input_EMAIL
68USERNAME=$input_USERNAME
69NOTE=$input_NOTE
70DATE=$LONGDATE
71" | pass insert -m 01\ Online\ Services/$input_URL