|
1 | 1 | $targetDomain = Read-Host "Enter the target domain name" |
2 | 2 | $pwd = Get-Location |
3 | 3 | (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.-_]*.[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 ) |
| 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 ) |
7 | 7 | New-Item -ItemType File $pwd\$targetDomain-enumerated-pssl.txt -Force |
8 | 8 | 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 } |
9 | 9 | Write-Host " " |
10 | 10 | Write-Host "Formatting Results to Table..." -ForegroundColor Red |
11 | 11 | Write-Host " " |
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 |
| 12 | +Get-Content $pwd\$targetDomain-enumerated-pssl.txt | grep "[a-zA-Z0-9]" | Out-File $pwd\$targetDomain-hostname-table-pssl.txt -Force utf8 |
13 | 13 | Get-Content $pwd\$targetDomain-hostname-table-pssl.txt |
14 | 14 | Write-Host " " |
15 | 15 | Write-Host "Parsing source IPv4 addresses..." -ForegroundColor Red |
16 | 16 | Write-Host " " |
17 | | -Get-Content $pwd\$targetDomain-hostname-table-pssl.txt | awk -F ' ' '{ print $2 }' | grep -o -P "^[0-9].*[.].*" | Sort-Object -Unique | Out-File $pwd\$targetDomain-enumeration-list-ipv4-addrs.txt utf8 -Force |
18 | | -Get-Content $pwd\$targetDomain-hostname-table-pssl.txt | awk -F ' ' '{ print $2 }' | grep -o -P "^[0-9].*[.].*" | Sort-Object -Unique | awk -F ' ' '{ print }{++cnt} END { print cnt }' |
| 17 | +Get-Content $pwd\$targetDomain-hostname-table-pssl.txt | awk -F ' ' '{ print $2 }' | grep -o -P "^[0-9].*" | Sort-Object -Unique | Out-File $pwd\$targetDomain-enumeration-list-ipv4-addrs.txt utf8 -Force |
| 18 | +Get-Content $pwd\$targetDomain-hostname-table-pssl.txt | awk -F ' ' '{ print $2 }' | grep -o -P "^[0-9].*" | Sort-Object -Unique | awk -F ' ' '{ print }{++cnt} END { print cnt }' |
19 | 19 | Write-Host " " |
20 | 20 | Write-Host "Results saved to the following locations: " -ForegroundColor Red |
21 | 21 | Write-Host "$pwd\$targetDomain-ct-log.json" |
|
0 commit comments