
PoC for CVE-2022-0492
A modern Bash script template with colorized output formatting and utility functions for creating professional command-line tools.
chmod +x script.sh
./script.sh
#!/bin/bash
LIB="lib"
source $LIB/format.sh
section "Your Script Section"
info "Information message"
ok "Success message"
warn "Warning message"
error "Error message"
info "message" - Displays informational messages with cyan [i] prefixok "message" - Displays success messages with green [+] prefixwarn "message" - Displays warning messages with yellow [!] prefixerror "message" - Displays error messages with red [-] prefix (sent to stderr)prompt "question" - Displays a prompt with magenta [?] prefix and waits for user inputsection "title" - Creates a formatted section headerbold "text" - Displays text in bold formattingThe following color constants are available for custom formatting:
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
BOLD='\033[1m'
UNDERLINE='\033[4m'
RESET='\033[0m'
When you run the example script, you'll see:
=== Start ===
[i] Running exploit setup...
[+] Everything is ready
[!] This might break your system
[-] Something failed
[?] Continue? [y/N]:
shell_template/
├── script.sh # Example script demonstrating usage
├── lib/
│ └── format.sh # Core formatting library
├── LICENSE # MIT License
└── README.md # This file
You can extend the library by adding new message types in lib/format.sh:
DEBUG="${BLUE}[D]${RESET}"
debug() { echo -e "${DEBUG} $*"; }
Define your own color schemes by modifying the color constants or creating new ones:
PURPLE='\033[0;35m'
CUSTOM_PREFIX="${PURPLE}[*]${RESET}"
custom() { echo -e "${CUSTOM_PREFIX} $*"; }
source $LIB/format.sh at the beginning of your scriptssection to organize your script outputerror for error messages and redirect to stderrchmod +x for your scriptsFeel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Christoph Huy