恨非凌空鸟,欲飞缺双翅。
前言
2019年7月22日:这个项目的想法和设计都是很好的,但是技术手段实现不现实,等有空了完全重写,到时候需要扫描全网开放端口+友链爬+子域名爆破+百度搜索引擎等方式获取资源和信息
2018年10月6日22:35:07更新细节
大概布局已经出来了,具体完善前端和数据展示可能需要2周
在可视化会使用pyecharts
最近挺懒的,啥都不想搞,权当温习一下以前的知识吧~都快要忘了…
0.35 版本
目前是0.37版本,全文共1800字,阅读约需5分钟.
功能介绍
Langzi_eyes 是一个模仿zoomeye的练习品,基于FLASK+SQLALCHEMY+JINJA2+Python。主要是为了复习以前学过的知识,多学不练假把式。功能如下:
- 网址全自动化采集入库
- 网址标题,内容,IP地址,端口开放情况采集
- 一键提取符合要求的网址与IP
功能可以参考zoomeye,查询界面如图
在输入框中输入相关参数,比如要搜索edu.cn的网址,可以在搜索框中填写edu.cn,然后点击提交请求
数据库回显数据,点击提取数据可以把这些网址或者IP批量保存到本地
基本原理
URL采集
URL的来源在/app/web/config.py文件中的4个网址,从中提取外链入库,然后循环采集即可是实现无限循环采集。
信息获取
在/app/web/getinfo.py 文件中类方法实现信息获取。调用这个类的方法如下:
d = Get_Info(url='http://www.langzi.fun')
d1 = d.get_urls()
# 返回这个传入网址中所有的外链,返回对象为列表,如果没有数据返回None,下同
d2 = d.get_infos()
# 返回这个网址中的标题,内容,返回对象为字典
d3 = d.get_ips()
# 返回这个网址的ip和开放端口,返回对象为字典
数据库操作
在/app/web/database.py的两个类方法,使用ORM模型来操作数据库增删改查。
核心功能
在/app/web/runmain.py文件中的run函数,功能是从数据库获取网址,然后爬行友链
,然后对友链信息监测,友链保存到数据库,信息保存到数据库。
其中的searchs函数是最核心的,功能是从前端获取参数,带入数据库查询,然后把结果返回到前端。
从前端获取的参数带入数据库匹配后结果如下
result 字典是这样内容
{'urls': [http://pt.597.com/, http://school.jjoobb.cn/}
{'ips': [http://pt.597.com/, http://school.jjoobb.cn/}
{'ports': [http://pt.597.com/, http://school.jjoobb.cn/}
字典的键取决于网页是否在相关输入框设置数值
但是字典的值都是网址,类型为列表
然后回显给前端的数据如下:
最终的结果,返回的是一个字典类型,格式如下:
all_infos = {'1':{'url':'http://www.langzi.fun','title'='浪子博客'......}}
最后把结果给JINJA2渲染即完成。
使用方法
在目录/app/web/config.py 设置好登陆账号,密码,数据库账号密码等等
在config中可以自定义补充几个初始网址,注意格式别忘了有单引号和冒号,不过一般可以不动这个。
登陆进入后,在输入框输入想要查询的信息即可获取结果。
# 这些都是数据库信息
HOST = '127.0.0.1'
# 数据库名字,如果修改数据库名字会创建新的数据库
DATABASE = 'langzi_eyes'
USER = 'root'
PASSWORD = 'root'
PORT = 3306
DRIVER = 'pymysql'
# 线程数设置
THREADS = 50
THREADED = True
DEBUG = False
# 这两是登陆网页的账号密码
login_uesr = 'admin'
login_pass = 'admin'
# 这6个网址是初始网址,你可以替换成别的,但是注意别忘了有单引号和逗号
urls = ['http://www.hao123.com',
'https://hao.360.cn',
'https://www.2345.com',
'https://123.sogou.com',
'http://www.26595.com',
'http://www.dn1234.com']
补充
确实这个小网站功能少,页面简单….并且我还没学JQuery,不知道怎么分页…但是以后应该会慢慢拓展,增加新的功能上去,删除一些花里胡哨的东西。既然是网址信息自动化采集,就要专注于网址信息收集,查询与提取,一些什么漏洞扫描功能的话,就不拧上去了,太杂了非我所愿。
下载地址
2018年10月23日20:39:18 更新细节
- 更新CMS识别
- 更新工控设备,摄像头等其他物联网设备检测识别
- 端口扫描采用masscan检查开放情况,并且使用whatportis来判断端口的服务
- 新增国家坐标判断
- 更加好看的前端UI
- 一些细节优化
更新过程
觉得masscan应该有python的库,结果一搜索真的有,于是安装之
pip install python-masscan
这个安装的只是masscan的python整理api。你其实还要安装masscan,在巡风扫描器的masscan中下载了win10的编译好的masscan.exe,然后把masscan.exe所在的文件夹加入系统环境变量。cmd下运行masscan.exe提示确实wpacp.dll,网络流量嗅探劫持扫描都依赖这个dll文件,安装nmap,wireshark也都需要这个的,安装就ok了。
使用方法如下:
import masscan
mas = masscan.PortScanner()
mas.scan('110.0.0.0',ports='3389,80')
print mas.scan_result
ports是可选参数,如果不填的话,默认全端口。返回对象是字典格式,解析这个字典看看结果。
import masscan
mas = masscan.PortScanner()
mas.scan('110.0.0.0')
result = mas.scan_result()
d = result['masscan']
for x in d:
print x + ':' + str(d[x])
print d.keys()
print '-'*50
d1 = result['scan']
for x in d1:
print x + ':' + str(d1[x])
print d1.keys()
扫描这个ip的全端口,打印结果看看
scanstats:{'timestr': '2018-10-23 20:30:20', 'uphosts': '8', 'downhosts': '0', 'totalhosts': '8', 'elapsed': '31'}
command_line:masscan -oX - 110.0.0.0 -p 1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3050,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389
['scanstats', 'command_line']
--------------------------------------------------
110.0.0.0:{'tcp': {49152: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 49153: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 49154: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 49155: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 49156: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 135: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 80: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}, 3389: {'services': [], 'state': 'open', 'reason': 'syn-ack', 'reason_ttl': '116'}}}
['110.0.0.0']
result字典有两个键,分别是masscan和scan。结构分支如下:
masscan:
1. scanstats(一些结果参数)
1. timestr(时间)
2. uphosts(存活主机数量)
3. downhosts(关闭的主机数量)
4. totalhosts(总数)
5. elapsed(不明白意思)
2. command_line(在masscan的参数指令,不重要)
scan:
1. 110.0.0.0 键就是传入的ip,他下面有多个键
1. tcp(tcp方式扫描)
1. 3389(开放端口)
1. services(服务信息)
2. state(开放情况)
3. reason(请求方式)
4. reson_ttl(返回长度)
2. 80(开放端口)
1. services(服务信息)
2. state(开放情况)
3. reason(请求方式)
4. reson_ttl(返回长度)
这就是传入一个ip,扫描全端口返回的结果,扫描一个ip段返回的数据估计也差不多….
传入一个ip,然后获取所有的开放情况代码如下:
re = result['scan'][ip]['tcp'].keys()
返回对象是一个列表
对存活的ip解析其功能,如果自定义数据指纹的话,工程量大,并且不易维护。网上刚好有个whatportis的库,可以提供端口对应的常见服务。安装方法如下:
pip install whatportis
然后会直接加入环境变量,比如cmd输入 whatportis 3389,会输出:
+---------------+------+----------+---------------+
| Name | Port | Protocol | Description |
+---------------+------+----------+---------------+
| ms-wbt-server | 3389 | tcp | MS WBT Server |
| ms-wbt-server | 3389 | udp | MS WBT Server |
+---------------+------+----------+---------------+
格式化输出依赖pretty库。然而我只想要description的信息啊,详细的api懒得看,直接输入:
>>> import whatportis
>>> print help(whatportis)
whatportis - # -*- coding: utf-8 -*-
FILE
f:\python27\lib\site-packages\whatportis\__init__.py
PACKAGE CONTENTS
__main__
core
server
FUNCTIONS
get_ports(port, like=False)
This function creates the SQL query depending on the specified port and
the --like option.
:param port: the specified port
:param like: the --like option
:return: all ports matching the given ``port``
:rtype: list
DATA
__all__ = ['get_ports']
None
原来类下面有个get_ports()方法,接受一个参数端口,返回对象是列表,如果没有匹配到端口的服务,就返回一个空的列表。所以使用方法如下:
import whatportis
d = whatportis.get_ports('102')
print d
if d != []:
print d[0][3]
关于ip匹配国家ip使用的是纯真数据库,脚本来源是python查询纯真数据库,纯真数据库脚本是在网上下的。
代码如下:
# coding:utf-8
import socket,string,struct,sys
class IPLocator :
def __init__( self, ipdbFile ):
self.ipdb = open( ipdbFile, "rb" )
str = self.ipdb.read( 8 )
(self.firstIndex,self.lastIndex) = struct.unpack('II',str)
self.indexCount = (self.lastIndex - self.firstIndex)/7+1
#print self.getVersion()," 纪录总数: %d 条 "%(self.indexCount)
def getVersion(self):
s = self.getIpAddr(0xffffff00L)
return s
def getAreaAddr(self,offset=0):
if offset :
self.ipdb.seek( offset )
str = self.ipdb.read( 1 )
(byte,) = struct.unpack('B',str)
if byte == 0x01 or byte == 0x02:
p = self.getLong3()
if p:
return self.getString( p )
else:
return ""
else:
self.ipdb.seek(-1,1)
return self.getString( offset )
def getAddr(self,offset,ip=0):
self.ipdb.seek( offset + 4)
countryAddr = ""
areaAddr = ""
str = self.ipdb.read( 1 )
(byte,) = struct.unpack('B',str)
if byte == 0x01:
countryOffset = self.getLong3()
self.ipdb.seek( countryOffset )
str = self.ipdb.read( 1 )
(b,) = struct.unpack('B',str)
if b == 0x02:
countryAddr = self.getString( self.getLong3() )
self.ipdb.seek( countryOffset + 4 )
else:
countryAddr = self.getString( countryOffset )
areaAddr = self.getAreaAddr()
elif byte == 0x02:
countryAddr = self.getString( self.getLong3() )
areaAddr = self.getAreaAddr( offset + 8 )
else:
countryAddr = self.getString( offset + 4 )
areaAddr = self.getAreaAddr()
return countryAddr + " " + areaAddr
def dump(self, first ,last ):
if last > self.indexCount :
last = self.indexCount
for index in range(first,last):
offset = self.firstIndex + index * 7
self.ipdb.seek( offset )
buf = self.ipdb.read( 7 )
(ip,of1,of2) = struct.unpack("IHB",buf)
address = self.getAddr( of1 + (of2 << 16) )
#把GBK转为utf-8
address = unicode(address,'gbk').encode("utf-8")
print "%d\t%s\t%s" %(index, self.ip2str(ip), \
address )
def setIpRange(self,index):
offset = self.firstIndex + index * 7
self.ipdb.seek( offset )
buf = self.ipdb.read( 7 )
(self.curStartIp,of1,of2) = struct.unpack("IHB",buf)
self.curEndIpOffset = of1 + (of2 << 16)
self.ipdb.seek( self.curEndIpOffset )
buf = self.ipdb.read( 4 )
(self.curEndIp,) = struct.unpack("I",buf)
def getIpAddr(self,ip):
L = 0
R = self.indexCount - 1
while L < R-1:
M = (L + R) / 2
self.setIpRange(M)
if ip == self.curStartIp:
L = M
break
if ip > self.curStartIp:
L = M
else:
R = M
self.setIpRange( L )
#version information,255.255.255.X,urgy but useful
if ip&0xffffff00L == 0xffffff00L:
self.setIpRange( R )
if self.curStartIp <= ip <= self.curEndIp:
address = self.getAddr( self.curEndIpOffset )
#把GBK转为utf-8
address = unicode(address,'gbk').encode("utf-8")
else:
address = "未找到该IP的地址"
return address
def getIpRange(self,ip):
self.getIpAddr(ip)
range = self.ip2str(self.curStartIp) + ' - ' \
+ self.ip2str(self.curEndIp)
return range
def getString(self,offset = 0):
if offset :
self.ipdb.seek( offset )
str = ""
ch = self.ipdb.read( 1 )
(byte,) = struct.unpack('B',ch)
while byte != 0:
str = str + ch
ch = self.ipdb.read( 1 )
(byte,) = struct.unpack('B',ch)
return str
def ip2str(self,ip):
return str(ip>>24)+'.'+str((ip>>16)&0xffL)+'.' \
+str((ip>>8)&0xffL)+'.'+str(ip&0xffL)
def str2ip(self,s):
(ip,) = struct.unpack('I',socket.inet_aton(s))
return ((ip>>24)&0xffL)|((ip&0xffL)<<24) \
|((ip>>8)&0xff00L)|((ip&0xff00L)<<8)
def getLong3(self,offset = 0):
if offset :
self.ipdb.seek( offset )
str = self.ipdb.read(3)
(a,b) = struct.unpack('HB',str)
return (b << 16) + a
#Demo
def main():
IPL = IPLocator( "qqwry.dat" )
ip = "118.24.11.235"
#ip = sys.argv[1]
address = IPL.getIpAddr( IPL.str2ip(ip) )
range = IPL.getIpRange( IPL.str2ip(ip) )
print "此IP %s 属于 %s\n所在网段: %s" % (ip,address, range)
if __name__ == "__main__" :
main()
在生成字典的时候,把字典的值改成自增长的列表类型。使用方法如下:
dic = {}
dic.setdefault(key,[]).append(value)
>>dic.setdefault('a',[]).append(1)
>>dic.setdefault('a',[]).append(2)
>>dic
>>{'a': [1, 2]}
摄像头与端口作用
product 摄像头
DVR
D-Link
Avtech
Netwave
GeoVision
Vivotek
Axis 207W Network Camera ftpd
product字段 路由器
DD-WRT
Cisco
Linksys
server字段 摄像头
NVR Webserver
Hikvision-Webs
SQ-WEBCAM
Avtech
IPCamera_Logo
U S Software Web Server
yawcam
Yawcam
MJPG-Streamer/0.2
go1984
UBNT Streaming Server v1.2
Pan/Tilt
BlueIris-HTTP/1.1
IP Webcam Server
i-Catcher Console
GeoHttpServer
Android Webcam Server
GoAhead-Webs
ADH-Web
VB100
Linux/2.x UPnP/1.0 Avtech/1.0
Camera Web Server
Cam
webcamXP
server字段 scada系统
Scada
scada
SCADA
0x02 这些可以直接查找准确的module名称进行匹配
工控协议
The following protocols are some of the languages that the industrial control systems use to communicate across the Internet. Many of them were developed before the Internet became widely used, which is why Internet-accessible ICS devices dont always require authentication - it isnt part of the protocol!
Modbus
Modbus协议是应用于电子控制器上的一种协议。通过此协议设备间可以通信。它已成为一通用工业标准。
Modbus is a popular protocol for industrial control systems (ICS). It provides easy, raw access to the control system without requiring any authentication.
port:502
module modbus
Siemens S7
s7协议是SIEMENS s7协议族的标准通信协议,使用s7-应用接口的通信不依赖特定的总线系统。
S7 (S7 Communication) is a Siemens proprietary protocol that runs between programmable logic controllers (PLCs) of the Siemens S7 family.
port:102
module: s7
DNP3
DNP(Distributed Network Protocol,分布式网络规约)是一种应用于自动化组件之间的通讯协议,常见于电力、水处理等行业。SCADA可> 以使用DNP协议与主站、RTU、及IED进行通讯。
DNP3 (Distributed Network Protocol) is a set of communications protocols used between components in process automation systems. Its main use is in utilities such as electric and water companies.
port:20000 source address
module: dnp3
Niagara Fox
Fox协议是Tridium公司开发的Niagara框架的一部分,广泛应用于楼宇自动化控制系统。
The Fox protocol, developed as part of the Niagara framework from Tridium, is most commonly seen in building automation systems (offices, libraries, Universities, etc.)
port:1911,4911 product:Niagara
module: fox
BACnet
楼宇自动控制网络数据通讯协议(BACnet)是针对采暖、通风、空调、制冷控制设备所设计,同时也为其他楼宇控制系统(例如照明、安保、消防等系统)的集成提供一个基本原则。
BACnet is a communications protocol for building automation and control networks. It was designed to allow communication of building automation and control systems for applications such as heating, air-conditioning, lighting, and fire detection systems.
port:47808
module: bacnet
EtherNet/IP
Ethernet/IP是一个面向工业自动化应用的工业应用层协议。它建立在标准UDP/IP与TCP/IP协议之上,利用固定的以太网硬件和软件,为配置、访问和控制工业自动化设备定义了一个应用层协议。
EtherNet/IP was introduced in 2001 and is an industrial Ethernet network solution available for manufacturing automation.
port 44818
module: ethernetip, ethernetip-udp
GE-SRTP
GE-SRTP协议由美国通用电气公司开发,GE PLC可以通过GE-SRTP进行数据通信和数据传输。
Service Request Transport Protocol (GE-SRTP) protocol is developed by GE Intelligent Platforms (earlier GE Fanuc) for transfer of data from PLCs.
port:18245,18246 product:"general electric"
module: general-electric-srtp
HART-IP
HART协议是美国Rosement公司于1985年推出的一种用于现场智能仪表和控制室设备之间的通信协议。现已成为全球智能仪表的工业标准 。
The HART Communications Protocol (Highway Addressable Remote Transducer Protocol) is an early implementation of Fieldbus, a digital industrial automation protocol. Its most notable advantage is that it can communicate over legacy wiring.
port:5094 hart-ip
module: hart-ip-udp
PCWorx
PCWorx协议由菲尼克斯电气公司开发,目前广泛使用于工控系统。PCWORX3.11是菲尼克斯电气公司的专用协议。
PCWorx is a protocol and program by Phoenix Contact used by a wide range of industries.
port:1962 PLC
module: pcworx
MELSEC-Q
MELSEC-Q系列设备使用专用的网络协议进行通讯,该系列设备可以提供高速、大容量的数据处理和机器控制。
MELSEC-Q Series use a proprietary network protocol for communication. The devices are used by equipment and manufacturing facilities to provide high-speed, large volume data processing and machine control.
port:5006,5007 product:mitsubishi
module: melsec-q-tcp
OMRON FINS
欧姆龙PLC使用网络协议FINS进行通信,可通过多种不同的物理网络,如以太网、控制器连接等。
FINS, Factory Interface Network Service, is a network protocol used by Omron PLCs, over different physical networks like Ethernet, Controller Link, DeviceNet and RS-232C.
port:9600 response code
module: omron-tcp
Crimson v3
协议被Crimson桌面软件用于与Red Lion G306工控系统的HMI人机接口。
The protocol the Crimson v3.0 desktop software uses when communicating with the Red Lion Controls G306a human machine interface (HMI).
port:789 product:"Red Lion Controls"
redlion-crimson3
Codesys
CoDeSys编程接口在全球范围内使用广泛,全球上百个设备制造商的自动化设备中都是用了该编程接口。
Over 250 device manufacturers from different industrial sectors offer automation devices with a CODESYS programming interface. Consequently, thousands of users such as machine or plant builders around the world employ CODESYS for automation tasks.
port:2455 operating system
module: codesys
IEC 60870-5-104
IEC 60870-5-104是国际电工委员会制定的一个规范,用于适应和引导电力系统调度自动化的发展,规范调度自动化及远动设备的技术性能。
IEC 60870 part 5 is one of the IEC 60870 set of standards which define systems used for SCADA in electrical engineering and power system automation applications.
port:2404 asdu address
module: iec-104
ProConOS
ProConOS是德国科维公司(KW-Software GmbH)开发的用于PLC的实时操作系统,它是一个高性能的PLC运行时引擎,目前广泛使用于基于嵌入式和PC的工控系统。
ProConOS is a high performance PLC run time engine designed for both embedded and PC based control applications.
port:20547 PLC
module: proconos
moxa-nport
Moxa 串口服务器专为工业应用而设计。不通配置组合的串口服务器更能符合不同工业现场的需求。NPort系列串口服务器让传统 RS-232/422/485设备立即联网,提供您基于IP的串口联网解决方案。
port:4800
moxa-nport
作者:creepycool
链接:https://www.jianshu.com/p/411c10a2e4e8
0.53 版本
功能更新
- 无限网址全自动化采集入库
- 对网址标题,内容,IP地址,端口开放,端口服务信息采集
- 网址CMS信息采集
- 一键提取,下载符合要求的网址与IP
- 获取网址的真实IP
- 获取网址的子域名
- 自行拓展CMS指纹库
安装环境
必备环境
- Python2
- Mysql
必备依赖
Flask==1.0.2
Flask-SQLAlchemy==2.1.0
PyMySQL==0.9.2
requests==2.18.4
beautifulsoup4==4.6.3
python-masscan==0.1.2
whatportis==0.6
gunicorn==19.9.0
下载文件后再安装依赖文件夹中有这些文件,Windows下直接在cmd下输入 pip install -r requirement.txt 即可。linux用户输入 sudo pip install -r requirement.txt 即可。如果不行的话使用pip一个一个的下载即可。
WINDOWS 64位
安装 依赖文件夹 中的WinPcap_4_1_2.exe。
WINDOWS 32位
自行安装masscan,并添加到系统环境变量中
Linux 用户
在命令行下输入
sudo apt-get install masscan
安装好masscan即可。
配置说明
在/app/web/config.py文件中,进行数据库设置
# 这些都是数据库信息
HOST = '127.0.0.1'
# 数据库名字,如果修改数据库名字会创建新的数据库,注意不要重复
DATABASE = 'langzi_eyeeeee'
USER = 'root'
PASSWORD = 'root'
PORT = 3306
DRIVER = 'pymysql'
# 线程数设置
THREADS = 10
# 这两个是登陆网页的账号密码
login_uesr = 'admin'
login_pass = 'admin'
确保环境都安装好后,在主目录命令行下输入 Python run.py(linux用户需要加上sudo)
文件作用说明
│
│
│
│
├─app # 主目录
│ │
│ │ qqwry.dat # 纯真IP数据库
│ │ run.py # 主程序
│ │
│ ├─data # 缓存数据文件
│ │ 18-10-29-21-35-52ip.txt
│ │ 18-10-29-21-35-52url.txt
│ │ 18-10-29-21-35-58ip.txt
│ │ 18-10-29-21-35-58url.txt
│ │ 18-10-29-21-36-09ip.txt
│ │ 18-10-29-21-36-09url.txt
│ │ 18-10-29-21-43-40ip.txt
│ │ 18-10-29-21-43-40url.txt
│ │
│ └─web # 运行主目录
│ │ cms_db.py # cms 指纹库
│ │
│ │ config.py # 配置文件
│ │
│ │ crawl.py # 主要逻辑文件,包括信息采集入库
│ │
│ │ database.py # 数据库模型
│ │
│ │ get_info.py # 主要处理函数,提供一系列可调用功能
│ │
│ │ runmain.py # 主要视图函数
│ │
│ │ __init__.py # 初始化文件
│ │
│ │
│ ├─masscan # windows 64位 masscan
│ │ masscan
│ │ masscan.exe
│ │
│ ├─static # 静态文件夹
│ │ │ login.html
│ │ │
│ │ ├─css
│ │ │ bootstrap-theme.css
│ │ │ bootstrap-theme.css.map
│ │ │ bootstrap-theme.min.css
│ │ │ bootstrap-theme.min.css.map
│ │ │ bootstrap.css
│ │ │ bootstrap.css.map
│ │ │ bootstrap.min.css
│ │ │ bootstrap.min.css.map
│ │ │ main.css
│ │ │
│ │ ├─fonts
│ │ │ glyphicons-halflings-regular.eot
│ │ │ glyphicons-halflings-regular.svg
│ │ │ glyphicons-halflings-regular.ttf
│ │ │ glyphicons-halflings-regular.woff
│ │ │ glyphicons-halflings-regular.woff2
│ │ │
│ │ ├─image
│ │ │ test.jpg
│ │ │
│ │ └─js
│ │ bootstrap.js
│ │ bootstrap.min.js
│ │ jquery.js
│ │ npm.js
│ │
│ └─templates # 网页模板
│ 404.html
│ cms_map.html
│ index.html
│ infos.html
│ ip_map.html
│ layout.html
│ login.html
│ result.html
│ search.html
│ subdomain.html
│ urls.html
│
└─安装依赖 # 安装依赖说明
requirement.txt
WinPcap_4_1_2.exe
使用方法.txt
功能展示
主页面还是一如既往的简谱啊
登陆界面提供一些扫描采集结果
在右边的搜索框中提供了更多搜索数据类型,比如在网址栏中输入edu.cn,则会从数据库中提取出网址带有edu.cn的所有网址的信息。
可以看到有直接提取网址,ip,和直接下载网址,ip的功能。
回到主页面,点击 CMS MAP则会跳转到CMS采集结果主页面,因为代码刚刚初次运行,所以才采集到两条CMS。
如果点击右边cms的名字时候,则会跳转到该cms类型详情页面,同样提供一键提取与下载功能。
回到IP MAP页面,则会展示一些数据结果。
左边的是端口开放情况,中间的是端口运行的服务和数量,右边的提供两个数据库,功能分别是获取网址的真实IP和查询网址的子域名。
查询真实IP的原理是,扫描一个IP上面所有开放的端口后,尝试使用http协议访问该端口,如果返回结果正常的话,或者该页面的标题和网页内容,保存到数据库,
当查询网址的时候,把查询网址的网页内容和标题带入数据库查询,然后返回ip地址。
当然 IP MAP 和 CMS MAP的所有功能都可以在主页的搜索框中直接搜索得到返回结果。
部署
个人电脑
安装好依赖后,运行 python run.py即可,随后访问
http://127.0.0.1:5000
如果你在服务器上面运行这样的话,同样是可以访问到的,但是安全性不保证。
服务器
方法来源于T00LS的Alkaid大佬在【记一次搭建flask靶场遇到的各种问题以及解决方案】一文中提出的部署方法。
按照下面的步骤一步一步来实现
- pip install gunicorn
- 启动 gunicon,在app目录下命令行:gunicorn -w 3 -b 127.0.0.1:5000 run:app
- 安装Nginx
- 开启Nginx
- 修改Nginx配置文件,将default修改为
如下:
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
随后访问公网即可访问到本地的5000端口flask服务。
长期持续获取网址信息
保持运行run.py文件即可,原理是通过循环调用网址数据采集信息,外链不断重复采集。