Fixed Commits

master
ice3man 2018-04-19 16:02:37 +05:30
parent 7a752e7756
commit d6b6667b1b
21 changed files with 156 additions and 9 deletions

View File

@ -1,8 +0,0 @@
{
"virustotalApikey":"",
"passivetotalUsername":"",
"passivetotalKey":"",
"securitytrailsKey":""
}

View File

@ -7,7 +7,11 @@
// Passive Subdomain Discovery Helper method
// Calls all the functions and also manages error handling
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
package passive
=======
package passive
>>>>>>> Updated Commenting Style and some other misc. changes
import (
"fmt"
@ -158,6 +162,7 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
// Create goroutines for added speed and recieve data via channels
// Check if we the user has specified custom sources and if yes, run them
// via if statements.
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
if sourceConfig.Crtsh == true {
go crtsh.Query(state, ch)
}
@ -194,6 +199,20 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
if sourceConfig.Netcraft == true {
go netcraft.Query(state, ch)
}
=======
if sourceConfig.Crtsh == true { go crtsh.Query(state, ch) }
if sourceConfig.Certdb == true { go certdb.Query(state, ch) }
if sourceConfig.Certspotter == true { go certspotter.Query(state, ch) }
if sourceConfig.Threatcrowd == true { go threatcrowd.Query(state, ch) }
if sourceConfig.Findsubdomains == true { go findsubdomains.Query(state, ch) }
if sourceConfig.Dnsdumpster == true { go dnsdumpster.Query(state, ch) }
if sourceConfig.Passivetotal == true { go passivetotal.Query(state, ch) }
if sourceConfig.Ptrarchive == true { go ptrarchive.Query(state, ch) }
if sourceConfig.Hackertarget == true { go hackertarget.Query(state, ch) }
if sourceConfig.Virustotal == true { go virustotal.Query(state, ch) }
if sourceConfig.Securitytrails == true { go securitytrails.Query(state, ch) }
if sourceConfig.Netcraft == true { go netcraft.Query(state, ch) }
>>>>>>> Updated Commenting Style and some other misc. changes
// Recieve data from all goroutines running
for i := 0; i < sourceConfig.NoOfSources; i++ {
@ -216,7 +235,11 @@ func PassiveDiscovery(state *helper.State) (finalPassiveSubdomains []string) {
validPassiveSubdomains := helper.Validate(state, uniquePassiveSubdomains)
var PassiveSubdomains []string
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
=======
>>>>>>> Updated Commenting Style and some other misc. changes
if state.Alive == true {
// Nove remove all wildcard subdomains
PassiveSubdomains = helper.RemoveWildcardSubdomains(state, validPassiveSubdomains)

View File

@ -6,9 +6,14 @@
// Copyrights (C) 2018 Ice3man
//
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
// Use like this
=======
package helper
// Use like this
// Use like this
>>>>>>> Updated Commenting Style and some other misc. changes
// fmt.Printf("[%sCRTSH%s] %s", r, rs, subdomain)
var (
Red = "\033[31;1;4m" // red color

View File

@ -70,9 +70,16 @@ func ReadConfigFile() (configuration *Config, err error) {
return &config, nil
}
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
// Returns unique items in a slice
// Adapted from http://www.golangprograms.com/remove-duplicate-values-from-slice.html
func Unique(elements []string) []string {
=======
// Returns unique items in a slice
// Adapted from http://www.golangprograms.com/remove-duplicate-values-from-slice.html
func Unique(elements []string) []string {
>>>>>>> Updated Commenting Style and some other misc. changes
// Use map to record duplicates as we find them.
encountered := map[string]bool{}
result := []string{}

View File

@ -41,4 +41,8 @@ func CheckMaxPages(config *BaseSearchConfiguration) bool {
}
return config.CurrentPageNo >= config.MaxPages
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
}
=======
}
>>>>>>> Updated Commenting Style and some other misc. changes

View File

@ -16,6 +16,10 @@ import (
"time"
)
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
=======
>>>>>>> Updated Commenting Style and some other misc. changes
// GetHTTPResponse : Returns a HTTP Response object
// It needs URL To Visit. Note, It needs full url with scheme and a timeout value.
// It returns a HTTP Response object
@ -47,9 +51,15 @@ func GetHTTPResponse(url string, timeout int) (resp *http.Response, err error) {
}
// GetHTTPResponse : Returns a HTTP Response object
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
// It needs URL To Visit and a cookie array to send with request.
// Note, It needs full url with scheme and a timeout value.
// It returns a HTTP Response object with a cookie array.
=======
// It needs URL To Visit and a cookie array to send with request.
// Note, It needs full url with scheme and a timeout value.
// It returns a HTTP Response object with a cookie array.
>>>>>>> Updated Commenting Style and some other misc. changes
func GetHTTPCookieResponse(urls string, cookies []*http.Cookie, timeout int) (resp *http.Response, cookie []*http.Cookie, err error) {
var curCookieJar *cookiejar.Jar

View File

@ -12,7 +12,11 @@ import (
"fmt"
"net"
"strings"
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
"sync"
=======
>>>>>>> Updated Commenting Style and some other misc. changes
//"github.com/miekg/dns"
)
@ -42,6 +46,7 @@ func InitializeWildcardDNS(state *State) bool {
// Checks if a given subdomain is a wildcard subdomain
// It takes Current application state, Domain to find subdomains for
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
func CheckWildcardSubdomain(state *State, domain string, words <-chan string, wg *sync.WaitGroup) {
defer wg.Done()
@ -61,6 +66,26 @@ func CheckWildcardSubdomain(state *State, domain string, words <-chan string, wg
}
} else {
}
=======
func CheckWildcardSubdomain(state *State, domain string, words chan string, donech chan struct{}, result chan string) {
for target := range channel {
preparedSubdomain := target + "." + domain
ipAddress, err := net.LookupHost(preparedSubdomain)
if err == nil {
// No eror, let's see if it's a Wildcard subdomain
if !state.WildcardIPs.ContainsAny(ipAddress) {
channel <- preparedSubdomain
} else {
// This is likely a wildcard entry, skip it
channel <- ""
}
} else {
channel <- ""
}
channel <- ""
>>>>>>> Updated Commenting Style and some other misc. changes
}
}
@ -73,20 +98,42 @@ func RemoveWildcardSubdomains(state *State, subdomains []string) []string {
var wg sync.WaitGroup
var channel = make(chan string)
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
wg.Add(state.Threads)
for i := 0; i < state.Threads; i++ {
go CheckWildcardSubdomain(state, state.Domain, channel, &wg)
}
=======
wg.Add(state.Threads)
for i := 0; i < state.Threads; i++ {
go func() {
CheckWildcardSubdomain(state, state.Domain, channel)
wg.Done()
}()
}
>>>>>>> Updated Commenting Style and some other misc. changes
for _, entry := range subdomains {
sub := strings.Join(strings.Split(entry, ".")[:2][:], ".")
fmt.Printf("\n[!] %s", sub+"."+state.Domain)
channel <- sub
}
close(channel)
wg.Wait()
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
return state.FinalResults
}
=======
close(channel)
wg.Wait()
return validSubdomains
}
>>>>>>> Updated Commenting Style and some other misc. changes

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -54,6 +54,10 @@ func findSubdomains(link string, state *helper.State, channel chan []string) {
return
}
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
=======
>>>>>>> Updated Commenting Style and some other misc. changes
// Query function returns all subdomains found using the service.
func Query(state *helper.State, ch chan helper.Result) {

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License
@ -28,7 +32,11 @@ var globalSubdomains []string
var gCookies []*http.Cookie
// Local function to recursively enumerate subdomains until no subdomains
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
// are left
=======
// are left
>>>>>>> Updated Commenting Style and some other misc. changes
func enumerate(state *helper.State, baseUrl string) (err error) {
// Make a http request to Netcraft

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -1,4 +1,8 @@
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
//
=======
//
>>>>>>> Updated Commenting Style and some other misc. changes
// Written By : @ice3man (Nizamul Rana)
//
// Distributed Under MIT License

View File

@ -27,6 +27,10 @@ type virustotalapi_object struct {
var virustotalapi_data virustotalapi_object
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
=======
>>>>>>> Updated Commenting Style and some other misc. changes
// Local function to query virustotal API
// Requires an API key
func queryVirustotalApi(state *helper.State) (subdomains []string, err error) {

View File

@ -62,12 +62,15 @@ func main() {
os.Exit(1)
}
<<<<<<< 9ae536175028cdedecd50144bfd7999d5e0e09e6
if state.Silent != true {
fmt.Println(banner)
fmt.Printf("\nSubFinder v0.1.0 Made with %s❤%s by @Ice3man", helper.Green, helper.Reset)
fmt.Printf("\n==================================================")
}
=======
>>>>>>> Updated Commenting Style and some other misc. changes
if state.Domain == "" {
if state.Silent != true {
fmt.Printf("\n\nsubfinder: Missing domain argument\nTry './subfinder -h' for more information\n")