前言

Nmap是一款强大的开源扫描工具。同时Nmap提供了强大的脚本引擎(Nmap Scripting Engine),支持通过Lua脚本语言来扩展Nmap的功能,在Nmap的发行版中已经包含了数百个扩展脚本,除了辅助完成Nmap的主机发现、端口扫描、服务侦测、操作系统侦测四个基本功能,还补充了其他扫描能力:如执行HTTP服务详细的探测、暴力破解简单密码、检查漏洞信息等等。

脚本分类及使用

分类

Nmap脚本主要分为以下几类,引用自:Nmap脚本使用总结

auth: 负责处理鉴权证书(绕开鉴权)的脚本
broadcast: 在局域网内探查更多服务开启状况,如dhcp/dns/sqlserver等服务
brute: 提供暴力破解方式,针对常见的应用如http/snmp等
default: 使用-sC或-A选项扫描时候默认的脚本,提供基本脚本扫描能力
discovery: 对网络进行更多的信息,如SMB枚举、SNMP查询等
dos: 用于进行拒绝服务攻击
exploit: 利用已知的漏洞入侵系统
external: 利用第三方的数据库或资源,例如进行whois解析
fuzzer: 模糊测试的脚本,发送异常的包到目标机,探测出潜在漏洞 intrusive: 入侵性的脚本,此类脚本可能引发对方的IDS/IPS的记录或屏蔽
malware: 探测目标机是否感染了病毒、开启了后门等信息
safe: 此类与intrusive相反,属于安全性脚本
version: 负责增强服务与版本扫描(Version Detection)功能的脚本
vuln: 负责检查目标机是否有常见的漏洞(Vulnerability),如是否有MS08_067

命令行选项

Nmap提供的一些命令如下:

-sC/--script=default:使用默认的脚本进行扫描。
--script=<Lua scripts>:使用某个脚本进行扫描
--script-args=x=x,y=y: 为脚本提供参数
--script-args-file=filename: 使用文件来为脚本提供参数
--script-trace: 显示脚本执行过程中发送与接收的数据
--script-updatedb: 更新脚本数据库
--script-help=<Lua scripts>: 显示脚本的帮助信息

脚本

针对性脚本

​​​收集了Github上的一些较有针对性Nmap脚本:

  • MS15-034、LFI、Nikto、ShellShock、tenda

https://github.com/s4n7h0/NSE

  • 枚举ICS程序和设备

https://github.com/digitalbond/Redpoint

  • 一些NSE脚本合集

https://github.com/cldrn/nmap-nse-scripts

  • 路由器信息收集:

https://github.com/DaniLabs/scripts-nse

  • 暴力破解

https://github.com/lelybar/hydra.nse

  • Cassandra、WebSphere

https://github.com/kost/nmap-nse

  • Scada

https://github.com/drainware/nmap-scada

  • NSE开发工具

https://github.com/s4n7h0/Halcyon

  • Hadoop、Flume

https://github.com/b4ldr/nse-scripts

  • WordPress

https://github.com/peter-hackertarget/nmap-nse-scripts

  • VNC

https://github.com/nosteve/vnc-auth

  • PhantomJS检查Http Header信息

https://github.com/aerissecure/nse

  • WebServices检测

https://github.com/c-x/nmap-webshot

  • SSL心脏滴血

https://github.com/takeshixx/ssl-heartbleed.nse

  • OpenStack

https://github.com/sicarie/nse

  • Apache、Rails-xml

https://github.com/michenriksen/nmap-scripts

  • 网关、DNS

https://github.com/ernw/nmap-scripts

  • MacOS

https://github.com/ulissescastro/ya-nse-screenshooter

  • 目录扫描、WhatCMS、漏洞检测

https://github.com/Cunzhang/NseScripting

  • Redis

https://github.com/axtl/nse-scripts

  • 华为设备检测

https://github.com/vicendominguez/http-enum-vodafone-hua253s

  • Axis​​​​

https://github.com/bikashdash/Axis_Vuln_Webcam

内网渗透

来自影牛milsec公众号的推荐

