Last active
September 3, 2019 12:47
-
-
Save NicholasLeader/b13697039d4a1f7288bf4635d4301bfd to your computer and use it in GitHub Desktop.
PowerShell PoC to grab the 'CN' common name of the SSL/TLS cert of an IP - leveraging NMAP SSL-cert script
This file contains 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
<# | |
Nicholas Leader | |
9.3.2019 | |
PowerShell PoC to grab the 'CN' common name of the SSL/TLS cert of an IP | |
Script takes an array of IPs as input in the script, but could be modified to pull from a CSV, etc | |
Script is leveraging 'Invoke-Command' to run an NMAP script | |
Using 'Select-string' to pull the relevent line of the NMAP script output | |
Requires: | |
PowerShell | |
NMAP (need to be callable via PATH environmental variable) | |
#> | |
## these example IPs are Twitter IPs | |
$ips = @("199.59.148.10","199.59.148.11") | |
$ips | | |
ForEach-Object {Invoke-Command {nmap --script ssl-cert $_} | | |
select-string "ssl-cert: Subject: commonName=" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment