Kali Linux 渗透测试:防火墙、负载均衡、WAF识别扫描工具(15)

一、防火墙识别

防火墙简单的识别原理方式,如下图:

Kali Linux防火墙识别

可以简单明了看出:发送SYN不回应,发送ACK回RST可以说明开启过滤等等。

 

1、Python脚本

基于上图中的这个原理,我们可以写一个脚本来对防火墙来探测和识别:

#!/usr/bin/python

from scapy.all import *
import logging

logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import sys

if len(sys.argv) != 3:
    print "Usage - ./FW_detect.py [Target.IP] [Target Port]"
    print "Example - ./FW_detect.py 1.1.1.1 443"
    print "Example will determine if filtering exists on port 443 of Host 1.1.1.1"
    sys.exit()

ip = sys.argv[1]
port = int(sys.argv[2])

ACK_response = sr1(IP(dst=ip) / TCP(dport=port, flags="A"), timeout=1, verbose=0)
SYN_response = sr1(IP(dst=ip) / TCP(dport=port, flags="S"), timeout=1, verbose=0)

if SYN_response == None and int(ACK_response[TCP].flags) == 4:
    print "Stateful filtering in place"
elif (int(SYN_response[TCP].flags) == 18 or int(SYN_response[TCP].flags) == 6) and (ACK_response == None) == 4:
    print "Stateful filtering in place"
elif (int(SYN_response[TCP].flags) == 18 or int(SYN_response[TCP].flags) == 6) and int(ACK_response[TCP].flags) == 4:
    print "Port is unfiltered or open"
elif (ACK_response == None) and (SYN_response == None):
    print "Port is closed"
else:
    print "Unable to determine if the port is filtered"

 

这里的flags==18或者是6或者是4,是TCP中FLAG代表的数字:

flags==18

 

OK,我们可以试试这个脚本:

如果脚本是从windows移过来的:

vi xxx.py
:set fileformat=unix
:wq
chmod u+x xxx.py
./xxx.py

python防火墙识别

 

随便扫了两个端口,结果准确性不错!

 

2、nmap

我们可以用Nmap来验证一下扫描结果正确性:

root@kali:~# nmap 10.14.4.252 -p 445

nmap防火墙

 

二、负载均衡识别

负载均衡从其应用的地理结构上分为本地负载均衡(Local Load Balance)和全局负载均衡(Global Load Balance,也叫地域负载均衡)

本地负载均衡是指对本地的服务器群做负载均衡,全局负载均衡是指对分别放置在不同的地理位置、有不同网络结构的服务器群间作负载均衡。

它提供了一种廉价有效透明的方法扩展网络设备和服务器的带宽、增加吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性。

简单来说是DNS,即同一个域名对应不同IP。

基于web的服务负载均衡经常使用Nginx、Apache应用层负载均衡。

 

1、lbd

命令:LBD

root@kali:~# lbd www.qq.com

lbd负载均衡识别

 

三、WAF识别

WAF(Web Application Firewall)的中文名称叫做“Web应用防火墙”。

利用国际上公认的一种说法,WAF的定义是这样的:Web应用防火墙是通过执行一系列针对HTTP/HTTPS的安全策略来专门为Web应用提供保护的一款产品。

通过从上面对WAF的定义中,我们可以很清晰的了解到,WAF是一种工作在应用层的、通过特定的安全策略来专门为Web应用提供安全防护的产品。

基于机器学习结合语法词法分析的WAF将成为主流,几乎可防止所有的SQL注入。

 

1、waf00f

命令waf00f :

root@kali:~# wafw00f www.qq.com

waf00f

 

检测到某网站使用 IBM Web Application Security;

 

2、nmap

使用Nmap的脚本也可以轻易实现:

root@kali:~# nmap www.microsoft.com --script=http-waf-detect.nse

nmap waf识别

头像
  • ¥ 199.0元
  • 市场价:199.0元
  • ¥ 498.0元
  • 市场价:598.0元
  • ¥ 298.0元
  • 市场价:598.0元
  • ¥ 69.0元
  • 市场价:69.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: