#!/bin/bash
# truth be told idk why tf i made this poc as a shell script. there is no non-inebreated explanaition for dis
set -e # faiulure is not tolerated here
## easy to add ids~
### Flock: B4:1E:52
### Police: 00:25:DF, 00:58:28, 00:C0:D4, 84:70:03, C0:1C:6A
vendor_ids=('00:25:DF' '00:58:28' '00:C0:D4' '84:70:03') # real world vendor ids
## random macs for testing
# vendor_ids=('00:25:DF' '00:58:28' '00:C0:D4' '84:70:03' 'CO:1C:6A' '01' '02' '03' '04' '05' '06' '07' '08' '09' '0B' '77' '99' '0A' '0B' '0C' '0D' '0E' '0F' 'AB' 'C0')
webhook_file="/usr/share/DREAMMAKER/.discord_url"
tag_file="/usr/share/DREAMMAKER/.discord_tag"
username='[DЯΣΛMMΛKΣЯ]'
pink="$\033[35m"
reset="\033[0m"
header="\n\n${pink} ____  ______   _______  _______  _______  _______  _______  _______  _        _______  _______  ____
(  __)(  __  \ (  ____ )(  ____ \(  ___  )(       )(       )(  ___  )| \    /\(  ____ \(  ____ )(__  )
| (   | (  \  )| (    )|| (    \/| (   ) || () () || () () || (   ) ||  \  / /| (    \/| (    )|   ) |
| |   | |   ) || (____)|| (__    | (___) || || || || || || || (___) ||  (_/ / | (__    | (____)|   | |
| |   | |   | ||     __)|  __)   |  ___  || |(_)| || |(_)| ||  ___  ||   _ (  |  __)   |     __)   | |
| |   | |   ) || (\ (   | (      | (   ) || |   | || |   | || (   ) ||  ( \ \ | (      | (\ (      | |
| (__ | (__/  )| ) \ \__| (____/\| )   ( || )   ( || )   ( || )   ( ||  /  \ \| (____/\| ) \ \__ __) |
(____)(______/ |/   \__/(_______/|/     \||/     \||/     \||/     \||_/    \/(_______/|/   \__/(____)
\n\n${reset}https://github.com/${pink}PrincessPi3${reset}\n\n"

clear
echo -e "$header"
echo "Listening for police..."

send_discord_webhook() {
    webhook_url="$(cat \"$webhook_file\")"
    tag="$(cat \"$tag_file\")"

    # send the webhook post
    curl -sS -X POST \
        -H "Content-Type: application/json" \
        -d "{\"username\":\"$username\",\"content\":\"$1 $tag\"}" \
        "$webhook_url"
}

while true; do #infinite loop
    # scan for those vendor ids
    ## the ${vendor_ids[@]/#/ -e ^} evals to ^00:25:DF -e ^00:58:28 -e ^00:C0:D4 -e ^84:70:03 /#/ means "prepend next chars to start of sting"
    blescan=$(eval "bluetoothctl -t 10 scan on | awk '{print \$3}' | grep ${vendor_ids[@]/#/ -e ^}")
    if [ -n "$blescan" ]; then
        # LE detected poweroff to cryptdisk and notify
        # alert spammmm
        for((i=0;i<10;i++)); do
            send_discord_webhook "FUZZ!!!" & # fork task to background to run more faster
            
            # cryptsetup erase <device> # ion case you wanna nuke ur shit lmao
            ## these options are powerful, silent, fast, aND RIsky
            poweroff --poweroff --force --no-wall # --no-sync
        done
    fi
done