From c2cd50b1a4f8233f03c3ca98cf49fb1962f2c3a8 Mon Sep 17 00:00:00 2001 From: 0xbug Date: Fri, 21 May 2021 13:49:17 +0800 Subject: [PATCH] =?UTF-8?q?v0.5=20=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=9B=B4=E4=BE=BF=E6=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 9 ++++++++- cmd/biu-cli.go | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 4115259..23d04e7 100644 --- a/README.MD +++ b/README.MD @@ -42,9 +42,16 @@ cat domain.txt|biu-cli -pid 项目ID - 查询备案并添加到已有项目中 ```shell -biu-cli -icp xx公司|biu-cli -pid 项目ID +biu-cli -icp xx公司 -pid 项目ID ``` + +- 查询备案并创建项目 +```shell +biu-cli -icp xx公司 -pnew 项目名称 +``` + + - 配合https://opendata.rapid7.com/sonar.https/使用 ```shell diff --git a/cmd/biu-cli.go b/cmd/biu-cli.go index 2b0e9b3..b264702 100644 --- a/cmd/biu-cli.go +++ b/cmd/biu-cli.go @@ -26,7 +26,7 @@ var ( ip string pageSize int client = resty.New() - version = "v0.4" + version = "v0.5" ) func biuPrint(header []string, data [][]string) { @@ -63,9 +63,19 @@ func icpSearch() { reg, err := regexp.Compile(`([a-z0-9-\.]+)`) if err == nil { match := reg.FindAllString(resp.String(), -1) - for _, domain := range match { - fmt.Println(strings.Split(domain, ">")[1]) + if len(match) > 0 { + if pnew != "" { + addProject() + } + for _, domain := range match { + if pid != "" { + addTargetToProject(strings.Split(domain, ">")[1]) + } else { + fmt.Println(strings.Split(domain, ">")[1]) + } + } } + } } } @@ -113,6 +123,7 @@ func addProject() { msg := gjson.Get(string(resp.Body()), "msg").Value() fmt.Println(msg) fmt.Println(result.Get("project_id").Value()) + pid = result.Get("project_id").Str } }