Skip to content

Commit

Permalink
HFish 0.3 完毕,上线!
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjinhub committed Aug 26, 2019
1 parent 5575dfb commit bb7be75
Show file tree
Hide file tree
Showing 22 changed files with 146 additions and 320 deletions.
90 changes: 62 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![dashboard.png](./images/dashboard.png)
![hfish.png](./images/hfish.png)

# 介绍

Expand All @@ -12,6 +12,11 @@

# 地址

## HFish 官方

- 官网: https://hfish.io
- 使用文档: https://hfish.io/docs

## Github

- Git: https://github.com/hacklcx/HFish
Expand All @@ -22,6 +27,7 @@
- Git: https://gitee.com/lauix/HFish
- Download: https://gitee.com/lauix/HFish/releases


# 快速部署

## 部署说明
Expand All @@ -31,16 +37,6 @@
- 执行 ./HFish run 启动服务
- 浏览器输入 http://localhost:9001 打开

## 集群部署

- 复制 HFish、config.ini、web(不启动WEB蜜罐可以不复制) 目录文件到服务器上
- 修改 config.ini -> rpc -> status 为 2
- 修改 config.ini -> rpc -> addr 地址为 HFish 服务端地址

## Docker

- HFish 镜像: https://hub.docker.com/r/imdevops/hfish (详细见 Docker Hub 文档)

## 命令行帮助

![help.png](./images/help.png)
Expand All @@ -55,6 +51,10 @@

![login.png](./images/login.png)

## 仪表盘

![dashboard.png](./images/dashboard.png)

## 上钩页

![fish.png](./images/fish.png)
Expand All @@ -67,6 +67,10 @@

![mail.png](./images/mail.png)

## 设置页

![mail.png](./images/setting.png)

# 部分功能使用演示

## WEB 蜜罐
Expand All @@ -93,6 +97,11 @@

![telnet.png](./images/telnet.png)

## MemCache 蜜罐

![telnet.png](./images/memcache.png)


# 注意事项

- 邮箱 SMTP 配置后需要开启方可使用
Expand All @@ -101,14 +110,13 @@
- WEB 插件 需在 WEB 目录下 编写
- WEB 插件 下面必须存在两个目录
- 集群 心跳为60秒,断开显示会延迟60秒
- 暗网蜜罐是支持的,但是目前Tor服务网上找不到,无法提供演示

# API 接口

## WEB 蜜罐

