mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-22 06:13:55 -07:00
rebuild JSON output file while recover from pre-scanned session
This commit is contained in:
parent
0fa7a484b3
commit
8595103d4c
1 changed files with 8 additions and 4 deletions
8
hydra.c
8
hydra.c
|
@ -3552,11 +3552,11 @@ int main(int argc, char *argv[]) {
|
||||||
// printf("[DATA] with additional data %s\n", hydra_options.miscptr);
|
// printf("[DATA] with additional data %s\n", hydra_options.miscptr);
|
||||||
|
|
||||||
if (hydra_options.outfile_ptr != NULL) {
|
if (hydra_options.outfile_ptr != NULL) {
|
||||||
if ((hydra_brains.ofp = fopen(hydra_options.outfile_ptr, "a+")) == NULL) {
|
if (hydra_options.outfile_format == FORMAT_JSONV1) {
|
||||||
|
if ((hydra_brains.ofp = fopen(hydra_options.outfile_ptr, "w")) == NULL) {
|
||||||
perror("[ERROR] Error creating outputfile");
|
perror("[ERROR] Error creating outputfile");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (hydra_options.outfile_format == FORMAT_JSONV1) {
|
|
||||||
fprintf(hydra_brains.ofp, "{ \"generator\": {\n"
|
fprintf(hydra_brains.ofp, "{ \"generator\": {\n"
|
||||||
"\t\"software\": \"%s\", \"version\": \"%s\", \"built\": \"%s\",\n"
|
"\t\"software\": \"%s\", \"version\": \"%s\", \"built\": \"%s\",\n"
|
||||||
"\t\"server\": \"%s\", \"service\": \"%s\", \"jsonoutputversion\": \"1.00\",\n"
|
"\t\"server\": \"%s\", \"service\": \"%s\", \"jsonoutputversion\": \"1.00\",\n"
|
||||||
|
@ -3570,6 +3570,10 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
fprintf(hydra_brains.ofp, "\"\n\t},\n\"results\": [");
|
fprintf(hydra_brains.ofp, "\"\n\t},\n\"results\": [");
|
||||||
} else { // else default is plain text aka == 0
|
} else { // else default is plain text aka == 0
|
||||||
|
if ((hydra_brains.ofp = fopen(hydra_options.outfile_ptr, "a+")) == NULL) {
|
||||||
|
perror("[ERROR] Error creating outputfile");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
fprintf(hydra_brains.ofp, "# %s %s run at %s on %s %s (%s", PROGRAM, VERSION, hydra_build_time(),
|
fprintf(hydra_brains.ofp, "# %s %s run at %s on %s %s (%s", PROGRAM, VERSION, hydra_build_time(),
|
||||||
hydra_options.server == NULL ? hydra_options.infile_ptr : hydra_options.server, hydra_options.service, prg);
|
hydra_options.server == NULL ? hydra_options.infile_ptr : hydra_options.server, hydra_options.service, prg);
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue