首先 Nmap扫描443端口并保存为xml报告输出

nmap -T5 -Pn -p 443 -iL C:\Users\loki\Desktop\443_Scan.txt -oX C:\Users\loki\Desktop\443_shahebao.xml

然后 为了在windows上顺利的使用 xsltproc 相关库文件下载地址:https://zlatkovic.com/pub/libxml/

xsltproc主程序:libxslt-1.1.26.win32.zip;其中包含我们所需要的xsltproc可执行文件:xsltproc.exe

运行xsltproc所需要的一些库

C语言实现的XML解析器:libxml2-2.7.8.win32.zip;其支持N多规范或协议,比如XML,XML-NS,XPath,XPointer,XInclude,UTF-8/UTF-16,XML Catalog,Canonical XML,Relax NG等。

字符编码转换:iconv-1.9.2.win32.zip;比如从UTF-8转换为GB18030,就可以用iconv。

压缩工具:zlib-1.2.5.win32.zip

全部下载好以后,整合解压到一个目录下:

C:\Users\loki>tree /F C:\Users\loki\Desktop\All\comb
卷 OS 的文件夹 PATH 列表
卷序列号为 DA80-61BA
C:\USERS\LOKI\DESKTOP\ALL\COMB
│ readme.txt

├─bin
│ iconv.dll
│ iconv.exe
│ libexslt.dll
│ libxml2.dll
│ libxslt.dll
│ minigzip.exe
│ mode.xsl
│ xmlcatalog.exe
│ xmllint.exe
│ xsltproc.exe
│ zlib1.dll

├─include
│ │ iconv.h
│ │ zconf.h
│ │ zlib.h
│ │
│ ├─libexslt
│ │ exslt.h
│ │ exsltconfig.h
│ │ exsltexports.h
│ │ libexslt.h
│ │
│ ├─libxml
│ │ c14n.h
│ │ catalog.h
│ │ chvalid.h
│ │ debugXML.h
│ │ dict.h
│ │ DOCBparser.h
│ │ encoding.h
│ │ entities.h
│ │ globals.h
│ │ hash.h
│ │ HTMLparser.h
│ │ HTMLtree.h
│ │ list.h
│ │ nanoftp.h
│ │ nanohttp.h
│ │ parser.h
│ │ parserInternals.h
│ │ pattern.h
│ │ relaxng.h
│ │ SAX.h
│ │ SAX2.h
│ │ schemasInternals.h
│ │ schematron.h
│ │ threads.h
│ │ tree.h
│ │ uri.h
│ │ valid.h
│ │ xinclude.h
│ │ xlink.h
│ │ xmlautomata.h
│ │ xmlerror.h
│ │ xmlexports.h
│ │ xmlIO.h
│ │ xmlmemory.h
│ │ xmlmodule.h
│ │ xmlreader.h
│ │ xmlregexp.h
│ │ xmlsave.h
│ │ xmlschemas.h
│ │ xmlschemastypes.h
│ │ xmlstring.h
│ │ xmlunicode.h
│ │ xmlversion.h
│ │ xmlwriter.h
│ │ xpath.h
│ │ xpathInternals.h
│ │ xpointer.h
│ │
│ └─libxslt
│ attributes.h
│ documents.h
│ extensions.h
│ extra.h
│ functions.h
│ imports.h
│ keys.h
│ libxslt.h
│ namespaces.h
│ numbersInternals.h
│ pattern.h
│ preproc.h
│ security.h
│ templates.h
│ transform.h
│ trio.h
│ triodef.h
│ variables.h
│ win32config.h
│ xslt.h
│ xsltconfig.h
│ xsltexports.h
│ xsltInternals.h
│ xsltlocale.h
│ xsltutils.h
│ xsltwin32config.h

└─lib
iconv.lib
iconv_a.lib
libexslt.lib
libexslt_a.lib
libxml2.lib
libxml2_a.lib
libxml2_a_dll.lib
libxslt.lib
libxslt_a.lib
zdll.lib
zlib.lib

解压后目录树参考

xsltproc 命令用法

xsltproc <New名字.html> -o <模板..xsl> <nmap生成的.xml>

举例:

xsltproc.exe -o C:\Users\XXX\Desktop\New_lianhua.html .\mode.xsl C:\Users\XXX\Desktop\443_lianhua.xml

# xsl 模板内容,使用的事LyShark大神定义的模板,内容如下:保存为mode.xsl 

