Skip to content

Instantly share code, notes, and snippets.

@pcaversaccio
pcaversaccio / curl
Last active January 18, 2026 14:28
Protective wrappers for `curl`/`wget` that prevent homograph/IDN attacks by blocking URLs containing non-ASCII characters or Punycode domains.
#!/usr/bin/env bash
set -Eeuo pipefail
RED=$'\033[1;31m'
YELLOW=$'\033[1;33m'
RESET=$'\033[0m'
for arg in "$@"; do
# Reject any non-ASCII byte.
if LC_ALL=C printf "%s" "$arg" | grep -q "[^ -~]"; then