Gracefully error in case stdin is used for search result (#634)
This commit is contained in:
parent
643f6b883f
commit
c7d0fb5cf5
6
main.go
6
main.go
@ -170,7 +170,13 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
ok, reason := ffuf.HistoryReplayable(conf)
|
||||||
|
if ok {
|
||||||
printSearchResults(conf, pos, copt.Time, opts.General.Searchhash)
|
printSearchResults(conf, pos, copt.Time, opts.General.Searchhash)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("[ERR] Hash cannot be mapped back because %s\n", reason)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[ERR] %s\n", err)
|
fmt.Printf("[ERR] %s\n", err)
|
||||||
|
|||||||
@ -72,6 +72,15 @@ func SearchHash(hash string) ([]ConfigOptionsHistory, int, error) {
|
|||||||
return coptions, int(position), err
|
return coptions, int(position), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HistoryReplayable(conf *Config) (bool, string) {
|
||||||
|
for _, w := range conf.Wordlists {
|
||||||
|
if w == "-" || strings.HasPrefix(w, "-:") {
|
||||||
|
return false, "stdin input was used for one of the wordlists"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true, ""
|
||||||
|
}
|
||||||
|
|
||||||
func configFromHistory(dirname string) (ConfigOptionsHistory, error) {
|
func configFromHistory(dirname string) (ConfigOptionsHistory, error) {
|
||||||
jsonOptions, err := os.ReadFile(filepath.Join(dirname, "options"))
|
jsonOptions, err := os.ReadFile(filepath.Join(dirname, "options"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user