Well i have been learning golang(Go) in this silence while in my intern. I intend to make EZ love Go.
Here we go$isemail kenjoe41@evilzone.org
tada;;
package main
import (
"fmt"
"log"
"net"
"os"
"regexp"
"strings"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: isemail Email-Address : \nE.g. $isemail kenjoe41@mailinator.com\n")
os.Exit(1)
}
email := os.Args[1]
re := regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") //regex for email structure;
if re.MatchString(email) {
fmt.Print("Email-Address structure is valid...\n")
} else {
log.Fatal("[-]Wrong Email-Address structure!\n")
}
//split email into uname and host
email_parts := strings.Split(email, "@") //returns an array
host := email_parts[1]
if _, err := net.LookupHost(host); err != nil {
fmt.Printf("[-]But DNS lookup failed for host: %s \n", host)
log.Fatal(err)
} else {
fmt.Print("[+]And Dns lookup was successful!\n")
}
fmt.Print("[\u263A]Email Address %v is valid.\n", email)//smile
}[/code