func (p *Parser) Exec(d domains.Domain) ([]records.Record, error) { out, err := exec.Command("dig", "all", d.String()).Output() if err != nil { return []records.Record{}, err } date := time.Now() origin := d.TLD.Name + "." lines := strings.Split(strings.ToLower(string(out)), "\n") results := make([]records.Record, 0) for _, line := range lines { if len(line) == 0 || line[0] == ';' { continue } rr, err := records.New(line, origin, d.TLD, 86400, date, 0) if err != nil { log.Error("%s: %s", line, err) continue } err = rr.Insert() if err != nil { //log.Error("%s: %s", line, err) continue } results = append(results, rr) } return results, nil }
func (p *Parser) Exec(d domains.Domain) (whois.Record, error) { out, err := exec.Command("pwhois", "-j", d.String()).Output() if err != nil { log.Error("Whois error for " + d.String()) return whois.Record{}, err } w, err := whois.New(d, out) if err != nil { log.Error("Parse Whois for %s: %s", d.String(), err) return w, err } return w, w.Insert() }