mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-18 18:07:45 +01:00
change password config script
This commit is contained in:
47
home.admin/config.scripts/blitz.setpassword.sh
Normal file
47
home.admin/config.scripts/blitz.setpassword.sh
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# command info
|
||||||
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
|
echo "small config script to set a passwords A,B,C & D"
|
||||||
|
echo "blitz.setpassword.sh [?a|b|c|d] [?newpassword]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 1. parameter [?a|b|c|d]
|
||||||
|
abcd=$1
|
||||||
|
|
||||||
|
# 2. parameter [?newpassword]
|
||||||
|
newPassword=$2
|
||||||
|
|
||||||
|
# run interactive if no further parameters
|
||||||
|
if [ ${#abcd} -eq 0 ]; then
|
||||||
|
OPTIONS+=(A "Master User Password / SSH" \
|
||||||
|
B "RPC Password (blockchain/lnd)" \
|
||||||
|
C "LND Wallet Password" \
|
||||||
|
D "LND Seed Password" )
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "$BACKTITLE" \
|
||||||
|
--title "$TITLE" \
|
||||||
|
--menu "$MENU" \
|
||||||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||||
|
"${OPTIONS[@]}" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
clear
|
||||||
|
case $CHOICE in
|
||||||
|
A)
|
||||||
|
abcd='a';
|
||||||
|
;;
|
||||||
|
B)
|
||||||
|
abcd='b';
|
||||||
|
;;
|
||||||
|
C)
|
||||||
|
abcd='c';
|
||||||
|
;;
|
||||||
|
D)
|
||||||
|
abcd='d';
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Changing '${abcd}' ..."
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
# parameter #1: old password c to unlock wallet
|
|
||||||
# parameter #2: new password c
|
|
||||||
import base64, codecs, json, requests, sys
|
|
||||||
url = 'https://localhost:8080/v1/changepassword'
|
|
||||||
cert_path = '/mnt/hdd/lnd/tls.cert'
|
|
||||||
data = {
|
|
||||||
'current_password': base64.b64encode(sys.argv[1]).decode(),
|
|
||||||
'new_password' : base64.b64encode(sys.argv[2]).decode()
|
|
||||||
}
|
|
||||||
r = requests.post(url, verify=cert_path, data=json.dumps(data))
|
|
||||||
print(r.json())
|
|
||||||
Reference in New Issue
Block a user