Nmap美化教程

使用教程

新建 txt，将下面代码复制进去，重命名为 nmap.xsl

将文件放到 nmap 安装目录下，覆盖安装

Copy
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat"/>
<xsl:template match="/">










.target:before {
content: "";
display: block;
height: 50px;
margin: -20px 0 0;
}
@media only screen and (min-width:1900px) {
.container {
width: 1800px;
}
}
.footer {
margin-top:60px;
padding-top:60px;
width: 100%;
height: 180px;
background-color: #f5f5f5;
}
.navbar-right {
float: right!important;
margin-right: -15px;
}

Nmap Scanner 扫描报告










概要信息
主机信息
在线主机
服务信息







扫描概要

<p >Nmap 版本：<xsl:value-of select="/nmaprun/@version"/>
<p >Nmap命令：<xsl:value-of select="/nmaprun/@args"/>
<p >开始时间：<xsl:value-of select="/nmaprun/@startstr"/>
<p >结束时间：<xsl:value-of select="/nmaprun/runstats/finished/@timestr"/>


主机信息<xsl:if test="/nmaprun/runstats/hosts/@down > 1024"> (offline hosts are hidden)</xsl:if>




状态
IP
主机名
开放TCP端口数
开放UDP端口数



<xsl:choose>
<xsl:when test="/nmaprun/runstats/hosts/@down > 1024">
<xsl:for-each select="/nmaprun/host[status/@state='up']">

<xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/>
<xsl:value-of select="address/@addr"/>
<xsl:value-of select="hostnames/hostname/@name"/>
<xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/>
<xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/>

</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="/nmaprun/host">

<xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/>
<xsl:value-of select="address/@addr"/>
<xsl:value-of select="hostnames/hostname/@name"/>
<xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/>
<xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/>

</xsl:for-each>
</xsl:otherwise>
</xsl:choose>




$(document).ready(function() {
$('#table-overview').DataTable({
language: {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
});
});



在线主机
<xsl:for-each select="/nmaprun/host[status/@state='up']">


<xsl:value-of select="address/@addr"/><xsl:if test="count(hostnames/hostname) > 0"> - <xsl:value-of select="hostnames/hostname/@name"/></xsl:if>


<xsl:if test="count(hostnames/hostname) > 0">
Hostnames

<xsl:for-each select="hostnames/hostname">
<xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)
</xsl:for-each>

</xsl:if>
端口信息




端口
协议
状态
探测手段
服务
组件
版本
附件信息
CPE 信息



<xsl:for-each select="ports/port">
<xsl:choose>
<xsl:when test="state/@state = 'open'">

<xsl:value-of select="@portid"/>
<xsl:value-of select="@protocol"/>
<xsl:value-of select="state/@state"/>
<xsl:value-of select="state/@reason"/>
<xsl:value-of select="service/@name"/>
<xsl:value-of select="service/@product"/>
<xsl:value-of select="service/@version"/>
<xsl:value-of select="service/@extrainfo"/>
<xsl:value-of select="service/cpe"/>


<xsl:for-each select="script">


<xsl:value-of select="@id"/> <xsl:text>&#xA0;</xsl:text>

<xsl:value-of select="@output"/> <xsl:text>&#xA0;</xsl:text>



</xsl:for-each>

</xsl:when>
<xsl:when test="state/@state = 'filtered'">

<xsl:value-of select="@portid"/>
<xsl:value-of select="@protocol"/>
<xsl:value-of select="state/@state"/> <xsl:value-of select="state/@reason"/>
<xsl:value-of select="service/@name"/>
<xsl:value-of select="service/@product"/>
<xsl:value-of select="service/@version"/>
<xsl:value-of select="service/@extrainfo"/>
<xsl:value-of select="service/cpe"/>

</xsl:when>
<xsl:when test="state/@state = 'closed'">

<xsl:value-of select="@portid"/>
<xsl:value-of select="@protocol"/>
<xsl:value-of select="state/@state"/> <xsl:value-of select="state/@reason"/>
<xsl:value-of select="service/@name"/>
<xsl:value-of select="service/@product"/>
<xsl:value-of select="service/@version"/>
<xsl:value-of select="service/@extrainfo"/>
<xsl:value-of select="service/cpe"/>

</xsl:when>
<xsl:otherwise>

<xsl:value-of select="@portid"/>
<xsl:value-of select="@protocol"/>
<xsl:value-of select="state/@state"/> <xsl:value-of select="state/@reason"/>
<xsl:value-of select="service/@name"/>
<xsl:value-of select="service/@product"/>
<xsl:value-of select="service/@version"/>
<xsl:value-of select="service/@extrainfo"/>
<xsl:value-of select="service/cpe"/>

</xsl:otherwise>
</xsl:choose>
</xsl:for-each>




<xsl:if test="count(hostscript/script) > 0">
主机 脚本
</xsl:if>
<xsl:for-each select="hostscript/script">
<xsl:value-of select="@id"/>
<xsl:value-of select="@output"/>
</xsl:for-each>



</xsl:for-each>

服务信息




IP
端口
协议
服务
组件
版本
CPE
附加信息



<xsl:for-each select="/nmaprun/host">
<xsl:for-each select="ports/port[state/@state='open']">

<xsl:value-of select="../../address/@addr"/><xsl:if test="count(../../hostnames/hostname) > 0"> - <xsl:value-of select="../../hostnames/hostname/@name"/></xsl:if>
<xsl:value-of select="@portid"/>
<xsl:value-of select="@protocol"/>
<xsl:value-of select="service/@name"/>
<xsl:value-of select="service/@product"/>
<xsl:value-of select="service/@version"/>
<xsl:value-of select="service/cpe"/>
<xsl:value-of select="service/@extrainfo"/>

</xsl:for-each>
</xsl:for-each>




$(document).ready(function() {
$('#table-services').DataTable({
language: {
"sProcessing": "处理中...",
"sLengthMenu": "显示 _MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
},
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
}
});
});






This Report Was Generated By LyShark.





</xsl:template>
</xsl:stylesheet>

格式转换

Copy
xsltproc -o [目标文件名] [源文件名] [xsl文件名]