-
-
Save wargg/04ff3aa7ee28431aa7e95e74caf481bd to your computer and use it in GitHub Desktop.
Revisions
-
mzet- revised this gist
Apr 2, 2020 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,14 @@ #!/bin/bash TARGETS="$1" PORT=443 # if file "$TARGETS" exists use its content as a target specification otherwise treat input as a cidr if [ -f "$TARGETS" ]; then IPs="$(masscan -oL - -iL "$TARGETS" -p "$PORT" 2>/dev/null | grep -v "^#.*" | cut -d' ' -f4)" else IPs="$(masscan -oL - "$TARGETS" -p "$PORT" 2>/dev/null | grep -v "^#.*" | cut -d' ' -f4)" fi extractNames() { while read LINE; do -
mzet- revised this gist
Dec 4, 2019 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,20 +6,20 @@ PORT=443 IPs="$(masscan -oL - "$CIDR" -p "$PORT" 2>/dev/null | grep -v "^#.*" | cut -d' ' -f4)" extractNames() { while read LINE; do # read Common Name part if [[ "$LINE" =~ "subject=" ]]; then CN=$(echo $LINE | awk -F "CN = " '{print $2}') # read Alt Names extension elif [[ "$LINE" =~ "DNS:" ]]; then # remove ' DNS:' substring LINE=${LINE// /} ALT_NAMES=${LINE//DNS:/} else continue fi done < /dev/stdin echo "$1:$CN,$ALT_NAMES" } [ -n "$IPs" ] && while read IP; do -
mzet- created this gist
Dec 4, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/bin/bash CIDR="$1" PORT=443 IPs="$(masscan -oL - "$CIDR" -p "$PORT" 2>/dev/null | grep -v "^#.*" | cut -d' ' -f4)" extractNames() { while read LINE; do # read Common Name part if [[ "$LINE" =~ "subject=" ]]; then CN=$(echo $LINE | awk -F "CN = " '{print $2}') # read Alt Names extension elif [[ "$LINE" =~ "DNS:" ]]; then # remove ' DNS:' substring LINE=${LINE// /} ALT_NAMES=${LINE//DNS:/} else continue fi done < /dev/stdin echo "$1:$CN,$ALT_NAMES" } [ -n "$IPs" ] && while read IP; do echo | timeout 2 openssl s_client -connect "$IP:$PORT" 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName 2>/dev/null | extractNames $IP & done <<< "$IPs" wait