Skip to content

Commit 1dcb54b

Browse files
authored
Update Get-SSLCertInfo-CTFR.psm1
1 parent e8a32fb commit 1dcb54b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

Get-SSLCertInfo-CTFR.psm1

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Get-SSLCertInfo-CTFR
33
<#
44
Script: Get-SSLCertInfo-CTFR
55
6-
Version: 2.3
6+
Version: 2.4
77
88
Description
99
This script can be used to download domain name information
@@ -141,7 +141,11 @@ function Get-SSLCertInfo-CTFR
141141

142142
}
143143

144-
# For return a list of Resolved IPs
144+
# For tracking domain list
145+
$DomainsTbl = New-Object System.Data.DataTable
146+
$DomainsTbl.Columns.Add("Domain") | Out-Null
147+
148+
# For returning a list of Resolved IPs
145149
$DomainsFound = New-Object System.Data.DataTable
146150
$DomainsFound.Columns.Add("Domain") | Out-Null
147151
$DomainsFound.Columns.Add("CertDomain") | Out-Null
@@ -168,7 +172,11 @@ function Get-SSLCertInfo-CTFR
168172
if((Test-Path $domainList)){
169173

170174
$ProvidedDomains = gc $domainList
171-
$DomainCount = $ProvidedDomains.count
175+
$ProvidedDomains |
176+
ForEach-Object{
177+
$DomainsTbl.Rows.Add($_) | Out-Null
178+
}
179+
$DomainCount = $DomainsTbl.Rows.Count
172180
Write-Verbose "Imported $DomainCount domain/keyword targets from the provided file."
173181
}else{
174182
Write-Verbose "Couldn't find $domainList, aborting."
@@ -178,7 +186,7 @@ function Get-SSLCertInfo-CTFR
178186

179187
# Append domains to list of
180188
if($domain){
181-
$ProvidedDomains += "$domain"
189+
$DomainsTbl.Rows.Add("$domain") | Out-Null
182190
Write-Verbose "Imported 1 domain/keyword targets from command line."
183191
}
184192
}
@@ -187,16 +195,20 @@ function Get-SSLCertInfo-CTFR
187195
{
188196
# Append pipline domains to list of
189197
if($_){
190-
$ProvidedDomains += "$_"
191-
Write-Verbose "Imported 1 domain targets from pipeline."
198+
$DomainsTbl.Rows.Add("$domain") | Out-Null
192199
}
193200

201+
202+
}
203+
204+
End
205+
{
194206
# Check for list of targets
195-
if(-not $ProvidedDomains){
207+
if($DomainsTbl.Rows.Count -eq 0){
196208
Write-Verbose "No targets have been provided, aborting."
197209
#break
198210
}else{
199-
$ProvidedDomains = $ProvidedDomains |Select -Unique
211+
$ProvidedDomains = $DomainsTbl |Select Domain -ExpandProperty Domain -Unique
200212
$DomainCount = $ProvidedDomains.count
201213
Write-Verbose "Targeting $DomainCount unique domains/keywords."
202214
}
@@ -467,11 +479,7 @@ function Get-SSLCertInfo-CTFR
467479
$doc | Out-File $outfileName
468480
}
469481

470-
}
471-
}
472-
473-
End
474-
{
482+
}
475483
# Check for potential ad domains
476484
if($ShowAdDomains){
477485

0 commit comments

Comments
 (0)