예제 #1
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
}
예제 #2
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
}