Skip to content

Commit

Permalink
新增output导出功能
Browse files Browse the repository at this point in the history
  • Loading branch information
lcvvvv committed Feb 19, 2021
1 parent 67a5211 commit f6b77d1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 9 additions & 14 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions app/params/check.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
package params

import (
"../../lib/misc"
"fmt"
"os"
"regexp"
)

var OutPutFile *os.File

func initOutPutFile(path string) *os.File {
if misc.FileIsExist(path) {
f, err := os.Open(path)
if err != nil {
fmt.Printf("[-]%s", err.Error())
os.Exit(0)
}
return f
} else {
f, err := os.Create(path)
if err != nil {
fmt.Printf("[-]%s", err.Error())
os.Exit(0)
}
return f
}
}

func checkParams() {
//判断冲突参数
if params.port != "" && params.top != 0 {
Expand All @@ -28,6 +49,8 @@ func checkParams() {
}
if params.output != "" {
//验证output参数
f := initOutPutFile(params.output)
OutPutFile = f
}
if params.proxy != "" {
if !checkProxyParam(params.proxy) {
Expand Down
3 changes: 3 additions & 0 deletions lib/port/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func makeResultInfo(res portInfo) string {
Banner = res.Banner[i : i+30]
}
res.Info = fmt.Sprintf("\r[+]%s\t%s\t%s\t%s\n", res.Url, res.Title, Banner, strings.Join(infoArr, ","))
if params.OutPutFile != nil {
_, _ = params.OutPutFile.WriteString(fmt.Sprintf("\r[+]%s\t%s\t%s\t%s", res.Url, res.Title, Banner, strings.Join(infoArr, ",")))
}
return res.Info
}

Expand Down
2 changes: 1 addition & 1 deletion lib/shttp/shttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var headerKeys = map[string]string{
"Entry1": "不知道",
"Accept-Encoding": "不知道",
"X-Amz-Request-Id": "不知道",
"Cfl_asynch": "浙江大华dh650平台设备",
"Cfl_asynch": "keyword:浙江大华dh650平台设备",
}

var newHeaderKeys *os.File
Expand Down

0 comments on commit f6b77d1

Please sign in to comment.