#!/usr/bin/env bash # ------------------------------------------------------------------------------ # Copyright (c) 2013-2026 Geoffray Levasseur # Protected by the BSD3 license. Please read bellow for details. # # * Redistribution and use in source and binary forms, # * with or without modification, are permitted provided # * that the following conditions are met: # * # * Redistributions of source code must retain the above # * copyright notice, this list of conditions and the # * following disclaimer. # * # * Redistributions in binary form must reproduce the above # * copyright notice, this list of conditions and the following # * disclaimer in the documentation and/or other materials # * provided with the distribution. # * # * Neither the name of the copyright holder nor the names # * of any other contributors may be used to endorse or # * promote products derived from this software without # * specific prior written permission. # * # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND # * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, # * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # * OF SUCH DAMAGE. # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # Make non-IT peoples think you're busy doing something hard # Usage: busy [options] [pattern] # Options: # --delay= : add a delay between each line output (milliseconds) # pattern : the string to search for in the hexdump output (default is "ca fe") busy() { local pattern="${BUSY_DEFAULT_PATTERN:-ca fe}" delay_ms="${BUSY_DEFAULT_DELAY:-0}" local PARSED # Short: h, p:, d: # Long: help, pattern:, delay: PARSED=$(getopt -o hp:d: --long help,pattern:,delay: -n 'busy' -- "$@") # shellcheck disable=SC2181 # getopt return code is checked immediately after if [[ $? -ne 0 ]]; then disp E "Invalid options, use \"busy --help\" to display usage." return 1 fi eval set -- "$PARSED" while true; do case "$1" in -h|--help) printf "busy: Monitor /dev/urandom for a specific pattern.\n\n" printf "Usage: busy [options] [pattern]\n\n" printf "Options:\n" printf "\t-h, --help\t\tDisplay this help screen\n" printf "\t-p, --pattern PATTERN\tHex pattern to search (default: \"ca fe\")\n" printf "\t-d, --delay MS\t\tDelay between matches in milliseconds\n" return 0 ;; -p|--pattern) pattern="$2" shift 2 ;; -d|--delay) delay_ms="$2" if ! [[ "$delay_ms" =~ ^[0-9]+$ ]]; then disp E "Invalid delay: must be an integer (milliseconds)." return 1 fi shift 2 ;; --) shift break ;; *) disp E "Invalid option: $1" return 1 ;; esac done # Convert milliseconds to seconds for 'sleep' local delay_s delay_s=$(awk "BEGIN{ printf \"%.3f\", $delay_ms / 1000 }") # Monitor /dev/urandom ( hexdump -C < /dev/urandom | grep -iF --line-buffered "$pattern" | \ while read -r line; do echo "$line" [[ $delay_ms -gt 0 ]] && sleep "$delay_s" done ) & local sub_pid=$! IFS= read -r -n 1 -s _ /dev/null || kill "$sub_pid" 2>/dev/null wait "$sub_pid" 2>/dev/null return 0 } export -f busy # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # Simulate a long and complex compilation process # Usage: fake_compile [options] # Options: # --delay= : delay between output lines (milliseconds, default: 80) # --lang= : source language preset: c (default), cpp, java, python # --errors : inject fake compilation errors at the end of the build fake_compile() { local delay_ms="${FAKE_COMPILE_DEFAULT_DELAY:-80}" lang="c" with_errors=0 local PARSED # Short: h, d:, l:, e # Long: help, delay:, lang:, errors PARSED=$(getopt -o hd:l:e --long help,delay:,lang:,errors -n 'fake_compile' -- "$@") # shellcheck disable=SC2181 # getopt return code is checked immediately after if [[ $? -ne 0 ]]; then disp E "Invalid options, use \"fake_compile --help\" to display usage." return 1 fi eval set -- "$PARSED" while true; do case "$1" in -h|--help) printf "fake_compile: Simulate a complex compilation process.\n\n" printf "Usage: fake_compile [options]\n\n" printf "Options:\n" printf "\t-h, --help\t\tDisplay this help screen\n" printf "\t-d, --delay MS\t\tDelay between lines in milliseconds (default: 80)\n" printf "\t-l, --lang LANG\t\tLanguage preset: c, cpp, java, python (default: c)\n" printf "\t-e, --errors\t\tInject fake compilation errors at the end\n" return 0 ;; -d|--delay) delay_ms="$2" if ! [[ "$delay_ms" =~ ^[0-9]+$ ]]; then disp E "Invalid delay: must be an integer (milliseconds)." return 1 fi shift 2 ;; -l|--lang) lang="$2" case "$lang" in c|cpp|java|python) ;; *) disp E "Invalid lang: must be one of: c, cpp, java, python." return 1 ;; esac shift 2 ;; -e|--errors) with_errors=1 shift ;; --) shift break ;; *) disp E "Invalid option: $1" return 1 ;; esac done local delay_s delay_s=$(awk "BEGIN{ printf \"%.3f\", $delay_ms / 1000 }") ( c_files=( "main" "utils" "parser" "lexer" "codegen" "optimizer" "allocator" "scheduler" "resolver" "runtime" "buffer" "hashmap" "io" "net" "crypto" "compress" ) cpp_files=( "Application" "Controller" "AbstractFactory" "Singleton" "Observer" "Strategy" "Builder" "Facade" "Proxy" "Iterator" "Decorator" "CommandDispatcher" "EventLoop" "MemoryPool" "ThreadSafe" ) java_files=( "Application" "Service" "Repository" "Controller" "Entity" "Configuration" "SecurityConfig" "DataSourceConfig" "RestTemplate" "ExceptionHandler" "Validator" ) python_files=( "setup" "config" "utils" "models" "views" "serializers" "migrations/0001_initial" "migrations/0002_auto" "tests" "signals" "admin" "apps" "urls" "wsgi" "celery" "tasks" ) warnings=( "warning: implicit declaration of function" "warning: unused variable [-Wunused-variable]" "warning: comparison between signed and unsigned integer expressions" "warning: suggest parentheses around operand of '!'" "warning: format '%d' expects 'int', but argument has type 'long int'" "warning: control reaches end of non-void function [-Wreturn-type]" "warning: deprecated conversion from string literal to 'char*'" "warning: address of local variable taken" ) errors=( "error: 'NULL' was not declared in this scope" "error: expected ';' before '}' token" "error: undefined reference to 'main'" "error: too few arguments to function" "error: invalid use of incomplete type" ) case "$lang" in c) files=("${c_files[@]}"); ext=".c" ;; cpp) files=("${cpp_files[@]}"); ext=".cpp" ;; java) files=("${java_files[@]}"); ext=".java" ;; python) files=("${python_files[@]}"); ext=".py" ;; esac while true; do total=${#files[@]} i=0 for f in "${files[@]}"; do i=$(( i + 1 )) warn_count=$(( RANDOM % 3 )) printf "[ %2d/%2d ] Compiling %s%s ...\n" "$i" "$total" "$f" "$ext" sleep "$delay_s" w=0 while [[ $w -lt $warn_count ]]; do wline="${warnings[$((RANDOM % ${#warnings[@]}))]}" printf " %s%s:%d:%d: %s\n" \ "$f" "$ext" "$(( RANDOM % 200 + 1 ))" "$(( RANDOM % 80 + 1 ))" "$wline" sleep "$delay_s" w=$(( w + 1 )) done done if [[ $with_errors -eq 1 ]]; then for eline in "${errors[@]}"; do ef="${files[$((RANDOM % ${#files[@]}))]}" printf " %s%s:%d:%d: %s\n" \ "$ef" "$ext" "$(( RANDOM % 200 + 1 ))" "$(( RANDOM % 80 + 1 ))" "$eline" sleep "$delay_s" done printf "\nBuild FAILED: %d error(s), %d warning(s)\n" \ "${#errors[@]}" "$(( RANDOM % 20 + 5 ))" else printf "\nBuild SUCCEEDED: 0 error(s), %d warning(s)\n" \ "$(( RANDOM % 15 + 2 ))" fi printf "\n" done ) & local sub_pid=$! IFS= read -r -n 1 -s _ /dev/null || kill "$sub_pid" 2>/dev/null wait "$sub_pid" 2>/dev/null return 0 } export -f fake_compile # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # Simulate a dramatic hacking sequence # Usage: hack [options] # Options: # --target= : target IP address (default: random) # --delay= : delay between output lines (milliseconds, default: 120) hack() { local delay_ms="${HACK_DEFAULT_DELAY:-120}" target="" local PARSED # Short: h, t:, d: # Long: help, target:, delay: PARSED=$(getopt -o ht:d: --long help,target:,delay: -n 'hack' -- "$@") # shellcheck disable=SC2181 # getopt return code is checked immediately after if [[ $? -ne 0 ]]; then disp E "Invalid options, use \"hack --help\" to display usage." return 1 fi eval set -- "$PARSED" while true; do case "$1" in -h|--help) printf "hack: Simulate a dramatic hacking sequence.\n\n" printf "Usage: hack [options]\n\n" printf "Options:\n" printf "\t-h, --help\t\tDisplay this help screen\n" printf "\t-t, --target IP\t\tTarget IP address (default: random)\n" printf "\t-d, --delay MS\t\tDelay between output lines in milliseconds (default: 120)\n" return 0 ;; -t|--target) target="$2" shift 2 ;; -d|--delay) delay_ms="$2" if ! [[ "$delay_ms" =~ ^[0-9]+$ ]]; then disp E "Invalid delay: must be an integer (milliseconds)." return 1 fi shift 2 ;; --) shift break ;; *) disp E "Invalid option: $1" return 1 ;; esac done local delay_s delay_s=$(awk "BEGIN{ printf \"%.3f\", $delay_ms / 1000 }") ( rand_ip() { printf '%d.%d.%d.%d\n' \ $(( RANDOM%223+1 )) $(( RANDOM%255 )) \ $(( RANDOM%255 )) $(( RANDOM%254+1 )); } rand_mac() { printf '%02x:%02x:%02x:%02x:%02x:%02x\n' \ $(( RANDOM%256 )) $(( RANDOM%256 )) $(( RANDOM%256 )) \ $(( RANDOM%256 )) $(( RANDOM%256 )) $(( RANDOM%256 )); } rand_hash() { printf '%04x%04x%04x%04x%04x%04x%04x%04x' \ $RANDOM $RANDOM $RANDOM $RANDOM \ $RANDOM $RANDOM $RANDOM $RANDOM; } ports=( 22 80 443 3306 5432 6379 8080 8443 27017 ) services=( "ssh" "http" "https" "mysql" "postgresql" "redis" "http-alt" "https-alt" "mongodb" ) cve_ids=( "CVE-2024-3094" "CVE-2023-44487" "CVE-2024-6387" "CVE-2021-44228" "CVE-2022-0847" ) os_list=( "Linux 5.15.x" "Linux 6.1.x" "Ubuntu 22.04 LTS" "Debian 12" "CentOS Stream 9" ) users=( "root" "admin" "www-data" "postgres" "redis" "deploy" ) passwords=( "password123" "admin2024" "letmein!" "Sup3rS3cr3t" "qwerty" "123456" ) fixed_target="$target" while true; do [[ -z "$fixed_target" ]] && target="$(rand_ip)" || target="$fixed_target" printf "[*] Initializing attack sequence against %s\n" "$target" sleep "$delay_s" # Phase 1 — port scan printf "[*] Starting port scan...\n" sleep "$delay_s" open_ports=() for idx in "${!ports[@]}"; do if (( RANDOM % 3 != 0 )); then printf " %-6s open %s\n" "${ports[$idx]}/tcp" "${services[$idx]}" open_ports+=( "${ports[$idx]}/${services[$idx]}" ) sleep "$delay_s" fi done printf "[+] %d open port(s) found.\n" "${#open_ports[@]}" sleep "$delay_s" # Phase 2 — OS fingerprinting printf "[*] OS fingerprinting...\n" sleep "$delay_s" printf "[+] Target OS: %s (MAC: %s)\n" \ "${os_list[$((RANDOM % ${#os_list[@]}))]}" "$(rand_mac)" sleep "$delay_s" # Phase 3 — CVE check printf "[*] Checking known vulnerabilities...\n" sleep "$delay_s" vuln_count=$(( RANDOM % 3 + 1 )) v=0 while [[ $v -lt $vuln_count ]]; do printf "[!] Potential vulnerability: %s\n" "${cve_ids[$((RANDOM % ${#cve_ids[@]}))]}" sleep "$delay_s" v=$(( v + 1 )) done # Phase 4 — exploit printf "[*] Loading exploit module...\n"; sleep "$delay_s" printf "[*] Bypassing firewall rules...\n"; sleep "$delay_s" printf "[*] Injecting payload" dots=0 while [[ $dots -lt 6 ]]; do printf "." sleep "$(awk "BEGIN{ printf \"%.3f\", $delay_ms * 1.5 / 1000 }")" dots=$(( dots + 1 )) done printf "\n" printf "[+] Shell obtained on %s\n" "$target" sleep "$delay_s" # Phase 5 — hash dumping printf "[*] Dumping password hashes...\n" sleep "$delay_s" for u in "${users[@]}"; do printf " %-12s : \$6\$%s\n" "$u" "$(rand_hash)" sleep "$delay_s" done # Phase 6 — cracking printf "[*] Cracking hashes (wordlist: rockyou.txt)...\n" sleep "$delay_s" cracked=$(( RANDOM % ${#users[@]} + 1 )) c=0 while [[ $c -lt $cracked ]]; do printf "[+] Cracked: %-12s -> %s\n" \ "${users[$c]}" "${passwords[$((RANDOM % ${#passwords[@]}))]}" sleep "$delay_s" c=$(( c + 1 )) done printf "\n[+] -------- ACCESS GRANTED -------- [+]\n" printf "[*] Cleaning logs on %s...\n" "$target" sleep "$delay_s" printf "[+] Done. Have a nice day.\n" printf "\n" done ) & local sub_pid=$! IFS= read -r -n 1 -s _ /dev/null || kill "$sub_pid" 2>/dev/null wait "$sub_pid" 2>/dev/null return 0 } export -f hack # ------------------------------------------------------------------------------ load_conf "fun" # EOF