Nmap提供了许多有效的脚本,无需依赖其他第三方的工具对内网机器进行渗透测试:

  • smb-enum-domains.nse

域控制器信息收集,主机信息、用户、密码策略等

  • smb-enum-users.nse

域控制器扫描

  • smb-enum-shares.nse

遍历远程主机的共享目录

  • smb-enum-processes.nse

通过SMB对主机的系统进程进行遍历

  • smb-enum-sessions.nse

通过SMB获取域内主机的用户登录session,查看当前用户登录情况

  • smb-os-discovery.nse

通过SMB协议来收集目标主机的操作系统、计算机名、域名、全称域名、域林名称、NetBIOS机器名、NetBIOS域名、工作组、系统时间等

  • smb-ls.nse

列举共享目录内的文件,配合smb-enum-share使用

  • smb-psexec.nse

获取到SMB用户密码时可以通过smb-psexec在远程主机来执行命令

  • smb-system-info.nse

通过SMB协议获取目标主机的操作系统信息、环境变量、硬件信息以及浏览器版本等

  • ms-sql-brute.nse

收集组合字典后对域内的MSSQL机器进行破解

  • ms-sql-xp-cmdshell.nse

获得MSSQL的SA权限用户名密码时可以通过Nmap脚本来执行指定命令,可以通过SMB协议或者MSSQL来执行

  • redis.nse

爆破Redis的用户密码,可以结合写入SSH key获取服务器权限

  • oracle-sid-brute.nse

挂载字典爆破oracle的sid

  • oracle-enum-users

通过挂载字典遍历Oracle的可用用户

  • oracle-brute.nse

获取sid之后可以爆破Oracle的用户密码

  • pgsql-brute.nse

PostgreSql用户密码猜解脚本,对pgsql进行密码爆破,适当的权限下可以读写文件、执行命令,从而进一步获取服务器控制权限。

  • svn-brute.nse

对SVN服务器进行爆破,通过这些svn服务器上的内容,我们可以下载源代码,寻找一些有用的信息

工具