<?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="/">
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css"/>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
<style>
.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;
}
</style>
<title>Nmap Scanner 扫描报告</title>
</head>
<body>
<!--导航栏-->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"><span class="glyphicon glyphicon-home"></span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#summary">概要信息</a></li>
<li><a href="#scannedhosts">主机信息</a></li>
<li><a href="#onlinehosts">在线主机</a></li>
<li><a href="#openservices">服务信息</a></li>
</ul>
</div>
</div>
</nav> <!--内容区-->
<div class="container">
<h2 id="summary" class="target">扫描概要</h2>
<div class="target">
<p >Nmap 版本:<xsl:value-of select="/nmaprun/@version"/></p>
<p >Nmap命令:<xsl:value-of select="/nmaprun/@args"/></p>
<p >开始时间:<xsl:value-of select="/nmaprun/@startstr"/> </p>
<p >结束时间:<xsl:value-of select="/nmaprun/runstats/finished/@timestr"/></p>
</div> <h2 id="scannedhosts" class="target">主机信息<xsl:if test="/nmaprun/runstats/hosts/@down > 1024"><small> (offline hosts are hidden)</small></xsl:if></h2>
<div class="table-responsive">
<table id="table-overview" class="table table-striped dataTable" role="grid">
<thead>
<tr>
<th>状态</th>
<th>IP</th>
<th>主机名</th>
<th>开放TCP端口数</th>
<th>开放UDP端口数</th>
</tr>
</thead>
<tbody>
<xsl:choose>
<xsl:when test="/nmaprun/runstats/hosts/@down > 1024">
<xsl:for-each select="/nmaprun/host[status/@state='up']">
<tr>
<td><span class="label label-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/></span></td>
<td><xsl:value-of select="address/@addr"/></td>
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="/nmaprun/host">
<tr>
<td><span class="label label-danger"><xsl:if test="status/@state='up'"><xsl:attribute name="class">label label-success</xsl:attribute></xsl:if><xsl:value-of select="status/@state"/></span></td>
<td><xsl:value-of select="address/@addr"/></td>
<td><xsl:value-of select="hostnames/hostname/@name"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='tcp'])"/></td>
<td><xsl:value-of select="count(ports/port[state/@state='open' and @protocol='udp'])"/></td>
</tr>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</tbody>
</table>
</div>
<script>
$(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": ": 以降序排列此列"
}
}
});
}); </script> <h2 id="onlinehosts" class="target">在线主机</h2>
<xsl:for-each select="/nmaprun/host[status/@state='up']">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><xsl:value-of select="address/@addr"/><xsl:if test="count(hostnames/hostname) > 0"> - <xsl:value-of select="hostnames/hostname/@name"/></xsl:if></h3>
</div>
<div class="panel-body">
<xsl:if test="count(hostnames/hostname) > 0">
<h4>Hostnames</h4>
<ul>
<xsl:for-each select="hostnames/hostname">
<li><xsl:value-of select="@name"/> (<xsl:value-of select="@type"/>)</li>
</xsl:for-each>
</ul>
</xsl:if>
<h4>端口信息</h4>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>端口</th>
<th>协议</th>
<th>状态</th>
<th>探测手段</th>
<th>服务</th>
<th>组件</th>
<th>版本</th>
<th>附件信息</th>
<th>CPE 信息</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="ports/port">
<xsl:choose>
<xsl:when test="state/@state = 'open'">
<tr class="success">
<td title="Port"><xsl:value-of select="@portid"/></td>
<td title="Protocol"><xsl:value-of select="@protocol"/></td>
<td title="State"><xsl:value-of select="state/@state"/></td>
<td title="Reason"><xsl:value-of select="state/@reason"/></td>
<td title="Service"><xsl:value-of select="service/@name"/></td>
<td title="Product"><xsl:value-of select="service/@product"/></td>
<td title="Version"><xsl:value-of select="service/@version"/></td>
<td title="Extra Info"><xsl:value-of select="service/@extrainfo"/></td>
<td title="CPE Info"><xsl:value-of select="service/cpe"/></td>
</tr> <xsl:for-each select="script">
<tr class="script">
<td></td>
<td><xsl:value-of select="@id"/> <xsl:text> </xsl:text></td>
<td colspan="7">
<pre><xsl:value-of select="@output"/> <xsl:text> </xsl:text></pre>
</td>
</tr> </xsl:for-each> </xsl:when>
<xsl:when test="state/@state = 'filtered'">
<tr class="warning">
<td><xsl:value-of select="@portid"/></td>
<td><xsl:value-of select="@protocol"/></td>
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
<td><xsl:value-of select="service/@name"/></td>
<td><xsl:value-of select="service/@product"/></td>
<td><xsl:value-of select="service/@version"/></td>
<td><xsl:value-of select="service/@extrainfo"/></td>
<td><xsl:value-of select="service/cpe"/></td>
</tr>
</xsl:when>
<xsl:when test="state/@state = 'closed'">
<tr class="active">
<td><xsl:value-of select="@portid"/></td>
<td><xsl:value-of select="@protocol"/></td>
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
<td><xsl:value-of select="service/@name"/></td>
<td><xsl:value-of select="service/@product"/></td>
<td><xsl:value-of select="service/@version"/></td>
<td><xsl:value-of select="service/@extrainfo"/></td>
<td><xsl:value-of select="service/cpe"/></td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr class="info">
<td><xsl:value-of select="@portid"/></td>
<td><xsl:value-of select="@protocol"/></td>
<td><xsl:value-of select="state/@state"/><br/><xsl:value-of select="state/@reason"/></td>
<td><xsl:value-of select="service/@name"/></td>
<td><xsl:value-of select="service/@product"/></td>
<td><xsl:value-of select="service/@version"/></td>
<td><xsl:value-of select="service/@extrainfo"/></td>
<td><xsl:value-of select="service/cpe"/></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tbody>
</table>
</div> <xsl:if test="count(hostscript/script) > 0">
<h4>主机 脚本</h4>
</xsl:if>
<xsl:for-each select="hostscript/script">
<h5><xsl:value-of select="@id"/></h5>
<pre style="white-space:pre-wrap; word-wrap:break-word;"><xsl:value-of select="@output"/></pre>
</xsl:for-each> </div>
</div>
</xsl:for-each> <h2 id="openservices" class="target">服务信息</h2>
<div class="table-responsive">
<table id="table-services" class="table table-striped dataTable" role="grid">
<thead>
<tr>
<th>IP</th>
<th>端口</th>
<th>协议</th>
<th>服务</th>
<th>组件</th>
<th>版本</th>
<th>CPE</th>
<th>附加信息</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="/nmaprun/host">
<xsl:for-each select="ports/port[state/@state='open']">
<tr>
<td><xsl:value-of select="../../address/@addr"/><xsl:if test="count(../../hostnames/hostname) > 0"> - <xsl:value-of select="../../hostnames/hostname/@name"/></xsl:if></td>
<td><xsl:value-of select="@portid"/></td>
<td><xsl:value-of select="@protocol"/></td>
<td><xsl:value-of select="service/@name"/></td>
<td><xsl:value-of select="service/@product"/></td>
<td><xsl:value-of select="service/@version"/></td>
<td><xsl:value-of select="service/cpe"/></td>
<td><xsl:value-of select="service/@extrainfo"/></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</div>
<script>
$(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": ": 以降序排列此列"
}
}
});
});
</script>
</div>
<!-- 页脚 -->
<footer class="footer" style="height: 50px; margin-top: 20px; padding-top: 20px;">
<div class="container">
<p class="text-muted">
This Report Was Generated By <a href='https://www.cnblogs.com/lyshark'>LyShark</a>.<br/>
</p>
</div>
</footer>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

