Skip to content

Commit

Permalink
Merge pull request #452 from projectdiscovery/tls-probe#447
Browse files Browse the repository at this point in the history
Remove * and/or . (prefix) from target
  • Loading branch information
ehsandeep authored Dec 8, 2021
2 parents e90d82c + b0b3ae0 commit 7e80b77
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,24 @@ func (r *Runner) process(t string, wg *sizedwaitgroup.SizedWaitGroup, hp *httpx.
if scanopts.TLSProbe && result.TLSData != nil {
scanopts.TLSProbe = false
for _, tt := range result.TLSData.DNSNames {
if !r.testAndSet(tt) {
continue
}
r.process(tt, wg, hp, protocol, scanopts, output)
}
for _, tt := range result.TLSData.CommonName {
if !r.testAndSet(tt) {
continue
}
r.process(tt, wg, hp, protocol, scanopts, output)
}
}
if scanopts.CSPProbe && result.CSPData != nil {
scanopts.CSPProbe = false
for _, tt := range result.CSPData.Domains {
if !r.testAndSet(tt) {
continue
}
r.process(tt, wg, hp, protocol, scanopts, output)
}
}
Expand All @@ -686,9 +695,15 @@ func (r *Runner) process(t string, wg *sizedwaitgroup.SizedWaitGroup, hp *httpx.
if scanopts.TLSProbe && result.TLSData != nil {
scanopts.TLSProbe = false
for _, tt := range result.TLSData.DNSNames {
if !r.testAndSet(tt) {
continue
}
r.process(tt, wg, hp, protocol, scanopts, output)
}
for _, tt := range result.TLSData.CommonName {
if !r.testAndSet(tt) {
continue
}
r.process(tt, wg, hp, protocol, scanopts, output)
}
}
Expand All @@ -711,8 +726,12 @@ func (r *Runner) targets(hp *httpx.HTTPX, target string) chan string {
// A valid target does not contain:
// *
// spaces
if strings.ContainsAny(target, " *") {
return
if strings.ContainsAny(target, "*") || strings.HasPrefix(target, ".") {
// trim * and/or . (prefix) from the target to return the domain instead of wildard
target = strings.TrimPrefix(strings.Trim(target, "*"), ".")
if !r.testAndSet(target) {
return
}
}

// test if the target is a cidr
Expand Down

0 comments on commit 7e80b77

Please sign in to comment.