Nmap NSE脚本搜索引擎

  • https://github.com/JKO/nsearch

     ================================================
    _ _ _____ _____ _
    | \ | |/ ___|| ___| | |
    | \| |\ `--. | |__ __ _ _ __ ___ | |__
    | . ` | `--. \| __| / _` || '__| / __|| '_ |
    | |\ |/\__/ /| |___ | (_| || | | (__ | | | |
    \_| \_/\____/ \____/ \__,_||_| \___||_| |_|
    ================================================
    Version 0.4b http://goo.gl/8mFHE5 @jjtibaquira
    Email: jko@dragonjar.org | www.dragonjar.org
    ================================================ nsearch> search name:http author:calderon category:vuln
    *** Name Author
    [+] http-vuln-cve2012-1823.nse Paulino Calderon, Paul AMAR
    [+] http-phpself-xss.nse Paulino Calderon
    [+] http-wordpress-enum.nse Paulino Calderon
    [+] http-adobe-coldfusion-apsa1301.nse Paulino Calderon
    [+] http-vuln-cve2013-0156.nse Paulino Calderon
    [+] http-awstatstotals-exec.nse Paulino Calderon
    [+] http-axis2-dir-traversal.nse Paulino Calderon
    [+] http-huawei-hg5xx-vuln.nse Paulino Calderon
    [+] http-tplink-dir-traversal.nse Paulino Calderon
    [+] http-trace.nse Paulino Calderon
    [+] http-litespeed-sourcecode-download.nse Paulino Calderon
    [+] http-majordomo2-dir-traversal.nse Paulino Calderon
    [+] http-method-tamper.nse Paulino Calderon

总结

扫描经常会触发IDS或者其他的安全设备,所以在用的时候应根据实际的环境,来选择合适的脚本。

参考

一些Nmap NSE脚本推荐的更多相关文章

  1. NMAP执行脚本smb-check-vulns.nse出错

    错误信息:NSE: failed to initialize the script engine: /usr/bin/../share/nmap/nse_main.lua:801: ‘smb-chec ...

  2. nmap加载nse脚本在内网渗透中的使用-下

    smb-ls.nse 列举共享目录内的文件,配合smb-enum-share使用nmap -p 445 <ip> --script smb-ls --script-args 'share= ...

  3. nmap加载nse脚本在内网渗透中的使用-上

    转载自:https://mp.weixin.qq.com/s/zEgHxJEOfaiYVZYmg7NnXA? 大多数情况下,大家都认为nmap只是一个扫描工具,而不把当成是一个渗透工具.nmap集成了 ...

  4. weblogic nmap扫描脚本

     CVE-2018-2894 / Nmap利用脚本,可批量批量快速扫描getshell.检测漏洞.利用漏洞 地址:https://github.com/Rvn0xsy/nse_vuln/tree/ma ...

  5. Tampermonkey脚本安装问题及自用脚本推荐

    对于高手来说,chrome浏览器中即使没有其他任何chrome插件,可能都无关紧要.但是有一个插件必不可少, 那就是Tampermonkey油猴插件.Tampermonkey是Chrome上最流行的用 ...

  6. TamperMonkey 使用指南以及脚本推荐

    写在前面 Chrome浏览器是最适合开发者使用的浏览器,不仅仅是因为Chrome对于Js的友好支持,更是由于Chrome支持丰富且功能强大的插件,扩展了浏览器的功能和使用体验. 在这些插件里面,相信你 ...

  7. Nmap的一些常用的nse脚本

    转自freebuf.com/  点击跳转 在这篇文章中,我们将研究最著名的渗透工具之一 Nmap 一款标志性的跨平台扫描器.它的原意为Network Mapper(网络映射器),具有相当强大的扫描功能 ...

  8. nmap 使用脚本引擎进行扫描

    1.下载nmap(nmap官网). 2.安装nmap. 3.编辑环境变量(windows下所需),保存.

  9. 利用NSE脚本检测域传送和证书透明度滥用

    nslookup -type=NS <domain> <server> nmap -p 53 --script dns-zone-transfer --script-args ...

随机推荐

  1. JavaScript常见排序算法

    1.冒泡排序 function bubble_sort(arr) { if (arr.length <= 1) { return arr; } var len = arr.length; for ...

  2. python socket粘包及实例

    1.在linux中经常出现粘包的出现(因为两个send近靠着,造成接受到的数据是在一起的.)解决方法: 在服务端两send的中间中再添加一个recv(),客户端添加一个send(),服务端收到信息确认 ...

  3. numpy array 分割

    import numpy as np A = np.array([1,1,1])[:,np.newaxis] B = np.array([2,2,2])[:,np.newaxis] #合并 C = n ...

  4. Promethues配置

    # my global config global: scrape_interval: 10s # Set the scrape interval to every 15 seconds. Defau ...

  5. 【内推】平安产险大数据测试开发工程师,15-30k!

    平安产险技术岗内部推荐-大数据测试开发工程师等-欢迎中年人和2020应届生 上班地点:深圳福田平安金融中心 另有大量 上海 北京 成都 广州 岗位 交流qq群 828186629 微信pythonte ...

  6. 【原创】(三)Linux进程调度器-进程切换

    背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: Kernel版本: ...

  7. 在命令行中使用pushd和popd进行快速切换目录

    当频繁的切换三个或三个以上的目录的时候,可以使用pushd命令.每次使用目录路径被存储在栈中,然后用pushd和popd操作在目录之间切换. 例如: [root@gameserver1 ~]# pus ...

  8. 自然语言处理NLTK之入门

    环境:window10 + python3 一.安装NLTK pip install nltk # 或者 PyCharm --> File --> Settings --> Proj ...

  9. 正式学习MVC 04

    1.ActionResult ActionResult是一个父类, 子类包括了我们熟知的 ViewResult 返回相应的视图 ContentResult  返回字符串 RedirectResult( ...

  10. vue組件自学

    Vue组件 什么是组件? 组件 (Component) 是 Vue.js 最强大的功能之一.组件可以扩展 HTML 元素,封装可重用的代码.在较高层面上,组件是自定义元素,Vue.js 的编译器为它添 ...