Updated some things

master
ice3man 2018-04-26 19:19:40 +05:30
commit 23dc782c54
2 changed files with 77 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import (
"github.com/Ice3man543/subfinder/libsubfinder/sources/certdb"
"github.com/Ice3man543/subfinder/libsubfinder/sources/certspotter"
"github.com/Ice3man543/subfinder/libsubfinder/sources/crtsh"
"github.com/Ice3man543/subfinder/libsubfinder/sources/dnsdb"
"github.com/Ice3man543/subfinder/libsubfinder/sources/dnsdumpster"
"github.com/Ice3man543/subfinder/libsubfinder/sources/findsubdomains"
"github.com/Ice3man543/subfinder/libsubfinder/sources/hackertarget"
@ -54,6 +55,7 @@ type Source struct {
Waybackarchive bool
Threatminer bool
Riddler bool
Dnsdb bool
NoOfSources int
}
@ -81,10 +83,12 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
fmt.Printf("\n[-] Searching For Subdomains in WaybackArchive")
fmt.Printf("\n[-] Searching For Subdomains in ThreatMiner")
fmt.Printf("\n[-] Searching For Subdomains in Riddler")
fmt.Printf("\n[-] Searching For Subdomains in Netcraft\n")
fmt.Printf("\n[-] Searching For Subdomains in Netcraft")
fmt.Printf("\n[-] Searching For Subdomains in Dnsdb\n")
}
sourceConfig = Source{true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, 15}
sourceConfig = Source{true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, 16}
} else {
// Check data sources and create a source configuration structure
@ -186,6 +190,12 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
}
sourceConfig.Censys = true
sourceConfig.NoOfSources = sourceConfig.NoOfSources + 1
} else if source == "dnsdb" {
if state.Silent != true {
fmt.Printf("\n[-] Searching For Subdomains in Dnsdb")
}
sourceConfig.Dnsdb = true
sourceConfig.NoOfSources = sourceConfig.NoOfSources +1
}
}
}
@ -242,6 +252,8 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
}
if sourceConfig.Censys == true {
go censys.Query(state, ch)
if sourceConfig.Dnsdb == true {
go dnsdb.Query(state, ch)
}
// Recieve data from all goroutines running

View File

@ -0,0 +1,63 @@
//
// Written By : @mehimansu (Himanshu Das)
//
// Distributed Under MIT License
// Copyrights (C) 2018 Ice3man
//
// Golang driver from dnsdb.org
package dnsdb
import (
"fmt"
"io/ioutil"
"regexp"
"strings"
"github.com/Ice3man543/subfinder/libsubfinder/helper"
)
// all subdomains found
var subdomains []string
// Query function returns all subdomains found using the service.
func Query(state *helper.State, ch chan helper.Result) {
var result helper.Result
result.Subdomains = subdomains
// Make a http request to DnsDB
resp, err := helper.GetHTTPResponse("http://www.dnsdb.org/f/"+state.Domain+".dnsdb.org/", state.Timeout)
if err != nil {
result.Error = err
ch <- result
return
}
// Get the response body
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
result.Error = err
ch <- result
return
}
src := string(body)
re := regexp.MustCompile("<a[^>]*?[^>]*>(.*?)</a>")
match := re.FindAllStringSubmatch(src, -1)
for _, subdomain := range match {
string_split := strings.Split(subdomain[0], "\">")[1]
finishedSub := strings.TrimRight(string_split, "</a>")
if state.Verbose == true {
if state.Color == true {
fmt.Printf("\n[%sDNSDB%s] %s", helper.Red, helper.Reset, finishedSub)
} else {
fmt.Printf("\n[DNSDB] %s", finishedSub)
}
}
subdomains = append(subdomains, finishedSub)
}
result.Subdomains = subdomains
result.Error = nil
ch <- result
}