adding service-breakdown (WIP)

This commit is contained in:
skyanth
2019-06-14 15:07:29 +02:00
parent 8d33e75c67
commit b5b4a02e01
5 changed files with 199 additions and 5 deletions

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<service_list>
<service>
<description>Determine and set up attack vectors</description>
<duration in="days">2</duration>
<hourly_rate vat="excl" denomination="eur">1</hourly_rate>
<fee>
<computed/>
</fee>
</service>
<service>
<description>Set up infrastructure and support</description>
<duration in="hours">20</duration>
<hourly_rate vat="excl" denomination="eur">2</hourly_rate>
<fee>
<computed/>
</fee>
</service>
<service>
<description>Attacking and reporting</description>
<duration in="days">5</duration>
<hourly_rate vat="excl" denomination="eur">3</hourly_rate>
<fee>
<computed/>
</fee>
</service>
<service>
<description>Travel and hotel</description>
<fee vat="excl" denomination="eur">50</fee>
</service>
<service>
<description>Optional: presentation of findings</description>
<duration in="days"><min>0</min><max>2</max></duration>
<hourly_rate vat="incl" denomination="eur">100</hourly_rate>
<fee>
<computed/>
</fee>
</service>
</service_list>

View File

@@ -18,4 +18,6 @@
Any additional work will be charged separately. An hourly
rate for additional work will be agreed upon before starting this work.
</p>
<generate_service_breakdown format="table"/>
</section>

View File

@@ -23,6 +23,8 @@
<p_boxtype/> intrusive test via the
internet.
</p>
<generate_service_breakdown format="list"/>
<!--Not Needed if Disclaimer is Included; Duplicate Text-->
<!--p>It is possible that in the course of the penetration

View File

@@ -129,8 +129,8 @@
<xsl:template name="findingsSummaryContent">
<fo:table-row xsl:use-attribute-sets="TableFont">
<xsl:if test="position() mod 2 != 0">
<xsl:attribute name="background-color">#ededed</xsl:attribute>
</xsl:if>
<xsl:attribute name="background-color">#ededed</xsl:attribute>
</xsl:if>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<!-- attach id to first finding of each threatLevel so pie charts can link to it -->
@@ -231,8 +231,8 @@
<xsl:template name="recommendationsSummaryContent">
<fo:table-row xsl:use-attribute-sets="TableFont">
<xsl:if test="position() mod 2 != 0">
<xsl:attribute name="background-color">#ededed</xsl:attribute>
</xsl:if>
<xsl:attribute name="background-color">#ededed</xsl:attribute>
</xsl:if>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<fo:basic-link xsl:use-attribute-sets="link">
@@ -252,7 +252,8 @@
<fo:block>
<xsl:choose>
<xsl:when test="recommendation_summary">
<xsl:apply-templates select="recommendation_summary" mode="summarytable"/>
<xsl:apply-templates select="recommendation_summary" mode="summarytable"
/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="recommendation" mode="summarytable"/>
@@ -457,4 +458,149 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="generate_service_breakdown">
<xsl:choose>
<xsl:when test="@format = 'list'">
<fo:list-block xsl:use-attribute-sets="list">
<xsl:for-each select="//service_list/service">
<xsl:if test="duration">
<fo:list-item xsl:use-attribute-sets="li">
<!-- insert a bullet -->
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>&#8226;</fo:inline>
</fo:block>
</fo:list-item-label>
<!-- list text -->
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:value-of select="description"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="duration"/>
<xsl:text> </xsl:text>
<xsl:value-of select="duration/@in"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:if>
</xsl:for-each>
</fo:list-block>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">TODO: total!</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="@format = 'table'">
<fo:block>
<fo:table xsl:use-attribute-sets="fwtable borders">
<fo:table-column column-width="proportional-column-width(70)"
xsl:use-attribute-sets="borders"/>
<fo:table-column column-width="proportional-column-width(10)"
xsl:use-attribute-sets="borders"/>
<fo:table-column column-width="proportional-column-width(10)"
xsl:use-attribute-sets="borders"/>
<fo:table-column column-width="proportional-column-width(10)"
xsl:use-attribute-sets="borders"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block> Description </fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block> Duration </fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block> Hourly rate </fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block> Fee </fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="//service_list/service">
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="description"/>
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<xsl:choose>
<xsl:when test="duration and duration/@in">
<fo:block>
<xsl:value-of select="duration"/>
<xsl:text> </xsl:text>
<xsl:value-of select="duration/@in"/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="number-columns-spanned"
>2</xsl:attribute>
<fo:block>(flat rate)</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:table-cell>
<xsl:if test="duration and hourly_rate">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:call-template name="getDenomination">
<xsl:with-param name="placeholderElement"
select="hourly_rate"/>
</xsl:call-template>
<xsl:value-of select="hourly_rate"/>
</fo:block>
</fo:table-cell>
</xsl:if>
<fo:table-cell xsl:use-attribute-sets="td">
<xsl:choose>
<xsl:when test="not(fee/computed)">
<!-- hardcoded fee, we'll need a denomination -->
<fo:block xsl:use-attribute-sets="moneycell">
<xsl:call-template name="getDenomination">
<xsl:with-param name="placeholderElement"
select="fee"/>
</xsl:call-template>
<fo:leader leader-pattern="space"/>
<xsl:value-of select="fee"/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<!-- computed fee; compute using duration and use hourly rate denomination -->
<fo:block xsl:use-attribute-sets="moneycell">
<xsl:call-template name="getDenomination">
<xsl:with-param name="placeholderElement"
select="hourly_rate"/>
</xsl:call-template>
<fo:leader leader-pattern="space"/>
<xsl:choose>
<xsl:when test="duration/@in = 'hours'">
<!-- multiply with hourly rate -->
<xsl:value-of select="duration * hourly_rate"/>
</xsl:when>
<xsl:when test="duration/@in = 'days'">
<!-- multiply with hourly rate * 8 -->
<xsl:value-of select="duration * hourly_rate * 8"
/>
</xsl:when>
</xsl:choose>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">TODO total</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">ERROR: unknown service breakdown format (use
'list' or 'table')</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -26,4 +26,9 @@
<xsl:attribute-set name="region-body-cover">
</xsl:attribute-set>
<!-- service breakdown -->
<xsl:attribute-set name="moneycell">
<xsl:attribute name="text-align-last">justify</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet>