Closed codingo closed 4 years ago
In theory, this could work for single output files but what about multiple output files? @codingo
I think we focus on 1:1 for now between two files. I'm still giving some further thought to the best way to approach multiple files and will raise a new issue / merge once we've tackled it.
Sure. :+1:
Awesome idea @codingo!
Guys, this is how this should work. I am a little busy, so i can't add it now. If anyone can do it now, it would be cool. Else, i will do it someday.
func SliceExists(slice interface{}, item interface{}) bool {
s := reflect.ValueOf(slice)
if s.Kind() != reflect.Slice {
panic("SliceExists() given a non-slice type")
}
for i := 0; i < s.Len(); i++ {
if s.Index(i).Interface() == item {
return true
}
}
return false
}
....
var outputSubs []string
// Here, we perform checks for newly added subdomains
if oldList != "" {
var oldSubs []string
file, err := os.Open(oldList)
if err != nil {
fmt.Fprintf(os.Stderr, "\nerror: %v\n", err)
os.Exit(1)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
oldSubs = append(oldSubs, scanner.Text())
}
// Check each subdomain found and if not in old list,
// add them to the correct array
for _, sub := range subsReturned {
if SliceExists(oldSubs, sub) != true {
outputSubs = append(outputSubs, sub)
}
}
} else {
outputSubs = append(outputSubs, subsReturned...)
}
_ = WriteOutputText(outputSubs)
Hello there, Need some help here. How can I add this? Regard. @panchocosil
I gave an example above. If you have futhur questions, please comment!
Closing this as its outside scope of subfinder!
Identifying new and old subdomains would be valuable and having a flag to pass in a previous scan of a domain to compare results against would prove valuable.
Essentially - I scan subdomain x into output x.txt on day y
On day z I rescan x, but I pass the flag --dif x.txt and it compares the results of scan z against my previous scan and lets me know what has changed.
This not only may help identify new techniques for takeovers but will also help identify potential development or pre-production hosts.