Skip to content

Instantly share code, notes, and snippets.

@n0kovo
Created August 31, 2023 22:01
Show Gist options
  • Save n0kovo/5027703733c741673f91edcd54c98d0b to your computer and use it in GitHub Desktop.
Save n0kovo/5027703733c741673f91edcd54c98d0b to your computer and use it in GitHub Desktop.
SICK PIPEZ M8 (1337 h4x0r edition)

SICK PIPEZ M8!

or: "A growing bunch of pseudo-one-liners from when I needed to accomplish something that turned into a shell scripting practice sesh instead because ADHD."


  • Get all subdomains from ProjectDiscovery Chaos

Parallel download jobs + extraction & parsing (pretty fucking fast). Requires: jq, unfurl

CORES_X2=$(( $(nproc) * 2 )); \
CORES_HALF=$(( $(nproc) / 2 )); \
LINES_PER_BLOCK=100000; \
export LC_ALL=C; \
echo "Downloading/Extracting..." && \
curl -s https://chaos-data.projectdiscovery.io/index.json | \
jq -r -M '.[] | .URL' | \
parallel --will-cite --bar --max-args "$CORES_HALF" 'curl -sL {} | tar xO' | \
parallel --will-cite --block "$LINES_PER_BLOCK2" --spreadstdin 'unfurl format %S' | \
awk "{c[\$1]++} END {print \"Sorting lines...\" > \"/dev/stderr\"; for (i in c){print c[i],i}}" | \
sort -r -n -S1G --parallel="$CORES_X2" > chaos_subs.txt; \
echo 'Done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment