网络安全中端口扫描的一些方案介绍( 三 )


网络安全中端口扫描的一些方案介绍

文章插图
80端口建立起了连接
全连接的端口扫描:ncnc也是可以做扫描工具的,只需要使用参数-z:
网络安全中端口扫描的一些方案介绍

文章插图
nc -nv -w 1 -z 36.152.44.238 70-90
僵尸扫描僵尸扫描的定义已经在前面说过了,这里直接来介绍具体实现,分别用scapy和nmap 。
需要先假设有了一台可以使用的僵尸机 。
僵尸扫描:scapy直接上脚本吧,应该都能看懂,如果有疑问,可以私信咨询我 。脚本里主要是提供了两个方法,一个是校验不清楚僵尸机是否符合使用条件时调用,也就是最开始输入1的时候,另一个就是直接指定僵尸机和目标机器,直接进行扫描 。
#!/usr/bin/python3import logginglogging.getLogger('scapy.runtime').setLevel(logging.ERROR)from scapy.all import *def ipid(zombie):reply1 = sr1(IP(dst=zombie)/TCP(flags='SA'), timeout=2, verbose=0)send(IP(dst=zombie)/TCP(flags='SA'), verbose=0)reply2 = sr1(IP(dst=zombie)/TCP(flags='SA'), timeout=2, verbose=0)if reply2[IP].id == (reply1[IP].id+2):print('IPID sequence is incremental and target Appears to be idle. ZOMBIE LOCATED')response = input('Do you want to use this zombie to perform a scan?(Y or N): ')if response == 'Y':target = input('Enter the IP address of the target system: ')zombie_scan(target, zombie)else:print('Either the IPID sequence is not incremental or the target is not idle. NOT A GOOD ZOMBIE')def zombie_scan(target, zombie):print('n Scanning target ' + target + ' with zombie ' + zombie)print('n ------ Open Ports on Target ------ n ')for port in range(1, 10000):try:start_val = sr1(IP(dst=zombie)/TCP(flags='SA', dport=port), timeout=2, verbose=0)send(IP(src=https://www.isolves.com/it/wl/aq/2022-03-03/zombie, dst=target)/TCP(flags='S', dport=port), verbose=0)end_val = sr1(IP(dst=zombie)/TCP(flags='SA'), timeout=2, verbose=0)if end_val[IP].id == (start_val[IP].id + 2):print(port)except:passprint('------Zombie Scan Suite------n')print('1 - Identify Zombie Host n')print('2 - Perform Zombie Scan n')ans = input('Select an Option(1 or 2): ')if ans == '1':zombie = input('Enter IP address to test IPID sequence: ')ipid(zombie)else:if ans == '2':zombie = input('Enter IP address for zombie system: ')target = input('Enter IP address for scan target: ')zombie_scan(target, zombie)我在网上找了一些机器,一时半会没找到合适的僵尸机,这里就不演示效果了 。
僵尸扫描:nmapnmap提供了专门用来检测指定机器是否是否作为僵尸机:
nmap -p端口 僵尸主机IP地址 --script=ipidseq.nse如果能正常使用的话,在执行结果里会返回ipdi是否是递增的 。
然后在有了合适的僵尸机以后,可以通过-sI参数来指定使用的僵尸机:
nmap 目标主机IP -sI 僵尸主机IP -Pn -p 端口号



推荐阅读