├── README.md ├── old ├── pre-suspend ├── autolock ├── ddns-updater.conf ├── propersuspend ├── getphotos ├── ddns-updater ├── mp3clean ├── securegpgsign ├── pdfmergetoc ├── srf ├── dyndnslogin ├── fixjollaphotos ├── packtebooksrename ├── sshfpgen ├── mkgallery ├── braindump.sh └── firewall ├── ip.php ├── telnetwitness ├── dnssnoop ├── download-burpsuite-bapps ├── magnify ├── gppdecrypt ├── fileupload-checker-form.php ├── LICENSE ├── templates ├── python └── bash ├── imageshrink ├── screenshot ├── pic2vid ├── htmlsmuggler ├── fileupload-checker-plain.php ├── Dump-PublicAzureBlobStorage.ps1 ├── dollyx509 ├── base16 ├── wecker ├── screenctl ├── download-boot-isos ├── Extract-AzureTokens.ps1 ├── ip-forwarding-scanner ├── ip6-forwarding-scanner ├── makecert └── 802.11evil /README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | Some scripts. 4 | -------------------------------------------------------------------------------- /old/pre-suspend: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if pgrep mpd >/dev/null 2>&1 && `which mpc` >/dev/null 2>&1 4 | then 5 | mpc pause >/dev/null 2>&1 6 | fi 7 | 8 | pkill mplayer >/dev/null 2>&1 9 | i3lock -u --dpms -c 333333 --pointer default 10 | -------------------------------------------------------------------------------- /old/autolock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec xautolock -detectsleep \ 4 | -time 5 -locker "i3lock -u --dpms -c 333333 --pointer default" \ 5 | -notify 30 \ 6 | -notifier "notify-send -u critical -t 10000 -- 'LOCKING screen in 30 seconds'" 7 | 8 | -------------------------------------------------------------------------------- /old/ddns-updater.conf: -------------------------------------------------------------------------------- 1 | # 2 | # ddns-updater.conf 3 | # 4 | 5 | KEYFILE="/etc/Kfoobar.example.org.+157+51053.private" 6 | NAMESERVER="ns.example.org" 7 | ZONE="example.org" 8 | HOSTNAME="foobar.example.org" 9 | TTL="60" 10 | #CUSTOMIP="10.42.23.5" 11 | #CUSTOMIP6="10.42.23.5" 12 | -------------------------------------------------------------------------------- /ip.php: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /telnetwitness: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # telnetwitness 4 | # 5 | # Receives the telnet banner of the systems provided from stdin 6 | # 7 | # Author: Emanuel Duss 8 | # 9 | 10 | while read host 11 | do 12 | echo "$ telnet $host" 13 | ( 14 | sleep 2 | telnet $host; 15 | ) 16 | echo 17 | echo 18 | done 19 | -------------------------------------------------------------------------------- /old/propersuspend: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # propersuspend - Script wich suspends the computer 4 | # 5 | 6 | if pgrep mpd >/dev/null 2>&1 && `which mpc` >/dev/null 2>&1 7 | then 8 | mpc pause >/dev/null 2>&1 9 | fi 10 | 11 | for i in mplayer pmv vlc 12 | do 13 | pkill $i >/dev/null 2>&1 14 | done 15 | 16 | i3lock -u --dpms -c 333333 --pointer default 17 | systemctl suspend 18 | -------------------------------------------------------------------------------- /dnssnoop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # dnssnoop 4 | # 5 | # Check if the DNS server has the hostnames from STDIN in the cache 6 | # 7 | # Author: Emanuel Duss 8 | # 9 | 10 | NAMESERVER="$1" 11 | 12 | while read domain 13 | do 14 | if (( "$(dig $domain "@$NAMESERVER" +norec +noall +short | wc -l)" > 0 )) 15 | then 16 | echo "$domain is in the cache." 17 | fi 18 | done 19 | -------------------------------------------------------------------------------- /download-burpsuite-bapps: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # download-burpsuite-bapps 4 | # 5 | # Download all Burp Suite BApps from the BAppstore. 6 | # 7 | # Author: Emanuel Duss 8 | # 9 | 10 | mkdir bapps 11 | curl -s https://portswigger.net/bappstore | awk -F '["<>/]' '/bapp-label heading-4/{ print $7,$9 }' | while read id name 12 | do 13 | echo "Downloading $name..." 14 | curl -s -L "https://portswigger-cdn.net/bappstore/bapps/download/$id" -o "bapps/${name//[^a-z0-9A-Z]/_}.bapp" 15 | done 16 | -------------------------------------------------------------------------------- /old/getphotos: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # getphotos - Get photos from a camera, rename and rotate 4 | # 5 | 6 | FOLDER="`date +GetPhotos_%Y-%m-%d`" 7 | 8 | mkdir "$FOLDER" 9 | cd "$FOLDER" 10 | 11 | gphoto2 --get-all-files 12 | 13 | jhead -autorot *.[jJ][pP][gG] 14 | jhead -norot *.[jJ][pP][gG] 15 | 16 | jhead -nf%Y-%m-%d_%H-%M-%S *.[jJ][pP][gG] 17 | 18 | mkdir "`ls *.jpg | cut -c 1-10 | sort -u`" 19 | 20 | ls *.jpg | cut -c 1-10 | sort -u | while read line 21 | do 22 | mv "$line*.jpg" "$line" 23 | done 24 | 25 | cd .. 26 | chown -R emanuel.users "$FOLDER" 27 | -------------------------------------------------------------------------------- /magnify: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # magnify 4 | # 5 | # Show current screen in imageviewer to zoom in for presentations 6 | # 7 | # Author: Emanuel Duss 8 | # 9 | 10 | PrintUsage(){ 11 | cat << EOI 12 | Usage: magnify 13 | 14 | A simple screen magnifier. 15 | 16 | Use the arrow keys to zoom in or out. 17 | Use the mouse cursor to adjust screen section. 18 | Press q to quit. 19 | EOI 20 | } 21 | 22 | if ! hash scrot 2>/dev/null && hash feh 2>/dev/null 23 | then 24 | echo "Could not find scrot and feh" 25 | exit 1 26 | fi 27 | 28 | IMAGE="$(mktemp --tmpdir="/tmp" magnify_XXXXX.png)" 29 | trap 'rm "$IMAGE"' EXIT 30 | 31 | scrot "$IMAGE" 32 | feh --borderless --image-bg black --fullscreen "$IMAGE" 33 | -------------------------------------------------------------------------------- /old/ddns-updater: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # ddns-updater - Update dynamic dns entries 4 | # 5 | 6 | CONF="${1:-/etc/ddns-updater.conf}" 7 | . "$CONF" 8 | 9 | if [[ -z "$KEYFILE" || -z "$NAMESERVER" || -z "$ZONE" \ 10 | || -z "$HOSTNAME" || -z "$TTL" ]] 11 | then 12 | echo "Error loading configuration file $CONF" 13 | exit 1 14 | fi 15 | 16 | IPADDR="${CUSTOMIP:-$(curl -s -4 https://motd.ch/ip.php)}" 17 | IPADDROLD="$(dig $HOSTNAME @$NAMESERVER +short)" 18 | IP6ADDR="${CUSTOMIP6:-$(curl -s -6 https://motd.ch/ip.php)}" 19 | IP6ADDROLD="$(dig $HOSTNAME AAAA @$NAMESERVER +short)" 20 | 21 | if [[ "$IPADDR" == "$IPADDROLD" && "$IP6ADDR" == "$IP6ADDROLD" ]] 22 | then 23 | exit 24 | fi 25 | 26 | ( 27 | echo "server $NAMESERVER" 28 | echo "zone $ZONE" 29 | echo "update delete $HOSTNAME" 30 | echo "update add $HOSTNAME $TTL A $IPADDR" 31 | echo "update add $HOSTNAME $TTL AAAA $IP6ADDR" 32 | echo "send" 33 | ) | nsupdate -v -k "$KEYFILE" 34 | -------------------------------------------------------------------------------- /old/mp3clean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # MP3-Sammlung Sortieren 4 | # 5 | # History 6 | # 2010-06-28 [Emanuel Duss] Erste Version 7 | # 8 | 9 | # Lese Angaben ein 10 | echo -n "Artist: " 11 | read ARTIST 12 | echo -n "Album: " 13 | YEAR=`pwd | sed -r -e 's/.*\/([0-9]{4})[^\/]*/\1/g'` 14 | read ALBUM 15 | echo -n "Jahr: " 16 | read YEAR 17 | echo -n "Genre: " 18 | read GENRE 19 | echo -n "Kommentar: " 20 | read COMMENT 21 | echo 22 | 23 | echo "Artist: $ARTIST" 24 | echo "Album: $ALBUM" 25 | echo "Jahr: $YEAR" 26 | echo "Genre: $GENRE" 27 | echo "Kommentar: $COMMENT" 28 | 29 | echo "MP3 Dateien taggen? [ENTER]" 30 | ls *.mp3 31 | mp3info -a "$ARTIST" -g "$GENRE" -l "$ALBUM" -y "$YEAR" -c "$COMMENT" *.mp3 32 | echo "ID3-Tags sind gesetzt" 33 | read 34 | mp3info *.mp3 35 | 36 | mkdir -p "$ARTIST/$YEAR - $ALBUM" 37 | 38 | for file in *.mp3 39 | do 40 | echo $file 41 | mv "$file" "$(mp3info -p "%a/%y - %l/%n - %t.mp3" "$file")" 42 | done 43 | 44 | -------------------------------------------------------------------------------- /gppdecrypt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # gppdecrypt 4 | # 5 | # Decrypt credentials stored in Windows Group Policy Preferences 6 | # 7 | # See Blog for more information: 8 | # https://blog.compass-security.com/2012/04/exploit-credentials-stored-in-windows-group-policy-preferences/ 9 | # 10 | # Author: Emanuel Duss 11 | # 12 | 13 | # Microsoft released AES key 14 | # https://msdn.microsoft.com/en-us/library/2c15cbf0-f086-4c74-8b70-1f2fa45dd4be.aspx 15 | KEY="4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b" 16 | 17 | PASSWORD="$1" 18 | PASSWORD="foobar==" 19 | 20 | add_padding(){ 21 | PADDINGLEHGTH="$((4 - $(echo "$1" | wc -L) % 4))" 22 | for i in $(seq "$PADDINGLEHGTH") 23 | do 24 | PADDING="${PADDING}$(echo -n =)" 25 | done 26 | echo "${1}${PADDING}" 27 | } 28 | 29 | decrypt_password(){ 30 | echo "$1" \ 31 | | openssl enc \ 32 | -a \ 33 | -d \ 34 | -aes-256-cbc \ 35 | -K "$KEY" \ 36 | -iv 00000000000000000000000000 37 | echo 38 | } 39 | 40 | main(){ 41 | decrypt_password "$(add_padding "$PASSWORD")" 42 | } 43 | 44 | main "$@" 45 | -------------------------------------------------------------------------------- /fileupload-checker-form.php: -------------------------------------------------------------------------------- 1 | 8 | // 9 | 10 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { 11 | $rawData = file_get_contents('php://input'); 12 | $dataSize = strlen($rawData); 13 | 14 | if ($dataSize > 0) { 15 | $hashContext = hash_init('sha256'); 16 | hash_update($hashContext, $rawData); 17 | $fileHash = hash_final($hashContext); 18 | 19 | $first20Bytes = substr($rawData, 0, 20); 20 | $hexFirst20Bytes = bin2hex($first20Bytes); 21 | 22 | echo "
Data Size: " . htmlspecialchars(number_format($dataSize)) . " bytes
\n"; 24 | echo "SHA256 Hash: " . htmlspecialchars($fileHash, ENT_QUOTES, 'UTF-8') . "
\n"; 25 | echo "First 20 Bytes (Hex): " . htmlspecialchars($hexFirst20Bytes, ENT_QUOTES, 'UTF-8') . "
\n"; 26 | } else { 27 | echo "File: $FILENAME
SHA256: $HASH
Upload a file to calculate its SHA256 sum, display its size, and show the first 20 bytes in hex:
21 | 26 | 27 | 28 | 29 | File uploaded successfully!\n\n"; 55 | echo "File Size: " . htmlspecialchars(number_format($fileSize)) . " bytes
\n"; 56 | echo "SHA256 Hash: " . htmlspecialchars($fileHash, ENT_QUOTES, 'UTF-8') . "
\n"; 57 | echo "First 20 Bytes (Hex): " . htmlspecialchars($hexFirst20Bytes, ENT_QUOTES, 'UTF-8') . "
\n"; 58 | } else { 59 | echo "