Skip to content

Commit

Permalink
⚡ Trim whitespaces & Add domain mode (prints domain instead of IP add…
Browse files Browse the repository at this point in the history
…ress)
  • Loading branch information
dwisiswant0 committed Jul 4, 2020
1 parent 3db579a commit 5a849b9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,35 @@ import (
"fmt"
"net"
"os"
"strings"
"sync"
)

func main() {
concurrency := 20
flag.IntVar(&concurrency, "c", 20, "Set the concurrency level")
flag.Parse()
jobs := make(chan string)
var wg sync.WaitGroup
var domainMode bool

flag.IntVar(&concurrency, "c", 20, "Set the concurrency level")
flag.BoolVar(&domainMode, "d", false, "Prints domain instead of IP address")
flag.Parse()

for i := 0; i < concurrency; i++ {
wg.Add(1)
go func() {
for host := range jobs {
addr, err := net.LookupIP(host)
addr, err := net.LookupIP(strings.TrimSpace(host))
if err != nil {
continue
}

if !isCloudflare(addr[0]) {
fmt.Println(addr[0])
if domainMode {
fmt.Println(host)
} else {
fmt.Println(addr[0])
}
}
}
wg.Done()
Expand Down

0 comments on commit 5a849b9

Please sign in to comment.