Added PTRArchive Data Source

master
ice3man 2018-04-07 18:39:06 +05:30
parent c2789a771a
commit 513b742790
3 changed files with 88 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import (
"subfinder/libsubfinder/sources/findsubdomains"
"subfinder/libsubfinder/sources/dnsdumpster"
"subfinder/libsubfinder/sources/passivetotal"
"subfinder/libsubfinder/sources/ptrarchive"
"subfinder/libsubfinder/sources/threatcrowd"
"subfinder/libsubfinder/sources/virustotal"
"subfinder/libsubfinder/sources/netcraft"
@ -37,11 +38,12 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
fmt.Printf("\n[-] Searching For Subdomains in Findsubdomains")
fmt.Printf("\n[-] Searching For Subdomains in DNSDumpster")
fmt.Printf("\n[-] Searching For Subdomains in PassiveTotal")
fmt.Printf("\n[-] Searching For Subdomains in PTRArchive")
fmt.Printf("\n[-] Searching For Subdomains in Hackertarget")
fmt.Printf("\n[-] Searching For Subdomains in Virustotal")
fmt.Printf("\n[-] Searching For Subdomains in Netcraft\n")
ch := make(chan helper.Result, 9)
ch := make(chan helper.Result, 10)
// Create goroutines for added speed and recieve data via channels
go crtsh.Query(state, ch)
@ -50,12 +52,13 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
go findsubdomains.Query(state, ch)
go dnsdumpster.Query(state, ch)
go passivetotal.Query(state, ch)
go ptrarchive.Query(state, ch)
go threatcrowd.Query(state, ch)
go virustotal.Query(state, ch)
go netcraft.Query(state, ch)
// recieve data from all goroutines running
for i := 1; i <= 9; i++ {
for i := 1; i <= 10; i++ {
result := <-ch
if result.Error != nil {

View File

@ -98,4 +98,9 @@ func Query(state *helper.State, ch chan helper.Result) {
result.Error = nil
ch <-result
}
result.Subdomains = subdomains
result.Error = nil
ch <- result
return
}

View File

@ -0,0 +1,78 @@
//
// ptrarchive.go : A PTRArchive subdomain parser in golang
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License
// Copyrights (C) 2018 Ice3man
//
package ptrarchive
import (
"io/ioutil"
"fmt"
"regexp"
"subfinder/libsubfinder/helper"
)
// all subdomains found
var subdomains []string
//
// Query : Queries awesome DNSDumpster service for subdomains
// @param state : current application state, holds all information found
//
func Query(state *helper.State, ch chan helper.Result) {
var result helper.Result
result.Subdomains = subdomains
// Make a http request to Netcraft
resp, err := helper.GetHTTPResponse("http://ptrarchive.com/tools/search2.htm?label="+state.Domain+"&date=ALL", 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)
// Parse Subdomains found
Regex, _ := regexp.Compile("] (.*) \\[")
match := Regex.FindAllStringSubmatch(src, -1)
// String to hold initial subdomains
var initialSubs []string
for _, data := range match {
initialSubs = append(initialSubs, data[1])
}
validSubdomains := helper.Validate(state, initialSubs)
for _, subdomain := range validSubdomains {
if state.Verbose == true {
if state.Color == true {
fmt.Printf("\n[%sPTRARCHIVE%s] %s", helper.Red, helper.Reset, subdomain)
} else {
fmt.Printf("\n[PTRARCHIVE] %s", subdomains)
}
}
subdomains = append(subdomains, subdomain)
}
result.Subdomains = subdomains
result.Error = nil
ch <-result
}