Skip to content

Commit 6285107

Browse files
committed
fixed -P directory error in linux
1 parent 99865de commit 6285107

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

internal/runner/runner.go

+2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ func New(options *config.Options, acb config.ApiCallBack) error {
6464
// console print
6565
fmt.Println(log.LogColor.Info("指定脚本 " + options.PocsFilePath))
6666
}
67+
6768
allPocsYamlSlice := runner.catalog.GetPocsPath(options.PocsDirectory)
69+
6870
if len(allPocsYamlSlice) == 0 {
6971
return errors.New("未找到可执行脚本(POC),请检查`默认脚本`或指定新の脚本(POC)")
7072
}

pkg/catalog/path.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ import (
88
"github.com/pkg/errors"
99
)
1010

11-
// ResolvePath resolves the path to an absolute one in various ways.
12-
//
13-
// It checks if the filename is an absolute path, looks in the current directory
14-
// or checking the nuclei pocs directory. If a second path is given,
15-
// it also tries to find paths relative to that second path.
1611
func (c *Catalog) ResolvePath(pocName, second string) (string, error) {
1712
if filepath.IsAbs(pocName) {
1813
return pocName, nil
@@ -30,15 +25,21 @@ func (c *Catalog) ResolvePath(pocName, second string) (string, error) {
3025
}
3126

3227
pocPath := filepath.Join(curDirectory, pocName)
33-
if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination {
34-
return potentialPath, nil
28+
if len(pocPath) > 0 {
29+
return pocPath, nil
3530
}
31+
// if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination {
32+
// return potentialPath, nil
33+
// }
3634

3735
if c.pocsDirectory != "" {
3836
pocPath := filepath.Join(c.pocsDirectory, pocName)
39-
if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination {
40-
return potentialPath, nil
37+
if len(pocPath) > 0 {
38+
return pocPath, nil
4139
}
40+
// if potentialPath, err := c.tryResolve(pocPath); err != errNoValidCombination {
41+
// return potentialPath, nil
42+
// }
4243
}
4344
return "", fmt.Errorf("no such path found: %s", pocName)
4445
}

0 commit comments

Comments
 (0)