Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new parse filter #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions nmap-parse-output-xslt/http-hosts-ports.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:npo="http://xmlns.sven.to/npo">
<npo:comment>
Generates a line separated list of HTTP(s) all ports.
Currently, the following services are detected as HTTP: http, https, http-alt, https-alt, http-proxy, sip, rtsp (potentially incomplete)
</npo:comment>
<npo:category>extract</npo:category>
<xsl:output method="text" />
<xsl:strip-space elements="*" />
<xsl:template match="/nmaprun/host/ports/port">
<xsl:if test="(service/@name='http' and not (service/@tunnel='ssl')) or service/@name='http-alt' or (service/@name='http-proxy' and not (service/@tunnel='ssl')) or (service/@name='sip' and not( script/@id='ssl-cert')) or (service/@name='rtsp' and not(script/@id='ssl-cert'))">
<xsl:text>http://</xsl:text>
<xsl:value-of select="../../hostnames/hostname/@name"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid"/>
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:if test="service/@name='https' or service/@name='https-alt' or (service/@name='sip' and script/@id='ssl-cert') or (service/@name='rtsp' and script/@id='ssl-cert') or (service/@name='http' and script/@id='ssl-cert') or (service/@name='http-alt' and script/@id='ssl-cert') or (service/@name='http-proxy' and script/@id='ssl-cert') or (service/@name='http' and (service/@tunnel='ssl')) or (service/@name='http-proxy' and (service/@tunnel='ssl')) ">
<xsl:text>https://</xsl:text>
<xsl:value-of select="../../hostnames/hostname/@name"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid"/>
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="text()" />
</xsl:stylesheet>