-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added support for writing results as JSON. #119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against the idea of having JSON output to file, but the method used right now isn't good given the caching to memory. Please seen inline comments. Thank you.
@@ -65,6 +65,7 @@ All funds that are donated to this project will be donated to charity. A full lo | |||
* `-l` - show the length of the response. | |||
* `-n` - "no status" mode, disables the output of the result's status code. | |||
* `-o <file>` - specify a file name to write the output to. | |||
* `-oj <file>` - specify a file name to write the output as JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single-letters only for parameters (thanks to the command line parsing).
@@ -33,6 +34,7 @@ type Gobuster struct { | |||
context context.Context | |||
requestsExpected int | |||
requestsIssued int | |||
cachedResults []Result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bad idea. This will blow out memory big time for huge result sets. Data should be streamed out as it's captured rather that cached and then serialised in one hit.
@@ -145,13 +153,20 @@ func (g *Gobuster) worker(wordChan <-chan string, wg *sync.WaitGroup) { | |||
continue | |||
} else { | |||
for _, r := range res { | |||
g.cacheResult(r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result should not be cached here.
g.resultChan <- r | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
func (g *Gobuster) cacheResult(r Result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function not necessary. It should be handled in the result handler.
@itsbriany can you also please taret the v3.0-working branch as this is the current development branch |
Ping @itsbriany, you still keen to get this moving? |
Hi @OJ, it doesn't look like I will be working on this any time soon. Feel free to take over or delegate the task to someone else. I still appreciate your feedback though! |
Added the ability to dump results as JSON so that third party tools can process gobuster output. This should address issue #75.