Skip to content

Instantly share code, notes, and snippets.

@nil0x42
Last active April 5, 2021 06:02
Show Gist options
  • Save nil0x42/b1542d2e8aa8be4058c9ce07f62919dd to your computer and use it in GitHub Desktop.
Save nil0x42/b1542d2e8aa8be4058c9ce07f62919dd to your computer and use it in GitHub Desktop.
Safe lock-based `anew` wrapper for concurrent usage for bug-bounty automation
# Safe lock-based `anew` wrapper for concurrent usage.
# e.g: gau tesla.com | anew_safe ~/tesla/endpoints.txt
function anew_safe() {
[ -t 0 ] && exit 1 # STDIN not a TTY
[[ "$1" == "-q" ]] && file="$2" || file="$1"
{
flock -x 200
cat - | anew "$@"
} 200>>"$file"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment