自动化识别 CDN节点端口特征

版权声明:本文为博主原创文章,未经博主允许可以转载。 https://blog.csdn.net/helloexp/article/details/82986038
  1. 首先找一个存在cdn节点的网站

http://ping.chinaz.com/www.uniqlo.cn

通过在线网站查到的CDN节点示例

2、通过上一步可以看到,目标网站有很多cdn节点(未完全识别,需要我们进一步识别)

3、根据http头部,对其中一个确认的cnd节点进行端口分析

识别到的端口信息

4、在此假设,目标网站使用了同一家cdn、并且cdn节点端口开放情况类似

5、利用下面的自动化代码可以区分出cdn节点的IP地址

#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import telnetlib

hosts=open('cdnList.txt','r')

ports=['80','8080','8081','8082']
cdn=[]
for host in hosts:
	host=host.strip('\n')
	try:
		for port in ports:
			tel=telnetlib.Telnet(host,port=port,timeout=3)
			tel.set_debuglevel(2)
			print(tel)			
			cdn.append(host)
	except Exception as e:
		print(e)
hosts.close()

hosts=open('cdnList.txt','r')
origin=[]
for i in hosts:
	i=i.strip('\n')
	origin.append(i)

print('origin size is ',len(set(origin)))
print('cdn size is ',len(set(cdn)))

real=list(set(origin).difference(set(cdn)))
print('real IP size is ',len(real))
print('real ip list is ',real)

diff=list(set(origin).intersection(set(cdn)))
print('差集 大小是 ',len(diff))
print('差集是 :',diff)

6、代码执行结果如下

脚本执行结果

7、最后可以对排查出来的ip进行手工确认工作

附件地址【附件中包含文中的脚本和使用到的cdn列表】:

链接:https://pan.baidu.com/s/1HUwBWmsjiMhYi71lUgKyDg 密码:cmsr

猜你喜欢

转载自blog.csdn.net/helloexp/article/details/82986038