Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
careyjames committed Oct 14, 2023
1 parent d86064f commit f2b5dd6
Showing 1 changed file with 43 additions and 27 deletions.
70 changes: 43 additions & 27 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,36 +314,13 @@ func main() {
}

if !isIP {
ips, _ := net.LookupIP(input)
if len(ips) > 0 {
fmt.Printf("\033[38;5;39m Resolved IPs: \033[38;5;78m%s\033[0m\n", strings.Join(ipsToStrings(ips), ", "))
}
resolvedIPPrompt(input)

ns, _ := getNS(input)
if len(ns) > 0 {
fmt.Printf("\033[38;5;39m Name Servers: \033[38;5;78m%s\033[0m\n", strings.Join(ns, ", "))
} else {
fmt.Printf("\033[38;5;39m Name Servers: \033[0m\033[38;5;88mNone\033[0m\n")
}
getNSPrompt(input)

mx, _ := getMX(input)
if len(mx) > 0 {
fmt.Printf("\033[38;5;39m MX Records: \033[38;5;78m%s\033[0m\n", strings.Join(mx, ", "))
} else {
fmt.Printf("\033[38;5;39m MX Records: \033[0m\033[38;5;88mNo MX, No email.\033[0m\n")
}
getMXPrompt(input)

txt, _ := getTXT(input)
if len(txt) > 0 {
fmt.Printf("\033[38;5;39m TXT Records:\033[0m\n")
for _, record := range txt {
isValidSPF := strings.HasPrefix(record, "v=spf1")
coloredRecord := colorCodeSPFRecord(record, isValidSPF)
fmt.Printf(" %s\n", coloredRecord)
}
} else {
fmt.Printf("\033[38;5;39m TXT Records: \033[0m\033[38;5;88mNone\033[0m\n")
}
getTXTPrompt(input)

dmarc, _ := getDMARC(input)
if dmarc != "" {
Expand Down Expand Up @@ -407,3 +384,42 @@ func main() {
}
}
}

func resolvedIPPrompt(input string) {
ips, _ := net.LookupIP(input)
if len(ips) > 0 {
fmt.Printf("\033[38;5;39m Resolved IPs: \033[38;5;78m%s\033[0m\n", strings.Join(ipsToStrings(ips), ", "))
}
}

func getNSPrompt(input string) {
ns, _ := getNS(input)
if len(ns) > 0 {
fmt.Printf("\033[38;5;39m Name Servers: \033[38;5;78m%s\033[0m\n", strings.Join(ns, ", "))
} else {
fmt.Printf("\033[38;5;39m Name Servers: \033[0m\033[38;5;88mNone\033[0m\n")
}
}

func getMXPrompt(input string) {
mx, _ := getMX(input)
if len(mx) > 0 {
fmt.Printf("\033[38;5;39m MX Records: \033[38;5;78m%s\033[0m\n", strings.Join(mx, ", "))
} else {
fmt.Printf("\033[38;5;39m MX Records: \033[0m\033[38;5;88mNo MX, No email.\033[0m\n")
}
}

func getTXTPrompt(input string) {
txt, _ := getTXT(input)
if len(txt) > 0 {
fmt.Printf("\033[38;5;39m TXT Records:\033[0m\n")
for _, record := range txt {
isValidSPF := strings.HasPrefix(record, "v=spf1")
coloredRecord := colorCodeSPFRecord(record, isValidSPF)
fmt.Printf(" %s\n", coloredRecord)
}
} else {
fmt.Printf("\033[38;5;39m TXT Records: \033[0m\033[38;5;88mNone\033[0m\n")
}
}

0 comments on commit f2b5dd6

Please sign in to comment.