Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wjlin0 committed Mar 25, 2023
1 parent 7d0c0c5 commit b21dbb2
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ archives:
format_overrides:
- goos: windows
format: zip
files:
- config/dict.zip
- config/match-config.yaml
- README.md
checksum:
algorithm: sha256
snapshot:
Expand Down
Binary file added config/dict.zip
Binary file not shown.
80 changes: 80 additions & 0 deletions config/match-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
version: "v1.0.0"
rules:
- name: "Thinkphp"
matchers:
- type: regex
part: header
regex:
- "ThinkPHP"
- name: "Apache"
matchers:
- type: regex
part: header
name: Apache
regex:
- "Server: .*?([aA]{1}pache[/]?[\\d\\.]*) ?"
group: 1
- name: "Nginx"
matchers:
- type: regex
name: nginx
part: header
regex:
- "Server: .*?([nN]{1}ginx[/]?[\\d\\.]*) ?"
group: 1
- name: "Halo"
matchers:
- type: regex
name: halo
part: body
group: 1
regex:
- "content=\"(Halo .*?)\""
- name: "PHP"
matchers:
- type: regex
part: header
regex:
- "X-Powered-By: (PHP[\\d\\.\\/]*?)"
group: 1
- name: "Tomcat"
matchers:
- type: regex
name: tomcat
part: body
regex:
- "([Tt]{1}omcat[/]?[\\d\\.]*)"
group: 1
- name: "AWS-EC2"
matchers-condition: or
matchers:
- type: regex
part: hedaer
regex:
- "Server: (EC2ws)"
- type: word
part: body
words:
- "Amazon EC2"
- name: "Django"
matchers:
- type: word
part: body
words:
- "<title>The install worked successfully! Congratulations!</title>"
- "Django tried these URL patterns"
- "Django will display a standard"
- name: "Microsoft-IIS"
matchers:
- type: regex
part: header
name: iis
group: 1
regex:
- "Server: .*?(Microsoft-IIS[/]?[\\d\\.]*)"
- name: "Nacos"
matchers:
- type: word
part: body
words:
- '<img class="product-logo" src="img/nacos.png">'
13 changes: 8 additions & 5 deletions pkg/runner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ type Runner struct {

func NewRunner(options *Options) (*Runner, error) {
run := &Runner{}

var cfg *ResumeCfg
var err error
// 如果存在恢复配置,解析它并设置相应的选项
if options.ResumeCfg != "" {
cfg, err := ParserResumeCfg(options.ResumeCfg)
cfg, err = ParserResumeCfg(options.ResumeCfg)
if err != nil {
return nil, err
}
Expand All @@ -57,20 +58,22 @@ func NewRunner(options *Options) (*Runner, error) {

// 将 ResumeCfg 字段设置为 options.ResumeCfg
cfg.Options.ResumeCfg = options.ResumeCfg
} else {
// 否则,创建一个新的 ResumeCfg 并设置其 Options 和 Results 字段
}
if cfg == nil {
run.Cfg = &ResumeCfg{
Rwm: &sync.RWMutex{},
Options: options,
Results: result.NewResult(),
}
} else {
run.Cfg = cfg
}

// 配置输出方式
run.Cfg.Options.configureOutput()

// 验证选项是否合法
err := run.Cfg.Options.Validate()
err = run.Cfg.Options.Validate()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b21dbb2

Please sign in to comment.