mirror of
https://gitee.com/lauix/HFish
synced 2025-05-11 04:18:02 +08:00
2. ~ 日记格式完善 3. ~ 暗网钓鱼支持 4. ~ UI 优化 5. ~ 支持分页 6. ~ 筛选 7. ~ 提供黑名单IP接口 8. ~ 邮件发送支持编辑器 9. ~ 支持 ip 地理信息
48 lines
1.6 KiB
Go
48 lines
1.6 KiB
Go
package report
|
|
|
|
import (
|
|
"HFish/core/dbUtil"
|
|
"time"
|
|
"HFish/utils/ip"
|
|
)
|
|
|
|
// 上报 WEB
|
|
func ReportWeb(projectName string, ipx string, info string) {
|
|
ipInfo := ip.Get(ipx)
|
|
sql := `INSERT INTO hfish_info(type,project_name,ip,ip_info,info,create_time) values(?,?,?,?,?,?);`
|
|
dbUtil.Insert(sql, "WEB", projectName, ipx, ipInfo, info, time.Now().Format("2006-01-02 15:04:05"))
|
|
}
|
|
|
|
// 上报 SSH
|
|
func ReportSSH(ipx string, info string) {
|
|
ipInfo := ip.Get(ipx)
|
|
sql := `INSERT INTO hfish_info(type,project_name,ip,ip_info,info,create_time) values(?,?,?,?,?,?);`
|
|
dbUtil.Insert(sql, "SSH", "SSH钓鱼", ipx, ipInfo, info, time.Now().Format("2006-01-02 15:04:05"))
|
|
}
|
|
|
|
// 上报 Redis
|
|
func ReportRedis(ipx string, info string) int64 {
|
|
ipInfo := ip.Get(ipx)
|
|
sql := `INSERT INTO hfish_info(type,project_name,ip,ip_info,info,create_time) values(?,?,?,?,?,?);`
|
|
return dbUtil.Insert(sql, "REDIS", "Redis钓鱼", ipx, ipInfo, info, time.Now().Format("2006-01-02 15:04:05"))
|
|
}
|
|
|
|
// 更新 Redis 操作
|
|
func ReportUpdateRedis(id int64, info string) {
|
|
sql := `UPDATE hfish_info SET info = info||? WHERE id = ?;`
|
|
dbUtil.Update(sql, info, id)
|
|
}
|
|
|
|
// 上报 Mysql
|
|
func ReportMysql(ipx string, info string) int64 {
|
|
ipInfo := ip.Get(ipx)
|
|
sql := `INSERT INTO hfish_info(type,project_name,ip,ip_info,info,create_time) values(?,?,?,?,?,?);`
|
|
return dbUtil.Insert(sql, "MYSQL", "Mysql钓鱼", ipx, ipInfo, info, time.Now().Format("2006-01-02 15:04:05"))
|
|
}
|
|
|
|
// 更新 Redis 操作
|
|
func ReportUpdateMysql(id int64, info string) {
|
|
sql := `UPDATE hfish_info SET info = info||? WHERE id = ?;`
|
|
dbUtil.Update(sql, info, id)
|
|
}
|