Exemplo n.º 1
0
func createDomainList(prefixes, suffixes, psl []string) (domains []string) {
	fmt.Print("Creating domain list... ")
	domains = name.Combine(prefixes, suffixes, psl, *single, *hyphenate, *itself, *hacks, *fuse, *minLength)
	if !*includeUTF8 {
		domains = wordlist.FilterUTF8(domains)
	}
	domains = name.FilterMaxLength(domains, *maxLength)
	if *strictMode {
		domains = name.FilterStrictDomains(domains, ns.PublicSuffixes)
	}
	domains = wordlist.RemoveDuplicates(domains)
	fmt.Println("done.")
	if len(domains) == 0 {
		showErrorAndExit(errors.New("I could not generate a single valid domain"), 50)
	}
	return
}
Exemplo n.º 2
0
// ParsePublicSuffixCSV parse a CSV string into a cleaned slice of strings
func ParsePublicSuffixCSV(csv string, accepted map[string]bool, includeTLDs bool) ([]string, error) {
	psl := wordlist.FromCSV(csv)
	for _, ps := range psl {
		_, ok := accepted[ps]
		if !ok {
			return nil, fmt.Errorf("Public Suffix %q is unknown", ps)
		}
	}
	if includeTLDs {
		for ps := range accepted {
			if !strings.Contains(ps, ".") {
				psl = append(psl, ps)
			}
		}
	}
	psl = wordlist.RemoveDuplicates(psl)
	sort.Strings(psl)
	return psl, nil
}
Exemplo n.º 3
0
// ParseDNSCSV parse a CSV string into a cleaned slice of strings
func ParseDNSCSV(csv string) []string {
	psl := wordlist.FromCSV(csv)
	psl = wordlist.RemoveDuplicates(psl)
	sort.Strings(psl)
	return psl
}