Output send the specified content to the console or file
(out string, scanner *Scanner, res []*Result)
| 260 | |
| 261 | // Output send the specified content to the console or file |
| 262 | func Output(out string, scanner *Scanner, res []*Result) { |
| 263 | if out != "" { |
| 264 | if file, err := os.OpenFile(out, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666); err != nil { |
| 265 | log.Warn(err) |
| 266 | file.Close() |
| 267 | os.Exit(1) |
| 268 | } else { |
| 269 | defer file.Close() |
| 270 | if err := scanner.Output(file, res); err != nil { |
| 271 | log.Warn(err) |
| 272 | os.Exit(1) |
| 273 | } |
| 274 | log.Info("The result has been redirected to: ", out) |
| 275 | os.Exit(0) |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | // OutFileString output content to the specified file |
| 281 | func OutFileString(out string, _ *Scanner, hexStr string) { |