Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
默认输出格式为 ip:port,新增-t=body 可以输出 body 信息
Browse files Browse the repository at this point in the history
  • Loading branch information
rootphantomer committed Sep 6, 2022
1 parent c6eee53 commit f65a5aa
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 30 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--
* @Author: ph4nt0mer
* @Date: 2022-09-01 18:39:52
* @LastEditors: ph4nt0mer
* @LastEditTime: 2022-09-06 11:29:48
* @LastEditors: rootphantomer
* @LastEditTime: 2022-09-06 17:35:56
* @FilePath: /quake_go/README.md
* @Description:
*
Expand All @@ -29,6 +29,11 @@ rust 项目代码 移步这里——https://github.com/360quake/quake_rs/

## 更新日志

- 2022-09-06 v1.2:

- 默认输出格式为 ip:port(见下图)
- 新增-t=body 可以输出 body 信息

- 2022-09-06 v1.1:

- 简化参数传参格式
Expand All @@ -47,4 +52,9 @@ example:
./quake init <token>
./quake info
./quake query port:443
./quake query port:443 -start=0 -size=20
```

## 案例

![alt](./iShot_2022-09-06_17.32.57.jpg)
Binary file added iShot_2022-09-06_17.32.57.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 21 additions & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: ph4nt0mer
* @Date: 2022-08-31 17:03:03
* @LastEditors: rootphantomer
* @LastEditTime: 2022-09-06 16:39:06
* @LastEditTime: 2022-09-06 17:30:44
* @FilePath: /quake_go/main.go
* @Description:
*
Expand All @@ -11,7 +11,6 @@
package main

import (
"flag"
"fmt"
"os"
"quake/src/apis"
Expand All @@ -35,12 +34,12 @@ Usage of ./quake:
person infomation
query <string>
query string value
-t <string,string>
field string value(example:./quake query port:8088 -t ip,port)
-t <string>
field string value(example:./quake query port:8088 -t=body)
-size string
size String value (default "10")
size String value (default :./quake query port:8088 -size=10)
-start string
start String value (default "0")`)
start String value (default :./quake query port:8088 -start=0)`)
return
}
path := "./config.yaml"
Expand All @@ -57,7 +56,22 @@ Usage of ./quake:
fmt.Println("!!!!please ./quake init token!!!!")
return
}
start, size, field := flaginit()
start := "0"
size := "10"
field := "ip,port"
for _, value := range os.Args {
tmp := strings.Split(value, "=")
if strings.Contains(tmp[0], "-start") {
start = tmp[1]
}
if strings.Contains(tmp[0], "-size") {
size = tmp[1]
}
if strings.Contains(tmp[0], "-t") {
field = tmp[1]
}
}

switch strings.ToLower(os.Args[1]) {
case "info":
apis.InfoGet(token.Token)
Expand All @@ -77,11 +91,3 @@ Usage of ./quake:
fmt.Println("args failed !!!!")
}
}

func flaginit() (start string, size string, field string) {
flag.StringVar(&field, "t", "", "field String value")
flag.StringVar(&size, "size", "10", "size String value")
flag.StringVar(&start, "start", "0", "start String value")
flag.Parse()
return
}
26 changes: 15 additions & 11 deletions src/apis/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: ph4nt0mer
* @Date: 2022-09-01 15:36:10
* @LastEditors: rootphantomer
* @LastEditTime: 2022-09-06 16:44:26
* @LastEditTime: 2022-09-06 17:28:03
* @FilePath: /quake_go/src/apis/api.go
* @Description:
*
Expand All @@ -15,7 +15,7 @@ import (
"quake/src/setting"
"quake/src/tools"
"quake/src/utils"
"strconv"
"strings"
)

func FilterableServiceGET(token string) {
Expand Down Expand Up @@ -46,17 +46,21 @@ func SearchServicePost(query string, start string, size string, token string, fi
body := tools.ApisPost(setting.URL+uri, payload, start, size, token)
resut := utils.SeriveLoadJson(body)
data := resut.Data
// if field != "" {
// fields := strings.Split(field, ",")
// for _, fields_value := range fields {
// for _, value := range data {
// fmt.Println(value.fields_value)
// }
// }
// }
fields := strings.Split(field, ",")
for _, value := range fields {
if strings.Contains(value, "body") {
for _, value := range data {
fmt.Println(value)
return
}
}
}
for _, value := range data {
fmt.Println(value.IP + ":" + strconv.Itoa(value.Port))
fmt.Println("@@", value.IP, ":", value.Port)
}
// for _, value := range data {
// fmt.Println(value.IP + ":" + strconv.Itoa(value.Port))
// }

}
func ScrollServicePost(query string, start string, size string, token string) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/LoadJson.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: rootphantomer [email protected]
* @Date: 2022-09-06 16:04:43
* @LastEditors: rootphantomer
* @LastEditTime: 2022-09-06 16:42:24
* @LastEditTime: 2022-09-06 16:26:37
* @FilePath: /quake_go/src/utils/LoadJson.go
* @Description:
*
Expand Down Expand Up @@ -56,7 +56,7 @@ type ServiceJson struct {
Org string `json:"org"`
OsName string `json:"os_name"`
OsVersion string `json:"os_version"`
Port int `json:"port"`
Port int64 `json:"port"`
Service struct {
Banner string `json:"banner"`
Cert string `json:"cert"`
Expand Down

0 comments on commit f65a5aa

Please sign in to comment.