Skip to content

Commit

Permalink
Fix printing bug when WHOIS contains \r characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Kemp committed Apr 15, 2020
1 parent 1348357 commit 4e763d1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ var whoisMatchers = []matcher{
var emailMatchers = []*regexp.Regexp{
regexp.MustCompile(`(?i)(abuse@[a-z0-9\-.]*)`),
regexp.MustCompile(`(?m)^OrgAbuseEmail:\s+(.*)$`),
regexp.MustCompile(`(?m)^Registrar Abuse Contact Email:\s+(.*)$`),
regexp.MustCompile(`(?m)^Registrar Abuse Contact Email:\s+(.+)$`),
}

func fallbackEmailMatcher(header, domain, whois string) (bool, func()) {
var emails = map[string]struct{}{}
for _, matcher := range emailMatchers {
for _, email := range matcher.FindAllStringSubmatch(whois, -1) {
emails[email[1]] = struct{}{}
emails[strings.TrimSpace(email[1])] = struct{}{}
}
}
if len(emails) == 0 {
Expand Down Expand Up @@ -98,12 +98,9 @@ func userSaysYes() bool {
okayResponses := map[string]bool{
"": true,
"y": true,
"Y": true,
"yes": true,
"Yes": true,
"YES": true,
}
if okayResponses[response] {
if okayResponses[strings.ToLower(response)] {
return true
}
return false
Expand Down

0 comments on commit 4e763d1

Please sign in to comment.