Last active
April 5, 2021 06:02
-
-
Save nil0x42/b1542d2e8aa8be4058c9ce07f62919dd to your computer and use it in GitHub Desktop.
Safe lock-based `anew` wrapper for concurrent usage for bug-bounty automation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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