第七章(十一)—主动信息收集—防火墙识别

防火墙识别

目的:
通过发送的扫描数据包,不引起防火墙的告警,同时还能根据他的回包识别出防火墙上过滤了那些端口。这些过滤的端口就不是在防火墙上开放的端口。
在这里插入图片描述

1.scapy+脚本

对防火墙进行识别的脚本fw_detect.py:
脚本好像存在问题

#!/usr/bin/python

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

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

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

ACK_reponse = sr1(IP(dst=ip)/TCP(dport=port,flags="A"),timeout=1,verbose=0)
SYN_reponse = sr1(IP(dst=ip)/TCP(dport=port,flags="S"),timeout=1,verbose=0)
if(ACK_reponse == None) and (SYN_response == None):
	print "Port is either unstatefully filtered or host is down"
elif((ACK_response == None) or (SYN_response == None)) and not ((ACK_reponse == None) and (SYN_reponse == None)):
	print "Stateful filtering in place" #这两句写的有问题
elif int(SYN_reponse[TCP].flags) == 18:
	print "Port is unfiltered and open"
elif int(SYN_reponse[TCP].flags) == 20:
	print "Port is unfiltered and closed"
else:
	print "Unable to determine if the port is filtered"

在这里插入图片描述

2.nmap

nmap -sA 192.168.1.132 -p 22
#-sA:发送TCP的ACK包进行探测
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值