mirror of
https://gitee.com/lauix/HFish
synced 2025-05-10 20:08:12 +08:00
commit
65f1b104a2
@ -384,9 +384,13 @@
|
||||
_h += ' <td class="td"><span class="ipinfo">本机地址</span></td>';
|
||||
} else if (data.result[i].country == "局域网") {
|
||||
_h += ' <td class="td"><span class="ipinfo">局域网</span></td>';
|
||||
}
|
||||
else {
|
||||
_h += ' <td class="td"><span class="ipinfo">' + data.result[i].country + ' ' + data.result[i].region + ' ' + data.result[i].city + '</span></td>';
|
||||
} else {
|
||||
if (data.result[i].country == "中国") {
|
||||
_h += ' <td class="td"><span class="ipinfo">' + data.result[i].country + ' ' + data.result[i].region + ' ' + data.result[i].city + '</span></td>';
|
||||
} else {
|
||||
// 国外IP只能拿到国家
|
||||
_h += ' <td class="td"><span class="ipinfo">' + data.result[i].country + '</span></td>';
|
||||
}
|
||||
}
|
||||
|
||||
_h += ' <td><span class="info" onclick="show(' + data.result[i].id + ')">点击查看</span></td>';
|
||||
|
@ -25,6 +25,12 @@
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="home-2">
|
||||
<div class="timeline-2">
|
||||
<div class="time-item">
|
||||
<div class="item-info">
|
||||
<small class="text-muted">2019-09-16</small>
|
||||
<p>发布 v0.3.2 版本</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="time-item">
|
||||
<div class="item-info">
|
||||
<small class="text-muted">2019-09-09</small>
|
||||
|
@ -5,8 +5,8 @@ name = Server # 状态1 服务端 名称 状
|
||||
|
||||
[admin] # RPC 状态为2 集群客户端的时候 admin 可以删掉
|
||||
addr = 0.0.0.0:9001 # 管理后台启动地址
|
||||
account = admin # 登录账号
|
||||
password = admin # 登录密码
|
||||
account = admin # 登录账号,不能带 #
|
||||
password = admin # 登录密码,不能带 #
|
||||
db_type = sqlite # sqlite or mysql
|
||||
db_max_open = 50 # 最大连接池,0 表示无限制
|
||||
db_max_idle = 50 # 最大空闲数,0 表示无限制
|
||||
|
@ -13,10 +13,9 @@ import (
|
||||
"HFish/view/data"
|
||||
"github.com/gin-gonic/gin"
|
||||
"HFish/error"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func AlertMail(model string, typex string, agent string, ipx string, country string, region string, city string, infox string, wg *sync.WaitGroup) {
|
||||
func AlertMail(model string, typex string, agent string, ipx string, country string, region string, city string, infox string) {
|
||||
// 判断邮件通知
|
||||
try.Try(func() {
|
||||
// 只有新加入才会发送邮件通知
|
||||
@ -56,14 +55,11 @@ func AlertMail(model string, typex string, agent string, ipx string, country str
|
||||
send.SendMail(config[4:], "[HFish]提醒你,"+typex+"有鱼上钩!", text, config)
|
||||
}
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}).Catch(func() {
|
||||
wg.Done()
|
||||
})
|
||||
}
|
||||
|
||||
func AlertWebHook(id string, model string, typex string, projectName string, agent string, ipx string, country string, region string, city string, infox string, time string, wg *sync.WaitGroup) {
|
||||
func AlertWebHook(id string, model string, typex string, projectName string, agent string, ipx string, country string, region string, city string, infox string, time string) {
|
||||
// 判断 WebHook 通知
|
||||
try.Try(func() {
|
||||
result, err := dbUtil.DB().Table("hfish_setting").Fields("status", "info").Where("type", "=", "webHook").First()
|
||||
@ -110,10 +106,7 @@ func AlertWebHook(id string, model string, typex string, projectName string, age
|
||||
defer resp.Body.Close()
|
||||
//defer request.Body.Close()
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}).Catch(func() {
|
||||
wg.Done()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@ import (
|
||||
"HFish/core/report"
|
||||
"HFish/utils/is"
|
||||
"HFish/core/rpc/client"
|
||||
"sync"
|
||||
"github.com/panjf2000/ants"
|
||||
"HFish/core/pool"
|
||||
)
|
||||
|
||||
@ -332,19 +330,10 @@ func (cmd commandPass) RequireAuth() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 加入线程池
|
||||
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
poolX *ants.Pool
|
||||
)
|
||||
|
||||
func init() {
|
||||
wg, poolX = pool.New(10)
|
||||
defer poolX.Release()
|
||||
}
|
||||
|
||||
func (cmd commandPass) Execute(conn *ftpConn, param string) {
|
||||
wg, poolX := pool.New(10)
|
||||
defer poolX.Release()
|
||||
|
||||
wg.Add(1)
|
||||
poolX.Submit(func() {
|
||||
|
||||
|
@ -11,8 +11,6 @@ import (
|
||||
"HFish/core/alert"
|
||||
"HFish/utils/conf"
|
||||
"HFish/core/pool"
|
||||
"sync"
|
||||
"github.com/panjf2000/ants"
|
||||
)
|
||||
|
||||
type HFishInfo struct {
|
||||
@ -29,37 +27,16 @@ type HFishInfo struct {
|
||||
time string
|
||||
}
|
||||
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
poolX *ants.Pool
|
||||
|
||||
wgUpdate sync.WaitGroup
|
||||
poolUpdateX *ants.Pool
|
||||
)
|
||||
|
||||
func init() {
|
||||
wg, poolX = pool.New(10)
|
||||
defer poolX.Release()
|
||||
|
||||
wgUpdate, poolUpdateX = pool.New(10)
|
||||
defer poolUpdateX.Release()
|
||||
}
|
||||
|
||||
// 通知模块
|
||||
func alertx(id string, model string, typex string, projectName string, agent string, ipx string, country string, region string, city string, infox string, timex string) {
|
||||
wg.Add(1)
|
||||
poolX.Submit(func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
// 邮件通知
|
||||
alert.AlertMail(model, typex, agent, ipx, country, region, city, infox)
|
||||
|
||||
// 邮件通知
|
||||
alert.AlertMail(model, typex, agent, ipx, country, region, city, infox, &wg)
|
||||
// WebHook
|
||||
alert.AlertWebHook(id, model, typex, projectName, agent, ipx, country, region, city, infox, timex)
|
||||
|
||||
// WebHook
|
||||
alert.AlertWebHook(id, model, typex, projectName, agent, ipx, country, region, city, infox, timex, &wg)
|
||||
|
||||
// 大数据展示
|
||||
//alert.AlertDataWs(model, typex, projectName, agent, ipx, country, region, city, time)
|
||||
})
|
||||
// 大数据展示
|
||||
//alert.AlertDataWs(model, typex, projectName, agent, ipx, country, region, city, time)
|
||||
}
|
||||
|
||||
// 上报 集群 状态
|
||||
@ -159,8 +136,6 @@ func insertInfo(typex string, projectName string, agent string, ipx string, coun
|
||||
|
||||
// 更新
|
||||
func updateInfoCore(id string, info string) {
|
||||
time.Sleep(time.Second * 2)
|
||||
|
||||
try.Try(func() {
|
||||
var sql string
|
||||
|
||||
@ -188,18 +163,21 @@ func updateInfoCore(id string, info string) {
|
||||
if err != nil {
|
||||
log.Pr("HFish", "127.0.0.1", "更新上钩信息失败", err)
|
||||
}
|
||||
|
||||
wgUpdate.Done()
|
||||
}).Catch(func() {
|
||||
wgUpdate.Done()
|
||||
})
|
||||
}
|
||||
|
||||
// 通用的更新
|
||||
func updateInfo(id string, info string) {
|
||||
wgUpdate, poolUpdateX := pool.New(10)
|
||||
|
||||
defer poolUpdateX.Release()
|
||||
|
||||
wgUpdate.Add(1)
|
||||
poolUpdateX.Submit(func() {
|
||||
updateInfoCore(id, info)
|
||||
time.Sleep(time.Second * 2)
|
||||
go updateInfoCore(id, info)
|
||||
wgUpdate.Done()
|
||||
})
|
||||
}
|
||||
|
||||
@ -253,12 +231,6 @@ func ReportSSH(ipx string, agent string, info string) int64 {
|
||||
|
||||
// 更新 SSH 操作
|
||||
func ReportUpdateSSH(id string, info string) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Pr("HFish", "127.0.0.1", "执行SSH更新失败", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if (id != "0") {
|
||||
go updateInfo(id, info)
|
||||
go alertx(id, "update", "SSH", "SSH蜜罐", "", "", "", "", "", info, time.Now().Format("2006-01-02 15:04:05"))
|
||||
|
BIN
db/hfish.db
BIN
db/hfish.db
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
[HFish] ::1 - [2019-09-15 20:35:25] "POST /login HTTP/1.1 200 169.667µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:25 | 200 | 404.526µs | ::1 | POST /login
|
||||
[HFish] ::1 - [2019-09-15 20:35:28] "POST /login HTTP/1.1 200 133.633µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:28 | 200 | 209.568µs | ::1 | POST /login
|
||||
[HFish] ::1 - [2019-09-15 20:35:28] "GET /dashboard HTTP/1.1 200 4.270281ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:28 | 200 | 4.306622ms | ::1 | GET /dashboard
|
||||
[HFish] ::1 - [2019-09-15 20:35:28] "GET /static/css/style.css HTTP/1.1 304 283.146µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:28 | 304 | 369.83µs | ::1 | GET /static/css/style.css
|
||||
[HFish] ::1 - [2019-09-15 20:35:28] "GET /get/dashboard/data HTTP/1.1 200 1.417361ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:28 | 200 | 1.46201ms | ::1 | GET /get/dashboard/data
|
||||
[HFish] ::1 - [2019-09-15 20:35:28] "GET /get/dashboard/pie_data HTTP/1.1 200 636.382µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" "
|
||||
[GIN] 2019/09/15 - 20:35:28 | 200 | 667.996µs | ::1 | GET /get/dashboard/pie_data
|
2
main.go
2
main.go
@ -16,7 +16,7 @@ func main() {
|
||||
} else if args[1] == "init" || args[1] == "--init" {
|
||||
setting.Init()
|
||||
} else if args[1] == "version" || args[1] == "--version" {
|
||||
fmt.Println("v0.3.1")
|
||||
fmt.Println("v0.3.2")
|
||||
} else if args[1] == "run" || args[1] == "--run" {
|
||||
setting.Run()
|
||||
} else {
|
||||
|
@ -1,13 +1,4 @@
|
||||
@charset "UTF-8";
|
||||
@import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700,300");
|
||||
/*!
|
||||
* Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com)
|
||||
* Copyright 2011-2015 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
@import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700,300");
|
||||
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
|
||||
@import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700,300");
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
|
@ -335,7 +335,7 @@ func Help() {
|
||||
{K || __ _______ __
|
||||
| PP / // / __(_)__ / /
|
||||
| || / _ / _// (_-</ _ \
|
||||
(__\\ /_//_/_/ /_/___/_//_/ v0.3.1
|
||||
(__\\ /_//_/_/ /_/___/_//_/ v0.3.2
|
||||
`
|
||||
fmt.Println(color.Yellow(logo))
|
||||
fmt.Println(color.White(" A Safe and Active Attack Honeypot Fishing Framework System for Enterprises."))
|
||||
|
Loading…
Reference in New Issue
Block a user