From 128aad3a513e3f30d9895ae9b65224ffb5360d3a Mon Sep 17 00:00:00 2001 From: rootphantomer Date: Thu, 15 Sep 2022 10:17:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20-qt=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++----- src/apis/api.go | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4fd904c..48e847d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ * @Author: ph4nt0mer * @Date: 2022-09-01 18:39:52 * @LastEditors: rootphantomer - * @LastEditTime: 2022-09-14 14:11:00 + * @LastEditTime: 2022-09-15 10:10:17 * @FilePath: /quake_go/README.md * @Description: * @@ -74,14 +74,15 @@ rust 项目代码 移步这里——https://github.com/360quake/quake_rs/ ```bash Starting Quake Cli... -usage: quake [option] [-e,end_time time=2022-09-07 16:47:32] [-fe,field string] [-h,help bool] [-ic,ignore_cache bool=false] [-qt,query_txt string] [-sz,size string=10] [-st,start string=0] [-s,start_time time=2022-01-01] +usage: quake [option] [args] [-e,end_time time=2022-09-15 10:10:04] [-fe,field string] [-h,help bool] [-ic,ignore_cache bool=false] [-qt,query_txt string] [-sz,size string=10] [-st,start string=0] [-s,start_time time=2022-01-01] positional options: - option [string] init,info,search + option [string] init,info,search,host + args [string] query value,example port:443 options: - -e, --end_time [time=2022-09-07 16:47:32] -e time to end time flag - -fe, --field [string] -fe body to show body infomation + -e, --end_time [time=2022-09-15 10:10:04] -e time to end time flag + -fe, --field [string] -fe swich body,title,host,html_hash,x_powered_by to show infomation -h, --help [bool] show usage -ic, --ignore_cache [bool=false] -ic true or false,default false -qt, --query_txt [string] -qt ./file.txt file to query search diff --git a/src/apis/api.go b/src/apis/api.go index 8e3b7fe..050ab7c 100644 --- a/src/apis/api.go +++ b/src/apis/api.go @@ -2,7 +2,7 @@ * @Author: ph4nt0mer * @Date: 2022-09-01 15:36:10 * @LastEditors: rootphantomer - * @LastEditTime: 2022-09-15 10:03:03 + * @LastEditTime: 2022-09-15 10:16:42 * @FilePath: /quake_go/src/apis/api.go * @Description:封装请求接口 * @@ -38,11 +38,6 @@ func SearchServicePost(reqjson Reqjson, token string) { // "end_time": "2021-02-01 00:00:00" // }' uri := "/search/quake_service" - reqjson.Query = strings.ReplaceAll(reqjson.Query, " ", "") - if reqjson.Query == "" || reqjson.Query == "?" { - fmt.Println("No query specified") - return - } if reqjson.Query_txt != "" { bytedata, _ := utils.ReadLine(reqjson.Query_txt) tmp := "" @@ -56,6 +51,12 @@ func SearchServicePost(reqjson Reqjson, token string) { } // fmt.Println(tmp) reqjson.Query = tmp + } else { + reqjson.Query = strings.ReplaceAll(reqjson.Query, " ", "") + if reqjson.Query == "" || reqjson.Query == "?" { + fmt.Println("No query specified") + return + } } datajson, err := json.Marshal(reqjson) if err != nil { @@ -144,11 +145,6 @@ func HostSearchPost(reqjson Reqjson, token string) { // }' uri := "/search/quake_host" - reqjson.Query = strings.ReplaceAll(reqjson.Query, " ", "") - if reqjson.Query == "" || reqjson.Query == "?" { - fmt.Println("No query specified") - return - } if reqjson.Query_txt != "" { bytedata, _ := utils.ReadLine(reqjson.Query_txt) tmp := "" @@ -162,7 +158,14 @@ func HostSearchPost(reqjson Reqjson, token string) { } // fmt.Println(tmp) reqjson.Query = tmp + } else { + reqjson.Query = strings.ReplaceAll(reqjson.Query, " ", "") + if reqjson.Query == "" || reqjson.Query == "?" { + fmt.Println("No query specified") + return + } } + datajson, err := json.Marshal(reqjson) if err != nil { panic(err)