mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-14 02:27:31 -07:00
Rebuild JSON report file in first time and append while using -R
This commit is contained in:
parent
e82e395dad
commit
5120f03645
1 changed files with 6 additions and 2 deletions
8
hydra.c
8
hydra.c
|
@ -3552,11 +3552,15 @@ int main(int argc, char *argv[]) {
|
|||
// printf("[DATA] with additional data %s\n", hydra_options.miscptr);
|
||||
|
||||
if (hydra_options.outfile_ptr != NULL) {
|
||||
if ((hydra_brains.ofp = fopen(hydra_options.outfile_ptr, "a+")) == NULL) {
|
||||
char outfile_open_type[] = "a+"; //Default open in a+ mode
|
||||
if (hydra_options.outfile_format == FORMAT_JSONV1 && hydra_options.restore != 1) {
|
||||
outfile_open_type[0] = 'w'; //Creat new outfile, if using JSON output and not using -R. The open mode should be "w+".
|
||||
}
|
||||
if ((hydra_brains.ofp = fopen(hydra_options.outfile_ptr, outfile_open_type)) == NULL) {
|
||||
perror("[ERROR] Error creating outputfile");
|
||||
exit(-1);
|
||||
}
|
||||
if (hydra_options.outfile_format == FORMAT_JSONV1) {
|
||||
if (hydra_options.outfile_format == FORMAT_JSONV1 && hydra_options.restore != 1) { // No JSON head while using -R
|
||||
fprintf(hydra_brains.ofp, "{ \"generator\": {\n"
|
||||
"\t\"software\": \"%s\", \"version\": \"%s\", \"built\": \"%s\",\n"
|
||||
"\t\"server\": \"%s\", \"service\": \"%s\", \"jsonoutputversion\": \"1.00\",\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue