(fileName string)
| 19 | } |
| 20 | |
| 21 | func ReadPayloadsFile(fileName string) ([]string, error) { |
| 22 | content, err := os.ReadFile(fileName) |
| 23 | if err != nil { |
| 24 | return nil, err |
| 25 | } |
| 26 | |
| 27 | unifiedContent := strings.ReplaceAll(string(content), "\r\n", "\n") |
| 28 | lines := strings.Split(unifiedContent, "\n") |
| 29 | |
| 30 | return lines, nil |
| 31 | } |
| 32 | |
| 33 | func WritePayloadsToFile(payloads []Payload, hostname string, fileName string) error { |
| 34 | file, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) |