Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve digicert, fix issue #3, fix typo #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Handle empty responses
Improve behavior around blank result handling
  • Loading branch information
c0ldbr3w committed Nov 17, 2019
commit 262220c264b68f7fa578261c0a90cfedd9c357ed
7 changes: 5 additions & 2 deletions crtndstry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ digi()
sleep 0.5
RES=`digi $1`
fi
echo $RES | jq -r '.data.certificateDetail[].commonName,.data.certificateDetail[].subjectAlternativeNames[]' | grep -w "$1\$" | grep -v '*' | grep -v "^$1\$" | sort -u
echo $RES | jq -r '.data.certificateDetail[].commonName,.data.certificateDetail[].subjectAlternativeNames[]' | grep -w "$1\$" | grep -v '*' | grep -v "^$1\$" | sort -u || '' # || '' handles empty responses
}


Expand All @@ -20,7 +20,10 @@ certdata(){
declare -a arr=("api" "corp" "dev" "uat" "test" "stage" "sandbox" "prod" "internal")
for i in "${arr[@]}"; do
#get a list of domains based on our patterns in the array
crtsh=$(curl -s https://crt.sh/\?q\=%25$i%25.$1\&output\=json | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u | tee -a rawdata/crtsh.txt )
sub="${i}.$1"
url="https://crt.sh/?q=${sub}&output=json"
crtsh=`curl -s "${url}"`
crtsh=`echo ${crtsh} | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u | tee -a rawdata/crtsh.txt || ''`
done
#get a list of domains from certspotter
certspotter=$(curl -s https://certspotter.com/api/v0/certs\?domain\=$1 | jq '.[].dns_names[]' | sed 's/\"//g' | sed 's/\*\.//g' | sort -u | grep -w $1\$ | tee rawdata/certspotter.txt)
Expand Down