Skip to content

Commit 5351820

Browse files
committed
update: dirscan
1 parent 9c89656 commit 5351820

5 files changed

Lines changed: 10 additions & 14 deletions

File tree

pkg/dirscan/result.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package dirscan
22

33
type Result struct {
4-
Url string
5-
StatusCode int
6-
ContentLength int
7-
Suffix string
8-
ContentType string
4+
Url string `json:"url"`
5+
StatusCode int `json:"statusCode"`
6+
ContentLength int `json:"contentLength"`
7+
ContentType string `json:"-"`
8+
Title string `json:"title"`
99
}
1010

1111
// Results 按照contentLength排序

pkg/dirscan/runner.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package dirscan
22

33
import (
4-
"fmt"
54
"github.com/niudaii/zpscan/internal/utils"
65
"github.com/niudaii/zpscan/pkg/webscan"
76
"strings"
@@ -111,9 +110,6 @@ func (r *Runner) Dirscan(input *Input) (results Results) {
111110
if err != nil {
112111
gologger.Debug().Msgf("%v", err)
113112
} else {
114-
if strings.Contains(task, "/login") {
115-
fmt.Println(result)
116-
}
117113
if result.ContentLength != 0 && utils.HasInt(r.options.MatchStatus, result.StatusCode) {
118114
flag := true
119115
if suffix, ok := utils.SuffixStr(extensions, result.Url); ok {
@@ -122,7 +118,7 @@ func (r *Runner) Dirscan(input *Input) (results Results) {
122118
}
123119
}
124120
if flag {
125-
gologger.Silent().Msgf("%v [%v] [%v]", result.Url, result.StatusCode, result.ContentLength)
121+
gologger.Silent().Msgf("%v [%v] [%v] [%v]", result.Url, result.StatusCode, result.ContentLength, result.Title)
126122
mutex.Lock()
127123
respMap[result.ContentLength] += 1
128124
tmpResults = append(tmpResults, result)
@@ -165,6 +161,7 @@ func (r *Runner) Req(url string) (result *Result, err error) {
165161
StatusCode: resp.StatusCode,
166162
ContentLength: len(resp.String()),
167163
ContentType: resp.GetContentType(),
164+
Title: webscan.GetTitle(resp),
168165
}
169166
return
170167
}

pkg/pocscan/runner.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type Runner struct {
2727

2828
func NewRunner(options *Options, gobyPocs []*goby.Poc, xrayPocs []*xray.Poc, nucleiTemplates []*nuclei.Template) (runner *Runner, err error) {
2929
nucleiEngine := nuclei.InitEngine(options.Timeout, options.Proxy)
30-
//nucleiEngine = nuclei.InitEngine(options.Timeout, "")
3130
reqClient := utils.NewReqClient(options.Proxy, options.Timeout, options.Headers)
3231
runner = &Runner{
3332
gobyPocs: gobyPocs,

pkg/webscan/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func (r *Runner) Run(urls []string) (results Results) {
6161
if len(resp.Fingers) > 5 {
6262
gologger.Warning().Msgf("%v 可能为蜜罐", resp.Url)
6363
} else {
64+
gologger.Silent().Msgf(FmtResult(resp, r.options.NoColor))
6465
mutex.Lock()
6566
results = append(results, resp)
6667
mutex.Unlock()
@@ -103,7 +104,7 @@ func (r *Runner) Webinfo(url string) (result *Result, err error) {
103104
Url: resp.Request.URL.Scheme + "://" + resp.Request.URL.Host,
104105
StatusCode: resp.StatusCode,
105106
ContentLength: len(resp.String()),
106-
Title: getTitle(resp),
107+
Title: GetTitle(resp),
107108
Fingers: r.getFinger(resp),
108109
}
109110
if !r.options.NoIconhash {
@@ -112,7 +113,6 @@ func (r *Runner) Webinfo(url string) (result *Result, err error) {
112113
if !r.options.NoWappalyzer {
113114
result.Wappalyzer = r.wappalyzerClient.Fingerprint(resp.Header, resp.Bytes())
114115
}
115-
gologger.Silent().Msgf(FmtResult(result, r.options.NoColor))
116116
return
117117
}
118118

pkg/webscan/title.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var (
1616
reTitle = regexp.MustCompile(`(?im)<\s*title.*>(.*?)<\s*/\s*title>`)
1717
)
1818

19-
func getTitle(resp *req.Response) (title string) {
19+
func GetTitle(resp *req.Response) (title string) {
2020
// Try to parse the DOM
2121
titleDom, err := getTitleWithDom(resp)
2222
// In case of error fallback to regex

0 commit comments

Comments
 (0)