HFish/utils/file/file.go
SanJin b97dae897a ~ 上钩列表分页优化
~ 上钩列表支持批量删除
~ 上钩列表长度展示
~ 上钩列表支持集群筛选
~ 集群页面支持删除
~ 改用 IPIP 本地库获取地理信息
~ 支持 WebHook Api 通知
~ 提供获取上钩列表 API
~ WEB,暗网蜜罐 API 移到各种服务上,抛开 Admin
~ 修复暗网蜜罐使用问题
~ 修复集群取 IP 错误问题
~ SSH 高交互支持
2019-08-25 01:00:42 +08:00

37 lines
698 B
Go

package file
import (
"HFish/error"
"fmt"
"os"
"io/ioutil"
"HFish/utils/log"
)
func Output(result string, path string) {
if path != "" {
_, err := os.Stat(path)
if os.IsNotExist(err) {
os.Mkdir("./scripts", os.ModePerm)
}
f_create, _ := os.Create(path)
f_create.Close()
f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0666)
error.Check(err, "fail to open file")
f.Write([]byte(result))
f.Close()
} else {
fmt.Println(result)
}
}
func ReadLibsText(typex string, name string) string {
text, err := ioutil.ReadFile("./libs/" + typex + "/" + name + ".hf")
if err != nil {
log.Pr("HFish", "127.0.0.1", "读取文件失败", err)
}
return string(text[:])
}