mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-05 18:38:52 +02:00
Add files via upload
This commit is contained in:
@@ -767,7 +767,7 @@ func (h *FofaHandler) searchQuake(c *gin.Context, req fofaSearchRequest, apiKey
|
||||
body["include"] = fields
|
||||
}
|
||||
var apiResp struct {
|
||||
Code int `json:"code"`
|
||||
Code interface{} `json:"code"`
|
||||
Message string `json:"message"`
|
||||
TotalCount int `json:"total_count"`
|
||||
Data []map[string]interface{} `json:"data"`
|
||||
@@ -780,7 +780,7 @@ func (h *FofaHandler) searchQuake(c *gin.Context, req fofaSearchRequest, apiKey
|
||||
if !h.doJSONRequest(c, http.MethodPost, u.String(), apiKey, "X-QuakeToken", body, &apiResp, "Quake") {
|
||||
return
|
||||
}
|
||||
if apiResp.Code != 0 {
|
||||
if !isZeroSpaceSearchCode(apiResp.Code) {
|
||||
msg := strings.TrimSpace(apiResp.Message)
|
||||
if msg == "" {
|
||||
msg = "Quake 返回错误"
|
||||
@@ -801,6 +801,23 @@ func (h *FofaHandler) searchQuake(c *gin.Context, req fofaSearchRequest, apiKey
|
||||
})
|
||||
}
|
||||
|
||||
func isZeroSpaceSearchCode(code interface{}) bool {
|
||||
switch v := code.(type) {
|
||||
case nil:
|
||||
return false
|
||||
case int:
|
||||
return v == 0
|
||||
case int64:
|
||||
return v == 0
|
||||
case float64:
|
||||
return v == 0
|
||||
case string:
|
||||
return strings.TrimSpace(v) == "0"
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (h *FofaHandler) searchShodan(c *gin.Context, req fofaSearchRequest, apiKey string) {
|
||||
baseURL := strings.TrimRight(h.resolveBaseURL("shodan"), "/") + "/shodan/host/search"
|
||||
u, err := url.Parse(baseURL)
|
||||
|
||||
Reference in New Issue
Block a user