为了以后能直接在命令行使用,需要增加系统环境变量(略)

参考资料:

https://zhuanlan.zhihu.com/p/564996663

https://www.crifan.com/files/doc/docbook/docbook_dev_note/release/webhelp/download_xsltproc_win.html

nmap扫描结果保存 xml to html for windows的更多相关文章

  1. 提取nmap扫描出来的xml文件

    代码: <?php $file_path = "xiamen_scan_ok.xml"; $file = fopen($file_path, "r"); ...

  2. Python调用nmap扫描网段主机信息生成xml

    #!/usr/bin/env python # -*- coding: utf_8 -*- # Date: 2015年10月23日 # Author:蔚蓝行 # 博客 http://www.cnblo ...

  3. 基于nmap扫描结果的端口爆破工具:BrutesPray

      大家搞内网或者C段渗透测试的时候可能遇到很多时候需要对大批的主机进行精确爆破,这时候BruteSpray就派上用场了. BruteSpray是一款基于nmap扫描输出的gnmap/XML文件.自动 ...

  4. nmap扫描验证多种漏洞

    nmap在Kali Linux中是默认安装的.它不仅可以用来确定目标网络上计算机的存活状态,而且可以扫描各个计算机的操作系统.开放端口.服务,还有可能获得用户的证书. 命令结构: nmap -sS - ...

  5. 2019-9-10:渗透测试,基础学习,nmap扫描命令,php基本语法学习,笔记

    nmap参数-sT,使用tcp全连接的方式 ,扫描过程需要三次握手,建立链接,则说明端口开放,扫描速度慢-sS,使用syn的数据包去检测,接收到ACK说明端口开放-sN,null扫描,发出去的数据包不 ...

  6. 黑客最喜欢的15个Nmap扫描命令,熟练掌握你也能成为黑客大神

    1.针对IP或主机的基本Nmap扫描 nmap IP 现在,如果要扫描主机名,只需替换主机的IP,如下所示: nmap 域名 2.扫描本地或远程服务器上的特定端口或扫描整个端口范围 nmap -p 1 ...

  7. 转-Nmap扫描原理与用法

    1     Nmap介绍 操作系统与设备类型等信息. Nmap的优点: 1.      灵活.支持数十种不同的扫描方式,支持多种目标对象的扫描. 2.      强大.Nmap可以用于扫描互联网上大规 ...

  8. Nmap扫描原理与用法

    Nmap扫描原理与用法 1     Nmap介绍 Nmap扫描原理与用法PDF:下载地址 Nmap是一款开源免费的网络发现(Network Discovery)和安全审计(Security Audit ...

  9. Nmap扫描基础常用命令(包含进阶使用)

    Nmap扫描常用命令  - Nmap scans common commands 1.扫描单个目标 nmap ip 如:nmap 192.168.0.101 2.扫描多个目标 nmap ip1 ip2 ...

  10. nmap扫描内网存活机器脚本

    nmap扫描内网存活机器并保存在指定文件中. host.sh #/usr/bin/bash read -p "Please input scan host or network:" ...

随机推荐

  1. PostGIS之Geometry

    1. 概述 PostGIS 是PostgreSQL数据库一个空间数据库扩展,它添加了对地理对象的支持,允许在 SQL 中运行空间查询 PostGIS官网:About PostGIS | PostGIS ...

  2. LCD1602液晶屏

    单片机系统用到的液晶屏(简称LCD)有很多类型,最常用的有两种,一种是1602型(即每行可显示16个字符,同时能显示2行),另一种是12864型(即每行可显示128个点,每列可显示64个点).一般前一 ...

  3. openssh 升级

    1.基础安装包准备  PS:最好先下载 telnet 服务端并启动,以免 sshd 服务启动失败后无法登录 官方网站下载最新版*.tar.gz安装包: 官方下载地址:http://ftp.openbs ...

  4. 把逗号分隔的String字符串转List<Integer>

    把逗号分隔的String字符串转int集合 集合或数组转变为逗号分隔的字符串的几种方式 1.自己编码实现 2.org.apache.commons.lang3.StringUtils 3.String ...

  5. postman 使用简单汇总

    postman官网下载地址:https://www.postman.com/downloads/ Postman支持功能 1.快速构建 2.参数化与变量设置提取 3.查看请求数据 4.提供断言功能 5 ...

  6. LinuxK8S集群搭建一(Master节点部署)

    系统环境: CentOS 7 64位 准备工作: 通过虚拟机创建三台CentOS服务器,可参照之前的文章:Windows10使用VMware安装centos192.168.28.128 --maste ...

  7. foreach 和for

    "foreach和for循环如果只是遍历集合或者数组,用foreach好些,如果是对集合中的值进行修改,就要用for循环了,其实foreach的内部原理其实也是Iterator,但不能像It ...

  8. Java面向对像之方法重写

    方法重写Override 重写:需要有继承关系,子类重写父类的方法! 特点: 1.方法名必须相同 2.参数列表必须相同 3.修饰符:范围可以扩大:public > Protected > ...

  9. 发布 Net8预览版1(Announcing .NET 8 Preview 1)

    发布 net8预览版1(Announcing .NET 8 Preview 1) 1.对Net持续看好,对未来更加充满信心. 2.我主要关注Asp.Net Core .NET 8 中的新增功能 Wha ...

  10. JavaScript项目榜单

    JavaScript项目榜单 参考资料 2022年最受欢迎的JavaScript项目榜单出炉 Best of JS 正式公布 2022 年 JavaScript 明星项目榜单 该榜单提供了过去 12 ...