```
URL: http://localhost:9001/api/v1/post/report
URL: http://WEB蜜罐地址/api/v1/post/report
POST:
Expand All @@ -125,7 +133,7 @@ POST:
## 暗网 蜜罐

```
URL: http://localhost:9001/api/v1/post/deep_report
URL: http://暗网蜜罐地址/api/v1/post/deep_report
POST:
Expand All @@ -149,26 +157,52 @@ URL(Get): http://localhost:9001/api/v1/get/ip
提供此接口为了配合防火墙使用,具体方案欢迎来讨论!
```

## 获取全部钓鱼信息

```
URL(Get): http://localhost:9001/api/v1/get/fish_info
返回数据格式:
{
code: 200,
data: [
{
agent: "本机",
city: "",
country: "本机地址",
create_time: "2019-08-26 21:29:00",
id: 224,
info: "127.0.0.1:51548 已经连接&&stats&&&&set foo 0 6",
ip: "127.0.0.1",
project_name: "MemCache蜜罐",
region: "本机地址",
type: "MEMCACHE"
},
],
msg: "success"
}
字段说明:
agent : 集群名称
country : 国家
region : 省份/地区
city : 城市
ip : IP 地址
project_name : 项目名称
type : 蜜罐类型
info : 上钩信息
id : 数据库唯一标识
create_time : 上钩时间
```

# TODO

- [x] 登录模块
- [x] 仪表盘模块
- [x] 上钩列表
- [x] 邮件群发
- [x] 命令行优化
- [x] 支持自定义 WEB 模板
- [x] 支持 Mysql 服务端获取连接客户端电脑任意文件
- [x] 支持 HTTP(S)、SSH、SFTP、Redis、Mysql、FTP、Telnet、暗网 蜜罐
- [x] 日记完善优化
- [x] 支持分布式架构
- [x] 支持分页
- [x] 支持 ip 地理信息
- [x] 提供黑名单IP接口
- [ ] 支持 SMTP、POP3、TFTP、Oracle、VPN 等
- [ ] WIFI 蜜罐支持
- [ ] 自动化蜜罐支持
- [ ] 蜜罐报告生成
- [ ] 邮件发送支持编辑器
- [ ] 支持邮件模板选择
- [ ] 蜜罐高交互完善
- [ ] 支持 Ngrok 一键映射
Expand Down
2 changes: 1 addition & 1 deletion admin/colony.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h4 class="page-title">分布式集群</h4>
}

if (_h == "") {
_h = '<tr style="text-align: center;"><td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="9">暂无数据</td></tr>'
_h = '<tr style="text-align: center;"><td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="11">暂无数据</td></tr>'
}

$("#tableList").html(_h);
Expand Down
2 changes: 1 addition & 1 deletion admin/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<div class="row">
<div class="col-sm-12">
<div class="btn-group pull-right m-t-15">
<a type="button" class="btn btn-custom" href="https://github.com/hacklcx/HFish/blob/master/README.md"
<a type="button" class="btn btn-custom" href="https://hfish.io/docs"
target="_blank">查看帮助 <span class="m-l-5"><i
class="zmdi zmdi-help-outline"></i></span>
</a>
Expand Down
8 changes: 7 additions & 1 deletion admin/fish.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
background-color: #3d9671;
}

.lb_plug {
background-color: #61772d;
}

.pre {
background: #2c2c31;
color: #4fe21b;
Expand Down Expand Up @@ -364,6 +368,8 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
_h += ' <span class="label lb_deep">DEEP</span> ';
} else if (data[i].type == "MEMCACHE") {
_h += ' <span class="label lb_mem_cache">MEMCACHE</span> ';
} else if (data[i].type == "PLUG") {
_h += ' <span class="label lb_plug">PLUG</span> ';
}

_h += ' <span class="project">' + data[i].project_name + '</span>';
Expand All @@ -388,7 +394,7 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
}

if (_h == "") {
_h = '<tr style="text-align: center;"><td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="5">暂无数据</td></tr>'
_h = '<tr style="text-align: center;"><td style="line-height: 200px;font-size: 20px;color: #a9a9a9;" colspan="8">暂无数据</td></tr>'
}

$("#tableList").html(_h);
Expand Down
2 changes: 1 addition & 1 deletion admin/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="container">
<div class="row">
<div class="col-xs-12">
Copyright 2019 © <a href="https://github.com/hacklcx/HFish" target="_blank">HFish</a> - <a
Copyright 2019 © <a href="https://hfish.io" target="_blank">HFish</a> - <a
href="https://hack.lc"
target="_blank">HackLC</a>
</div>
Expand Down
18 changes: 9 additions & 9 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,51 @@ account = admin # 登录账号
password = admin # 登录密码

[api]
status = 0 # 是否启动 API 0 关闭 1 启动
status = 1 # 是否启动 API 0 关闭 1 启动
web_url = /api/v1/post/report # WEB蜜罐上报 API
deep_url = /api/v1/post/deep_report # 暗网蜜罐上报 API
plug_url = /api/v1/post/plug_report # 插件蜜罐上报 API
sec_key = 9cbf8a4dcb8e30682b927f352d6559a0 # API 认证秘钥

[plug]
status = 0 # 是否启动 蜜罐插件 0 关闭 1 启动, 需要先启动 API
status = 1 # 是否启动 蜜罐插件 0 关闭 1 启动, 需要先启动 API
addr = 0.0.0.0:8989 # 蜜罐插件 启动地址

[web]
status = 0 # 是否启动 WEB 1 启动 0 关闭, 启动 API 后 WEB 方可上报结果
status = 1 # 是否启动 WEB 1 启动 0 关闭, 启动 API 后 WEB 方可上报结果
addr = 0.0.0.0:9000 # WEB 启动地址,0.0.0.0 对外开放,127.0.0.1 对内开放 可走 Nginx 反向代理
template = wordPress/html # WEB 模板路径
index = index.html # WEB 首页文件
static = wordPress/static # WEB 静态文件路径 注意:必须存在两个目录,html 文件 和静态文件 不能平级
url = / # WEB 访问目录,默认 / 可更改成 index.html index.asp index.php

[deep]
status = 0 # 是否启动 暗网 1 启动 0 关闭, 启动 API 后 方可上报结果
status = 1 # 是否启动 暗网 1 启动 0 关闭, 启动 API 后 方可上报结果
addr = 0.0.0.0:8080 # 暗网 WEB 启动地址
template = deep/html # 暗网 WEB 模板路径
index = index.html # 暗网 WEB 首页文件
static = deep/static # 暗网 WEB 静态文件路径 注意:必须存在两个目录,html 文件 和静态文件 不能平级
url = / # 暗网 WEB 访问目录,默认 / 可更改成 index.html index.asp index.php

[ssh]
status = 0 # 是否启动 SSH 0 关闭 1 低交互 2 高交互
status = 2 # 是否启动 SSH 0 关闭 1 低交互 2 高交互
addr = 0.0.0.0:22 # SSH 服务端地址 注意端口冲突,请先关闭服务器 openssh 服务 或 修改端口

[redis]
status = 0 # 是否启动 Redis 0 关闭 1 启动
status = 1 # 是否启动 Redis 0 关闭 1 启动
addr = 0.0.0.0:6379 # Redis 服务端地址 注意端口冲突

[mysql]
status = 0 # 是否启动 Mysql 0 关闭 1 启动
status = 1 # 是否启动 Mysql 0 关闭 1 启动
addr = 0.0.0.0:3306 # Mysql 服务端地址 注意端口冲突
files = /etc/passwd,/etc/group # Mysql 服务端读取客户端任意文件; 多写逗号分隔,会随机取

[telnet]
status = 0 # 是否启动 Telnet 0 关闭 1 启动
status = 1 # 是否启动 Telnet 0 关闭 1 启动
addr = 0.0.0.0:23 # Telnet 服务端地址 注意端口冲突

[ftp]
status = 0 # 是否启动 Ftp 0 关闭 1 启动
status = 1 # 是否启动 Ftp 0 关闭 1 启动
addr = 0.0.0.0:21 # Ftp 服务端地址 注意端口冲突

[mem_cache]
Expand Down
38 changes: 21 additions & 17 deletions core/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,36 @@ func alert(id string, model string, typex string, projectName string, agent stri
if status == "1" {
info := isAlertStatus[0]["info"]

fishInfo := HFishInfo{
id,
model,
"",
"",
"",
"",
"",
"",
"",
"",
"",
}
song := make(map[string]interface{})
song["id"] = id
song["model"] = model
song["project"] = projectName
song["type"] = typex
song["agent"] = agent
song["ip"] = ipx
song["country"] = country
song["region"] = region
song["city"] = city
song["info"] = infox
song["time"] = time

bytesData, _ := json.Marshal(song)

reader := bytes.NewReader(bytesData)

b, _ := json.Marshal(fishInfo)
body := bytes.NewBuffer(b)
request, _ := http.NewRequest("POST", info.(string), reader)
request.Header.Set("Content-Type", "application/json;charset=UTF-8")

resp, err := http.Post(info.(string), "application/json;charset=utf-8", body)
client := http.Client{}
_, err := client.Do(request)

if err != nil {
log.Pr("HFish", "127.0.0.1", "WebHook 调用失败", err)
} else {
log.Pr("HFish", "127.0.0.1", "WebHook 调用成功")
}

defer resp.Body.Close()
defer request.Body.Close()
}
}).Catch(func() {
})
Expand Down
Binary file modified db/hfish.db
Binary file not shown.
Binary file modified images/colony.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hfish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/mail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/memcache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ssh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bb7be75

Please sign in to comment.