Fix: Create output directory recursively instead of silently failing to produce output (#413)

* Fix: Create output directory recursively instead of silently failing to write output. Fixes issue #395.

* Update changelog, contributors
This commit is contained in:
Massimo Prencipe 2021-04-10 15:01:57 +03:00 committed by Joona Hoikkala
parent e847ee0847
commit a513e2767e
3 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@
user to change filters, manage recursion queue, save snapshot of matches to a file etc. user to change filters, manage recursion queue, save snapshot of matches to a file etc.
- Changed - Changed
- Fix a badchar in progress output - Fix a badchar in progress output
- Fixed output writing so it doesn't silently fail if it needs to create directories recursively
- v1.2.1 - v1.2.1
- Changed - Changed

View File

@ -22,6 +22,7 @@
* [jvesiluoma](https://github.com/jvesiluoma) * [jvesiluoma](https://github.com/jvesiluoma)
* [Kiblyn11](https://github.com/Kiblyn11) * [Kiblyn11](https://github.com/Kiblyn11)
* [lc](https://github.com/lc) * [lc](https://github.com/lc)
* [mprencipe](https://github.com/mprencipe)
* [nnwakelam](https://twitter.com/nnwakelam) * [nnwakelam](https://twitter.com/nnwakelam)
* [noraj](https://pwn.by/noraj) * [noraj](https://pwn.by/noraj)
* [oh6hay](https://github.com/oh6hay) * [oh6hay](https://github.com/oh6hay)

View File

@ -328,7 +328,7 @@ func (s *Stdoutput) writeResultToFile(resp ffuf.Response) string {
var fileContent, fileName, filePath string var fileContent, fileName, filePath string
// Create directory if needed // Create directory if needed
if s.config.OutputDirectory != "" { if s.config.OutputDirectory != "" {
err := os.Mkdir(s.config.OutputDirectory, 0750) err := os.MkdirAll(s.config.OutputDirectory, 0750)
if err != nil { if err != nil {
if !os.IsExist(err) { if !os.IsExist(err) {
s.Error(err.Error()) s.Error(err.Error())