vdjagilev / nmap-formatter

A tool that allows you to convert NMAP results to html, csv, json, markdown, graphviz (dot), sqlite, excel and d2-lang. Simply put it's nmap converter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Long lines troubles

mk13337 opened this issue · comments

Too long lines in the file lead to the following error: bufio.Scanner: token too long
Unfortunately, I can't provide nmap XML scans for privacy reasons, but this problem occurs when converting large files (tested on a file of about 30MB).
This error is contained in the formatter/file.go file, because the buffer sizes for reading lines were not specified.
Suggestions for fixing this bug were offered in the merge request #147

Additional resources:
https://stackoverflow.com/questions/21124327/how-to-read-a-text-file-line-by-line-in-go-when-some-lines-are-long-enough-to-ca

Hey @MiichaelKlimenko !
Thanks for reporting the issue, I've took a bit different approach #149 can you check that solution as well? XML unmarshaling is not very effective on large files, so I thought I could resolve multiple problems at the same time.

Thanks for the reply!
Yes, I confirm that your solution #149 works as well.
In addition, the conversion has become noticeably faster.