diff --git a/chatops/python/gitlab-to-pentext.py b/chatops/python/gitlab-to-pentext.py
index d2ad9ed..d30df18 100644
--- a/chatops/python/gitlab-to-pentext.py
+++ b/chatops/python/gitlab-to-pentext.py
@@ -58,13 +58,21 @@ def add_finding(issue, options):
filename = 'findings/{0}.xml'.format(finding_id)
finding = u'
{0}\n'.format(title)
finding += '{0}\n\n'.format(convert_text(issue.description))
+ impact = 'TODO'
+ recommendation = '\n';
technical_description = ''
- for note in [x for x in issue.notes.list() if not x.system]:
- technical_description += u'{0}\n'.format(convert_text(note.body))
- finding += '\n{0}\n\n'.format(technical_description)
- finding += '\nTODO\n\n'
- finding += '\n\n\n'
- finding = u'{0}\n{4}\n'.format(DECLARATION,
+ for note in [x for x in reversed(issue.notes.list()) if not x.system]:
+ if len(note.body.splitlines()):
+ if 'impact' in note.body.split()[0].lower():
+ impact = convert_text(''.join(note.body.splitlines(True)[1:]))
+ elif 'recommendation' in note.body.split()[0].lower():
+ recommendation = convert_text(''.join(note.body.splitlines(True)[1:]))
+ else:
+ technical_description += u'{0}\n'.format(convert_text(note.body))
+ finding += '\n{0}\n\n\n'.format(technical_description)
+ finding += '\n{0}\n\n\n'.format(impact)
+ finding += '\n{0}\n\n\n'.format(recommendation)
+ finding = u'{0}\n{4}'.format(DECLARATION,
finding_id,
threat_level,
finding_type,
@@ -100,7 +108,7 @@ def add_non_finding(issue, options):
filename = 'non-findings/{0}.xml'.format(non_finding_id)
non_finding = u'{0}\n{1}\n'.format(title,
convert_text(issue.description))
- for note in [x for x in issue.notes.list() if not x.system]:
+ for note in [x for x in reversed(issue.notes.list()) if not x.system]:
non_finding += u'{0}
\n'.format(convert_text(note.body))
non_finding = u'{0}\n{2}\n\n'.format(DECLARATION,
non_finding_id,
@@ -191,6 +199,7 @@ def preflight_checks():
Checks if all tools are there.
Exits with 0 if everything went okilydokily.
"""
+ gitserver = None
try:
gitserver = gitlab.Gitlab.from_config('remote')
gitserver.auth()