Skip to content

Instantly share code, notes, and snippets.

@dustinbutterworth
Created March 28, 2022 19:49
Show Gist options
  • Save dustinbutterworth/235c1a71705934969ce758357b3823bb to your computer and use it in GitHub Desktop.
Save dustinbutterworth/235c1a71705934969ce758357b3823bb to your computer and use it in GitHub Desktop.
Query Cloudflare Subcategory IDs to see what an ID number correlates to
#!/usr/bin/env bash
# Provide the Subcategory ID number you want to check as an argument to the script.
# It will show you detailsa bout that Subcategory ID pulled from cloudflare docs github page.
# Trying to pull dierctly from the developer documentation pages, curl is blocked. This bypasses that.
category_number=$1
url="https://raw.githubusercontent.com/cloudflare/cloudflare-docs/production/content/cloudflare-one/policies/filtering/dns-policies-builder/dns-categories.md"
echo "| Category ID | Category Name | Subcategory ID | Subcategory Name |"
curl -s "$url" | sed -n -e '/DNS Category and Subcategory IDs/,$p' | grep '^|' | awk -F '|' '$4 ~ "'${category_number}'" {print $0}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment