Enhancement parsing. Issue with multiple tables in port's script #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello there :)
Issue:
I have ran into situation where nmap scanner return results where inside
<script>
tag was more than 1
<table>
tag. So while parsing raised Exception looks this:On some port were 2 cpes:
ISC BIND 9.9.4 (cpe:/a:isc:bind:9.9.4) (cpe:/o:redhat:enterprise_linux:7)
XML fil after
nmap
scanning looks like this:I've decided to bring few fixes and handle this problem.
JsonReportBuilder class:
builder._buffer
changesExample of actual parsing results:
ScanResult class:
flan_types.py
changes:FlanXmlParser class:
Core change
Core change is in the dict structure. Now
parser.results
dict items consists of ScanResult objects, which attributevulns
is dict (defaultdict(list)
). So if there are two or more cpes in the same port, it won't break anymore.