| skipped 494 lines |
495 | 495 | | } |
496 | 496 | | } |
497 | 497 | | |
| 498 | + | // CleanFFUFJson get to get formatted report |
| 499 | + | func CleanFFUFJson(filename string, dest string) { |
| 500 | + | content := utils.ReadingLines(filename) |
| 501 | + | if len(content) <= 0 { |
| 502 | + | utils.WarnF("File not found: %s", filename) |
| 503 | + | return |
| 504 | + | } |
| 505 | + | |
| 506 | + | var results []string |
| 507 | + | for _, line := range content { |
| 508 | + | jsonParsed, err := gabs.ParseJSON([]byte(line)) |
| 509 | + | if err != nil { |
| 510 | + | continue |
| 511 | + | } |
| 512 | + | |
| 513 | + | resultsJson := jsonParsed.S("results") |
| 514 | + | if resultsJson == nil { |
| 515 | + | continue |
| 516 | + | } |
| 517 | + | |
| 518 | + | for _, item := range resultsJson.Children() { |
| 519 | + | //.url,.status,.length,.words,.lines,.redirectlocation |
| 520 | + | endpoint := cast.ToString(item.S("url").Data()) |
| 521 | + | status := cast.ToString(item.S("status").Data()) |
| 522 | + | length := cast.ToString(item.S("length").Data()) |
| 523 | + | words := cast.ToString(item.S("words").Data()) |
| 524 | + | lines := cast.ToString(item.S("lines").Data()) |
| 525 | + | redirectLocation := cast.ToString(item.S("redirectlocation").Data()) |
| 526 | + | |
| 527 | + | data := fmt.Sprintf("%s,%s,%s,%s,%s,%s", endpoint, status, length, words, lines, redirectLocation) |
| 528 | + | results = append(results, data) |
| 529 | + | } |
| 530 | + | } |
| 531 | + | |
| 532 | + | if len(results) > 0 { |
| 533 | + | utils.WriteToFile(dest, strings.Join(results, "\n")) |
| 534 | + | } |
| 535 | + | } |
| 536 | + | |