Skip to content

Commit 19516be

Browse files
committed
Regex Patch 2
An attempt to remove entries containing spaces (invalid hostnames where a company name is in the CT logs instead)
1 parent 613e354 commit 19516be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pSSL.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
$targetDomain = Read-Host "Enter the target domain name"
22
$pwd = Get-Location
33
(Invoke-WebRequest -Uri "https://crt.sh/?q=%.$targetDomain&output=json" -Method Get -UserAgent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0').Content | Out-File $pwd\$targetDomain-ct-log.json -Encoding utf8 -Force
4-
get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "[a-zA-Z0-9.-_]" | Sort-Object -Unique | Out-String -Stream
5-
get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "[a-zA-Z0-9.-_]" | Sort-Object -Unique | Out-String -Stream | more
6-
$domainNames = ( get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "[a-zA-Z0-9.-_]" | Sort-Object -Unique | Out-String -Stream )
4+
get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "^[a-zA-Z0-9.-_]*.[a-zA-Z0-9]$" | Sort-Object -Unique | Out-String -Stream
5+
get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "^[a-zA-Z0-9.-_]*.[a-zA-Z0-9]$"| Sort-Object -Unique | Out-String -Stream | more
6+
$domainNames = ( get-content $pwd\$targetDomain-ct-log.json | ConvertFrom-Json | Sort-Object -Unique | Sort-Object -Property name_value -Descending | Format-Table -Wrap -AutoSize -Property name_value | grep -o -P "^[a-zA-Z0-9.-_]*.[a-zA-Z0-9]$" | Sort-Object -Unique | Out-String -Stream )
77
New-Item -ItemType File $pwd\$targetDomain-enumerated-pssl.txt -Force
88
foreach ($domainName in $domainNames){ Invoke-RestMethod -ErrorAction Ignore -Method Get https://dns.google/resolve?name=$domainName | Select-Object -ExpandProperty Answer -ErrorAction Ignore | Format-Table -Wrap -AutoSize -Property "name","data" -HideTableHeaders | Tee-Object $pwd\$targetDomain-enumerated-pssl.txt -Append -ErrorAction Ignore }
99
Write-Host " "
1010
Write-Host "Formatting Results to Table..." -ForegroundColor Red
1111
Write-Host " "
12-
Get-Content $pwd\$targetDomain-enumerated-pssl.txt | grep "[a-zA-Z0-9.-_]" | Out-File $pwd\$targetDomain-hostname-table-pssl.txt -Force utf8
12+
Get-Content $pwd\$targetDomain-enumerated-pssl.txt | grep "^[a-zA-Z0-9.-_]*.[a-zA-Z0-9]$" | Out-File $pwd\$targetDomain-hostname-table-pssl.txt -Force utf8
1313
Get-Content $pwd\$targetDomain-hostname-table-pssl.txt
1414
Write-Host " "
1515
Write-Host "Parsing source IPv4 addresses..." -ForegroundColor Red

0 commit comments

Comments
 (0)