[Fortify]XML 리포트에서 Issue 갯수 뽑아내기

■ XML 리포트 생성방법

 

test.fpr → test.xml 로 변환할 경우.

<Fortify 설치 디렉토리>/bin/reportgenerator -format xml -filterSet "Quick View" -source test.fpr -f test.xml
 

16.10 버전: (XML포맷을 더 이상 지원안하고 대신 XLS를 지원)

BIRTReportGenerator -format XLS -template "Developer Workbook" -filterSet "Security Auditor View" -source test.fpr -output test.xls

 

■ XML 리포트에서 취약점 갯수만 뽑아내는 방법

xmlint(http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip)를 다운받아 설치한 후 아래의 스크립트를 활용한다.

@echo off
cls
@rem ########################################################################
@rem #
@rem # Get fortify issue count from XML Report (Windows)
@rem #
@rem # eSecuVali Corp.
@rem #
@rem # 사용방법 : fortify_xml2issue.bat <XML파일명> <출력 파일명>
@rem # Author   : 이존석 (hasu0707@gmail.com)
@rem #
@rem ########################################################################

IF NOT EXIST %1 (
    ECHO %1 파일이 없습니다.
    EXIT /B
)

REM Fortify Priority : Critical
xmllint --xpath "string(/ReportDefinition/ReportSection[1]/SubSection[2]/IssueListing/Chart/GroupingSection[3]/@count)" %1 >> %2
echo|set /p=, >> %2
REM Fortify Priority : High
xmllint --xpath "string(/ReportDefinition/ReportSection[1]/SubSection[2]/IssueListing/Chart/GroupingSection[2]/@count)" %1 >> %2
echo|set /p=, >> %2
REM Fortify Priority : Low
xmllint --xpath "string(/ReportDefinition/ReportSection[1]/SubSection[2]/IssueListing/Chart/GroupingSection[1]/@count)" %1 >> %2
echo. >> %2
위로 스크롤