什么是蜜罐:蜜罐技术本质上时一种对攻击方进行欺骗的技术,通过布置一些作为诱饵的主机。
cowrie是什么:它是一款中度交互的SSH与Telnet蜜罐,它可以获取攻击者用于暴力破解的字典,输入的命令以及上传或下载的恶意问题。
搭建cowrie
useradd cowrie
passwd cowrie
yum install -y git python-virtualenv bzip2-devel libffi-devel vim net-tools mysql-devel
yum groupinstall "Development Tools"
git clone https://github.com/cowrie/cowrie.git
virtualenv -p python2.7 cowrie-env
source cowrie-env/bin/activate
pip install six packaging appdirs
pip install -r requirements.txt
修改配置文件
cp cowrie.cfg.dist cowrie.cfg
配置本机防火墙:
firewall-cmd --permanent --add-port=222/tcp
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --zone=public --add-forward-port=port=22:proto=tcp:toport=2222 --permanent
firewall-cmd --permanent --list-all
firewall-cmd --reload
systemctl restart sshd
安装mysql数据库用于记录攻击者的信息
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload
创建数据库并导入数据结构
create database cowrie;
grant all on cowrie.* to cowrie@localhost identified by 'hist0ry';
pip install mysql-python
cd /opt/cowrie/docs/sql/
#登陆数据库,并导入该目录下的mysql.sql文件
mysql -ucowrie -p hist0ry
use cowrie
source mysql.sql
导入数据库后,重新修改配置文件。
vim ./etc/cowrie.cfg
修改配置文件中的下面的配置:
[output_mysql]
enabled = true
host = localhost
database = cowrie
username = cowrie
password = cowrie
port = 3306
最后以普通用户来启动蜜罐
su cowrie
./bin/cowrie start
通过蜜罐查看攻击者的行为
通过查看cowrie数据库来进行
如爆破的信息:select * from auth;
elastichoney蜜罐搭建:
首先,需要搭建go语言的环境:
其次,安装:
go get github.com/fw42/go-hpfeeds
git clone https://github.com/jordan-wright/elastichoney.git
在配置完后,接下来就是修改配置文件config.json的最后一行
"public_ip_url":"http://queryip.net/ip"
为
"public_ip_url":"https://ifconfig.io/ip"
编译代码:
go build -o elastichoney
./elastichoney -config="config.json" -log="logs/elastichoney.log" -verbose=true