Created
August 26, 2021 20:50
-
-
Save alanEG/8c4093ad04baa1f15135a8d04905e010 to your computer and use it in GitHub Desktop.
google cet search
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
googleCT (){ | |
target=${target} | |
url="https://transparencyreport.google.com/transparencyreport/api/v3/httpsreport/ct/certsearch?include_subdomains=true&domain=${target}" | |
dataF=$(curl -s ${url} | sed "s/)]}'//g") | |
id=$(echo ${dataF} | sed "s/)]}'//g"| jq -r '.[][3][1]') | |
range=$(echo $dataF | jq -r '.[][-1][-1]') | |
declare -a links | |
links=($(echo ${dataF} | jq -r '.[][1][][5]')) | |
echo '=============================================' 1>&2 | |
echo '| start 1 |' 1>&2 | |
echo '=============================================' 1>&2 | |
for i in $(seq 1 $((${range} - 1))) | |
do | |
dataS=$(curl -s "https://transparencyreport.google.com/transparencyreport/api/v3/httpsreport/ct/certsearch/page?p=${id}" | sed "s/)]}'//g") | |
for number in $(seq 1 100) | |
do | |
if [ -z "${dataS}" ] | |
then | |
echo "try ${i} ${number}" 1>&2 | |
dataS=$(curl -s "https://transparencyreport.google.com/transparencyreport/api/v3/httpsreport/ct/certsearch/page?p=${id}" | sed "s/)]}'//g") | |
else | |
break | |
fi | |
done | |
links+=($(echo ${dataS} | jq -r '.[][1][][5]')) | |
id=$(echo ${dataS} | jq -r '.[][-1][1]') | |
done | |
echo '=============================================' 1>&2 | |
echo '| start 2 |' 1>&2 | |
echo '=============================================' 1>&2 | |
getDomain() { | |
numbTry=0 | |
data=$(curl -s "https://transparencyreport.google.com/transparencyreport/api/v3/httpsreport/ct/certbyhash?hash=$(echo -en ${1} | jq -sRr @uri)") | |
for i in $(seq 1 100) | |
do | |
numbTry=$(($numbTry + 1)) | |
if [ -z "${data}" ] | |
then | |
echo "try ${1} ${numbTry}" 1>&2 | |
data=$(curl -s "https://transparencyreport.google.com/transparencyreport/api/v3/httpsreport/ct/certbyhash?hash=$(echo -en ${1} | jq -sRr @uri)") | |
else | |
break | |
fi | |
done | |
echo $data | sed "s/)]}'//g" | jq -r '.[][1][-1][]' | |
} | |
export -f getDomain | |
domains=($(IFS=$'\n';echo -e "${links[*]}" | xargs -I {} -P 5 bash -c 'getDomain "{}"' | sed 's/\*\.//g' | sort -u)) | |
IFS=$'\n';echo -e "${domains[*]}" | grep -E "\.${target}$" > targetDomain | |
IFS=$'\n';echo -e "${domains[*]}" | sed -E "/\.${target}$/d" > targetOtherDomain | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment