diff --git a/bin/.bin/albumDuration b/bin/.bin/albumDuration index 8d512b5d..73ad14c9 100755 --- a/bin/.bin/albumDuration +++ b/bin/.bin/albumDuration @@ -1,7 +1,7 @@ #!/usr/bin/env bash shopt -s nullglob let playlist_duration_ms=0 -for song_file in *.{mp3,ogg,m4a,flac,wav}; do +for song_file in */*.{mp3,ogg,m4a,flac,wav}; do playlist_duration_ms=$(expr $playlist_duration_ms + $(mediainfo --Inform="Audio;%Duration%" "$song_file")) done shopt -u nullglob diff --git a/bin/.bin/compiler b/bin/.bin/compiler index 45fc0805..6e0e4674 100755 --- a/bin/.bin/compiler +++ b/bin/.bin/compiler @@ -12,18 +12,17 @@ # config.h files: (For suckless utils) recompiles and installs program. # all others: run `sent` to show a presentation -echo "$1" -file=$(readlink -f "$1") -dir=$(dirname "$file") +file="$(readlink -f "$1")" +dir="$(dirname "$file")" base="${file%.*}" -shebang=$(sed -n 1p "$file") +shebang="$(sed -n 1p "$file")" cd "$dir" || exit textype() { \ - command="pdflatex" - ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" - $command --output-directory="$dir" "$file" + command="latexmk -pdf" + ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="latexmk -pdfxe" + $command -output-directory="$dir" "$file" #grep -i addbibresource "$file" >/dev/null && #biber --input-directory "$dir" "$base" && #$command --output-directory="$dir" "$base" && @@ -36,7 +35,7 @@ mdtype(){ \ case "$command" in "fplreport") pandoc "$file" --metadata-file="$HOME/.pandoc/defaults.yaml" --template fellowship.latex --pdf-engine=xelatex -o "${base}.pdf" ;; "letter") pandoc "$file" --metadata-file="$HOME/.pandoc/defaults.yaml" --template template-letter.tex -o "${base}.pdf" ;; - *) pandoc "$file" -f markdown+pipe_tables --metadata-file="$HOME/.pandoc/defaults.yaml" -o "$base".pdf ;; + *) pandoc "$file" -f markdown+pipe_tables --metadata-file="$HOME/.pandoc/defaults.yaml" -o "$base".pdf ;; esac } @@ -60,7 +59,7 @@ case "$file" in *\.c) cc "$file" -o "$base" && "$base" ;; *\.py) python "$file" ;; *\.js) cat "$file" | minify --js > "${base}.min.js" ;; - *\.less) lessc --clean-css "$file" "${base}.min.css" ;; + *\.less) lessc --clean-css -x "$file" "${base}.min.css" ;; #*\.less) lessc "$file" "${base}.css" ;; #*\.go) go run "$file" ;; #*) shebangtest ;; diff --git a/bin/.bin/dmenu/password-manager b/bin/.bin/dmenu/password-manager index bf79f00d..2d6a28ef 100755 --- a/bin/.bin/dmenu/password-manager +++ b/bin/.bin/dmenu/password-manager @@ -31,7 +31,7 @@ function type_password(){ # Then revert back to colemak setxkbmap -layout gb,gb -variant "colemak," -option grp:shifts_toggle xset r rate 200 70 - xinput --list | grep -Ei 'ErgoDox EZ\s+id' | grep -oE 'id=[0-9]+' | cut -d'=' -f2 | xargs -r setxkbmap -layout gb -device + xinput --list | grep -Ei 'ErgoDox EZ Glow\s+id' | grep -oE 'id=[0-9]+' | cut -d'=' -f2 | xargs -r setxkbmap -layout gb -device } function copy_password(){ local password="$1" diff --git a/bin/.bin/dmenu/rofi-shutdown b/bin/.bin/dmenu/rofi-shutdown index fd8b7f1a..5e75d2c1 100755 --- a/bin/.bin/dmenu/rofi-shutdown +++ b/bin/.bin/dmenu/rofi-shutdown @@ -33,8 +33,7 @@ hostname="$(hostname)" if isPhone; then selection="$(echo -e "$shutdown\n$reboot\n$lock\n$logout" | selectcommand)" else - notify-send "Not phone" - selection="$(echo -e "$shutdown\n$reboot\n$lock\n$logout\n$suspend" | selectcommand)" + selection="$(echo -e "$lock\n$shutdown\n$reboot\n$logout\n$suspend" | selectcommand)" fi sleep .2 diff --git a/bin/.bin/i3/fadeLockScreen b/bin/.bin/i3/fadeLockScreen index 24148302..a5cfff77 100755 --- a/bin/.bin/i3/fadeLockScreen +++ b/bin/.bin/i3/fadeLockScreen @@ -1,7 +1,7 @@ #!/bin/bash rm /tmp/screen.png -scrot -z /tmp/screen.png +maim /tmp/screen.png convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png if [[ -f $HOME/.config/screen-lock.png ]] diff --git a/bin/.bin/jqi b/bin/.bin/jqi deleted file mode 100755 index a1f76641..00000000 --- a/bin/.bin/jqi +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -stdin="$(cat -)" -escaped="$(echo "$stdin" | sed 's/"/\\"/g')" -query="$(echo "" | fzf --preview-window=up:99% --print-query \ - --preview "echo \"$escaped\" | jq -C {q}" | head -n 1)" - -echo "$stdin" | jq "$query" - diff --git a/bin/.bin/linkhandler b/bin/.bin/linkhandler index be1d2f71..731ffe37 100755 --- a/bin/.bin/linkhandler +++ b/bin/.bin/linkhandler @@ -18,6 +18,9 @@ case "$url" in sxiv "$tmp" rm "$tmp" ;; + *.mp3|*.wma) + mpv "$url" + ;; *"//xkcd.com/"*) xkcd "$url"; exit 0 ;; "mailto:"*) neomutt "$url"; exit 0 ;; *) $browser "$url"; exit 0 ;; diff --git a/bin/.bin/opout b/bin/.bin/opout index 9701132f..5d0ebf4b 100755 --- a/bin/.bin/opout +++ b/bin/.bin/opout @@ -2,11 +2,19 @@ # opout: "open output": A general handler for opening a file's intended output. # I find this useful especially running from vim. +name="$1" basename="${1%.*}" -case "$1" in - /tmp/neomutt*|*.tex|*.latex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;; +case "$name" in + /tmp/neomutt*|*.tex|*.latex|*.md|*.rmd|*.ms|*.me|*.mom) + if [ -f "$name".pdf ]; then + setsid "$READER" "$name".pdf >/dev/null 2>&1 & + elif [ -f "$basename".pdf ]; then + setsid "$READER" "$basename".pdf >/dev/null 2>&1 & + fi + ;; *.html) setsid "surf" "$basename".html >/dev/null 2>&1 & ;; *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; + *.scad) setsid openscad $1 & ;; *.jpg|*.jpeg|*.png|*.gif) setsid sxiv "$1" > /dev/null 2>&1 & ;; esac diff --git a/bin/.bin/screenlayouts/docked-laptop-left.sh b/bin/.bin/screenlayouts/docked-laptop-left.sh index 99ec05cf..7a83361a 100755 --- a/bin/.bin/screenlayouts/docked-laptop-left.sh +++ b/bin/.bin/screenlayouts/docked-laptop-left.sh @@ -7,7 +7,7 @@ externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | externalResolution="$(xrandr | grep -A 1 "^$externalScreen" | sed -n 2p | awk '{print $1}')" pkill compton -echo xrandr --output "$laptopScreen" --primary --mode "$laptopResolution" --pos 0x0 --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos "${laptopResolution%x*}x0" --rotate normal +xrandr --output "$laptopScreen" --primary --mode "$laptopResolution" --pos 0x0 --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos "${laptopResolution%x*}x0" --rotate normal /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown # xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal diff --git a/bin/.bin/screenshot b/bin/.bin/screenshot index b32cfeba..f6d37511 100755 --- a/bin/.bin/screenshot +++ b/bin/.bin/screenshot @@ -47,6 +47,16 @@ case "$1" in maim -s -c 0.41,0.62,0.42,0.2 -l -u "$file" fi ;; + "monitor") + if [ -n "$WAYLAND_DISPLAY" ]; then + notify-send "No idea" + else + mousex="$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')" + mousey="$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')" + monitors="$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')" + + fi + ;; *) if [ -n "$WAYLAND_DISPLAY" ]; then grim "$file" diff --git a/bin/.bin/sshportforward b/bin/.bin/sshportforward new file mode 100755 index 00000000..d8fe9101 --- /dev/null +++ b/bin/.bin/sshportforward @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +choice(){ + local prompt=${1:-"Please make a selection"} + local choices="$(cat)" + local x=1 + local selection + echo "$choices" | while read line; do + echo "$x: $line" | column -t -s $'\t' > /dev/tty + x=$((x+1)) + done + echo -n "$prompt " > /dev/tty + read selection < /dev/tty + echo "$choices" | sed -n "$selection p" | cut -d $'\t' -f 1 +} + +print_help(){ + echo "$0 This helps with generating ssh tunnels" + echo " -h||--help show this help" + exit 0 +} + +dryrun="false" + +while [[ $1 = -?* ]]; do + case $1 in + -h|--help) print_help >&2 ;; + *) echo "Unknown option $1"; print_help >&2 ;; + esac + shift +done + +forwardtype="$( +( + echo -e "local\tAccess on local machine something that is accessible on remote" + echo -e "remote\tAccess on remote machine something that is accessible on local" + echo -e "dynamic\tSimilar to local but creates a socks proxy" +) | choice "Forward Type:" )" + +case "$forwardtype" in + "local") + echo "How would you access the resource if on the remote machine?" + echo "e.g. localhost:8834 if nessus is hosted on the remote machine" + echo -n "> " + read remote < /dev/tty + echo "Which local port would you like to listen on?" + echo -n "> " + read localport < /dev/tty + echo "ssh -L ${localport}:${remote} " + ;; + "remote") + echo "How would you access the resource if on the local machine?" + echo "e.g. internal-intranet:443 if there was an internal resource you wanted to get access to" + echo -n "> " + read localresource < /dev/tty + echo "Which remote port would you like to listen on the remote server (that you're sshing into)?" + echo -n "> " + read remoteport < /dev/tty + echo "ssh -R ${remoteport}:${localresource} " + ;; + "dynamic") + echo "Which local port would you like to listen on?" + echo -n "> " + read localport < /dev/tty + echo "ssh -D ${localport} " + ;; +esac diff --git a/bin/.bin/webtest/analyse-headers b/bin/.bin/webtest/analyse-headers index 5c6e90b4..4e11db80 100755 --- a/bin/.bin/webtest/analyse-headers +++ b/bin/.bin/webtest/analyse-headers @@ -414,6 +414,8 @@ attacks (XSS).\n\n" while read source; do sourcemessage='' case "$source" in + "'none'") + ;; "'self'") sourcemessage+="This is normally fine \ although care should be taken if the site being tested has upload functionality" diff --git a/shells/shared/aliases b/shells/shared/aliases index 6d48c027..a97ac783 100644 --- a/shells/shared/aliases +++ b/shells/shared/aliases @@ -133,6 +133,10 @@ type -p cpg > /dev/null && alias cp="cpg --progress-bar" # If enum4linux-ng is available, use that instead type -p enum4linux-ng > /dev/null && alias enum4linux="enum4linux-ng" +# msfdb-blackarch works better than msfdb + +type -p msfdb-blackarch > /dev/null && alias msfdb="msfdb-blackarch" + ################### # Git Shortcuts # ################### @@ -180,7 +184,7 @@ alias r="fzf-remind" # Start postgres for msfconsole # In time, use docker instead -alias msfconsole="( systemctl status --no-pager postgresql.service > /dev/null || (echo \"Statring postgres\"; sudo systemctl start postgresql.service) ); ( pass show system/metasploit/database.yaml > database.yaml; sudo msfconsole -y database.yaml; rm database.yaml )" +#alias msfconsole="( systemctl status --no-pager postgresql.service > /dev/null || (echo \"Statring postgres\"; sudo systemctl start postgresql.service) ); ( pass show system/metasploit/database.yaml > database.yaml; sudo msfconsole -y database.yaml; rm database.yaml )" alias ss="tail -n +2 /usr/share/exploitdb/files_exploits.csv | awk -F ',' '{print \$2 \"\t\" \$3 \"\t(\" \$1 \")\"}' | fzf --preview-window=up --preview='echo {} | cut -d\" \" -f1 | xargs echo \"/usr/share/exploitdb/\" | tr -d \" \" | xargs bat --color=always' | cut -d' ' -f3 | tr -d \"()\" | xargs searchsploit -m" @@ -209,8 +213,6 @@ if [ -f "$HOME/GitRepos/openssl-weak/openssl-1.0.2-chacha/apps/openssl" ]; then alias weakopenssl="$HOME/GitRepos/openssl-weak/openssl-1.0.2-chacha/apps/openssl" alias testssl="testssl --openssl=\"$HOME/GitRepos/openssl-weak/openssl-1.0.2-chacha/apps/openssl\"" alias verifySSL="verifySSL --openssl \"$HOME/GitRepos/openssl-weak/openssl-1.0.2-chacha/apps/openssl\"" -else - alias testssl="docker run --rm -ti -v \$PWD:/data drwetter/testssl.sh" fi @@ -222,7 +224,7 @@ fi # Keyboard - reset # Sometimes, if I turn the screens off, the keyboard resets itself to defaults. Not sure why but this will put my keyboard back to how I like it #alias kb="xmodmap ~/.Xmodmap; xset r rate 200 70; xcape" -alias keys="setxkbmap -layout gb -variant colemak -option shift:both_capslock -option compose:ralt; xset r rate 200 70; xinput --list | grep -Ei 'ErgoDox EZ\s+id' | grep -oE 'id=[0-9]+' | cut -d'=' -f2 | xargs -r setxkbmap -layout gb -device" +alias keys="setxkbmap -layout gb -variant colemak -option shift:both_capslock -option compose:ralt; xset r rate 200 70; xinput --list | grep -Ei 'ErgoDox EZ Glow\s+id' | grep -oE 'id=[0-9]+' | cut -d'=' -f2 | xargs -r setxkbmap -layout gb -device" alias colemak="setxkbmap -layout gb,gb -variant \"colemak,\" -option grp:shifts_toggle" alias qwerty="setxkbmap -layout gb" @@ -296,6 +298,7 @@ if type grc > /dev/null 2>&1; then done fi +alias stripAnsi='sed -E '"'"'s/\x1B\[[0-9;]*[JKmsu]//g'"'"