蜜罐

开源蜜罐的一些学习资料

现代密网(MHN)

MHN是一个开源软件,它简化了蜜罐的部署,同时便于收集和统计蜜罐的数据。用ThreatStream(http://threatstream.github.io/mhn/ )来部署,MHN使用开源蜜罐来收集数据,整理后保存在Mongodb中,收集到的信息也可以通过web接口来展示或者通过开发的API访问。

MHN能够提供多种开源的蜜罐,可以通过web接口来添加他们。一个蜜罐的部署过程很简单,只需要粘贴,复制一些命令就可以完成部署,部署完成后,可以通过开源的协议hpfeeds来收集的信息。

MHN支持以下蜜罐:

1
2
3
4
5
6
7
8
9
10
1.Sort:https://www.snort.org/
2.Suricata:http://suricata-ids.org/
3.Dionaea:http://dionaea.carnivore.it/,它是一个低交互式的蜜罐,能够模拟MSSQL, SIP, HTTP, FTP, TFTP等服务
4.Conpot:http://conpot.org/
5.Kippo:https://github.com/desaster/kippo ssh蜜罐
6.Amun:http://amunhoney.sourceforge.net/ 它是一个低交互式蜜罐,但是已经从2012年之后不在维护了。
7.Glastopf:http://glastopf.org/ web蜜罐
8.Wordpot:https://github.com/gbrindisi/wordpot wordpress蜜罐
9.ShockPot:https://github.com/threatstream/shockpot,模拟的CVE-2014-6271,即破壳漏洞
10.p0f:https://github.com/p0f/p0f

opencanary_web

github: https://github.com/p1r06u3/opencanary_web

架构: Tornado+Vue+Mysql+APScheduler+Nginx+Supervisor

opencanary_web 添加dionaea支持(可以监听全端口)

安装dionaea : https://github.com/DinoTools/dionaea.git
文档: https://dionaea.readthedocs.io/en/latest/index.html

配置使用sqlite存储connections:

1
cp /opt/dionaea/etc/dionaea/ihandlers-available/log_sqlite.yaml /opt/dionaea/etc/dionaea/ihandlers-enabled/

dionaea.sqlite

1
2
3
表名connections
字段
[(0, u'connection', u'INTEGER', 0, None, 1), (1, u'connection_type', u'TEXT', 0, None, 0), (2, u'connection_transport', u'TEXT', 0, None, 0), (3, u'connection_protocol', u'TEXT', 0, None, 0), (4, u'connection_timestamp', u'INTEGER', 0, None, 0), (5, u'connection_root', u'INTEGER', 0, None, 0), (6, u'connection_parent', u'INTEGER', 0, None, 0), (7, u'local_host', u'TEXT', 0, None, 0), (8, u'local_port', u'INTEGER', 0, None, 0), (9, u'remote_host',)]

获取sqlite数据并发送到opencanary_web 的 log 接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#coding: utf-8

import json
import requests
import sqlite3
from datetime import datetime
import time

m = 3 # 三分钟内的记录
conn = sqlite3.connect('dionaea.sqlite')
cursor = conn.execute("select * from connections where connection_timestamp > " + str( time.time() - 60 * m) )
#cursor = conn.execute("PRAGMA table_info('connections')")
#print(cursor.fetchall())

headers = {
"Content-Type" : "application/json",
}

url = "http://{opencanary_web_host}/log" #opencanary_web 服务端地址

post_dict = {
"logdata": {},
"logtype": 5001, #攻击类型,可以自己去opencanary_web 服务器修改配置,这里取的syn扫描
"node_id": "dionaea",
}
for at in cursor:
local_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(at[4]))
post_dict.update({
'dst_host' : at[7],
'dst_port' : at[8],
'src_host' : at[9],
'src_port' : at[11],
'local_time' : local_time
})
#print(post_dict)
post_json = json.dumps(post_dict)
res = requests.post(url=url,data=post_json,headers=headers)
if res.status_code == 200 :
print("---report success---")
print(res.text)

在crontab 定时执行
```
*/3 * * * * cd /opt/dionaea/var/log/dionaea/ && /usr/bin/python send_dionaea.py >> report.log

安全建设