Skip to content

Commit

Permalink
fix: active mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAyrix committed May 22, 2023
1 parent e0eb545 commit c1c95c0
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bufio"
"bytes"
"crypto/tls"
"flag"
"fmt"
"github.com/projectdiscovery/goflags"
Expand Down Expand Up @@ -41,7 +42,7 @@ var input, output, savePath, cachePath, provider, providers, append_provider, ap
var isSilent, showVersion, activeMode bool
var thread int

const VERSION = "1.0.24"
const VERSION = "1.0.25"

func main() {
var allRange []*net.IPNet
Expand Down Expand Up @@ -316,14 +317,22 @@ func checkAndWrite(allCidr []*net.IPNet, channel chan string, output string) {
isIpForCDN = true
}
}
if activeMode {
if activeMode && !isIpForCDN {
ptrRecords := getPtrRecord(string(ip))
for _, v := range ptrRecords {
if strings.Contains(v, "akamaitechnologies.com") {
isIpForCDN = true
}
}
}

if activeMode && !isIpForCDN {
http_server_header := getHttpHeader("http://" + string(ip))
if http_server_header == "AkamaiGHost" {
isIpForCDN = true
}
}

if !isIpForCDN {
if output == "CLI" {
fmt.Println(ip)
Expand Down Expand Up @@ -423,3 +432,14 @@ func getPtrRecord(ip string) []string {
ptr, _ := net.LookupAddr(ip)
return ptr
}

func getHttpHeader(url string) string {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0")
resp, err := http.Get(url)
if err == nil {
return resp.Header.Get("Server")
}
return ""
}

0 comments on commit c1c95c0

Please sign in to comment.