Skip to content

Commit

Permalink
🐞 fix(reverse_check): fix false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
WAY29 committed Feb 8, 2023
1 parent 178f646 commit 2a4f1a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/xray/cel/implementation.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ func xrayNewReverse() (reverse *structs.Reverse) {
urlStr string
)
reverse = ReversePool.Get().(*structs.Reverse)
reverse.IsDomainNameServer = false
reverse.ReverseType = common_structs.ReversePlatformType

switch common_structs.ReversePlatformType {
case structs.ReverseType_Ceye:
Expand All @@ -497,7 +499,7 @@ func xrayNewReverse() (reverse *structs.Reverse) {
content, _ := requests.GetRespBody(resp)
urlStr = "http://" + string(content) + "/"
default:
return
panic("Reverse platform type error")
}

u, _ := url.Parse(urlStr)
Expand All @@ -506,8 +508,6 @@ func xrayNewReverse() (reverse *structs.Reverse) {
reverse.Url = requests.ParseUrl(u)
reverse.Domain = u.Hostname()
reverse.Ip = u.Host
reverse.IsDomainNameServer = false
reverse.ReverseType = common_structs.ReversePlatformType

return
}
Expand All @@ -527,7 +527,7 @@ func reverseCheck(r *structs.Reverse, timeout int64) bool {
}
content, _ := requests.GetRespBody(resp)

if !bytes.Contains(content, []byte(`"data": []`)) { // api返回结果不为空
if resp.StatusCode == 200 && len(content) > 0 && !bytes.Contains(content, []byte(sub)) { // api返回结果不为空
utils.DebugF("Got reverse dnslog from %s", r.Domain)
return true
}
Expand Down

0 comments on commit 2a4f1a7

Please sign in to comment.