Begin ssh script
This commit is contained in:
@@ -71,6 +71,8 @@ bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
|
||||
|
||||
bindkey '^[[P' delete-char
|
||||
|
||||
setxkbmap gb
|
||||
|
||||
# Edit line in vim with ctrl-e:
|
||||
autoload edit-commandd-line; zle -N edit-command-line
|
||||
bindkey '^e' edit-command-line
|
||||
|
||||
@@ -6,5 +6,3 @@ read -n 1 -r -s -p $'Press enter when you have synced enpass...\n'
|
||||
|
||||
export MASTERPW=$(dialog --no-cancel --passwordbox "Enter Enpass master password." 10 60 3>&1 1>&2 2>&3 3>&1)
|
||||
|
||||
LABSPW=$(enpasscli -vault/home/chris/Documents/Enpass/Vaults/Primary -sort show "Scarif: Labs" 2>&1 | awk '{print $NF}')
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
LABS=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/Primary" -sort show "Scarif: Labs" 2>&1)
|
||||
LABSUN=$(echo "$LABS" | grep -Po "(?<=login: )\w+")
|
||||
LABSPW=$(echo "$LABS" | grep -Po "(?<=pass : ).+(?=\")")
|
||||
|
||||
SSHPATH="$HOME/.ssh/id_ed25519"
|
||||
|
||||
ssh-keygen -t ed25519 -f "$SSHPATH" -N "" -q
|
||||
|
||||
generate_post_data() {
|
||||
cat <<EOF
|
||||
{
|
||||
"key": "$(cat "$SSHPATH.pub")",
|
||||
"read_only": false,
|
||||
"title": "$USER@$(cat /etc/hostname)"
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
CREDENTIALS=$(echo "$LABSUN:$LABSPW" | base64)
|
||||
|
||||
curl --request POST \
|
||||
-s \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type:application/json" \
|
||||
--data "$(generate_post_data)" \
|
||||
--url "https://$CREDENTIALS@labs.scarif.space/api/v1/users/$LABSUN/keys"
|
||||
|
||||
22
.local/bin/sysact
Executable file
22
.local/bin/sysact
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A dmenu wrapper script for system functions.
|
||||
|
||||
# For non-systemd init systems.
|
||||
case "$(readlink -f /sbin/init)" in
|
||||
*runit*) hib="sudo -A zzz" ;;
|
||||
*openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p 0" ;;
|
||||
esac
|
||||
|
||||
cmds="\
|
||||
🔒 lock slock
|
||||
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
||||
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
||||
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
|
||||
🔃 reboot ${reb:-sudo -A reboot}
|
||||
🖥 shutdown ${shut:-sudo -A shutdown -h now}
|
||||
📺 display off xset dpms force off"
|
||||
|
||||
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
||||
|
||||
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|
||||
Reference in New Issue
Block a user