Skip to content

Instantly share code, notes, and snippets.

@hazcod
Created April 7, 2022 09:17
Show Gist options
  • Save hazcod/6c997f3a380b01ec96afed76d1d48777 to your computer and use it in GitHub Desktop.
Save hazcod/6c997f3a380b01ec96afed76d1d48777 to your computer and use it in GitHub Desktop.
Retrieves domains from the Intigriti public program on the public website.
#!/usr/bin/env bash
join_by()
{
local IFS="$1"
shift
echo "$*"
}
data=$(curl -s https://www.intigriti.com/programs)
companyHandles=($(echo "${data}" | grep -Eo '&q;companyHandle&q;:&q;([A-Za-z]+)&q;,'))
programHandles=($(echo "${data}" | grep -Eo ',&q;handle&q;:&q;([A-Za-z]+)&q;,&q'))
if (( ${#companyHandles[@]} != ${#programHandles[@]} )); then
echo "Error: company handles and program handles differ"
#exit 1
fi
for i in $(seq 0 ${#companyHandles}); do
companyHandle=$(echo "${companyHandles[$i]}" | cut -d ';' -f 4 | cut -d '&' -f 1)
programHandle=$(echo "${programHandles[$i]}" | cut -d ';' -f 4 | cut -d '&' -f 1)
programUrl="https://app.intigriti.com/programs/${companyHandle}/${programHandle}/detail"
programData=$(curl -s "${programUrl}")
domains=($(echo "${programData}" | grep -Eo '<p>[\*\.]*((?:[A-Za-z\-]+\.)*[A-Za-z\-]+)<\/p>' | cut -d '>' -f 2 | cut -d '<' -f 1 | sed -e "s/^\*\.//"))
echo "${companyHandle}/${ProgramHandle} -> $(join_by ',' ${domains[@]})"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment