Skip to content

Commit

Permalink
修复fofa新版本发布后无法使用 fofa 币 获取超过 1w 条数据的问题。增加 -coin 参数强制用户注意扣币操作
Browse files Browse the repository at this point in the history
  • Loading branch information
Becivells committed Mar 10, 2022
1 parent 54a38b4 commit 7af8c38
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var (
FoFaXVersion = "0.1.37"
FoFaXVersion = "0.1.38"
Commit = "unknown"
Date = "2022-01-01T01:01:01Z"
Branch = "unknown"
Expand Down
2 changes: 2 additions & 0 deletions internal/cli/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type config struct {
ShowPrivacy bool
ConfigFile string
Update bool
Coin bool
DisableUpdate bool
}
type fxconfig struct {
Expand Down Expand Up @@ -150,6 +151,7 @@ func init() {
flags.StringVar(&args.FoFaURL, "fofa-url", args.FoFaURL, "Fofa api url"),
flags.StringVar(&args.FoFaOpenURL, "fofa-open-url", args.FoFaOpenURL, "The fofa url used by the browser to open"),
flags.IntVarP(&args.ReqIntervalTime, "request-interval-time", "rit", 500, "Request interval time unit/Millisecond"),
flags.BoolVar(&args.Coin, "coin", args.Coin, "Get over 10,000 data with fofa coins"),
flags.BoolVar(&args.Debug, "debug", false, "Debug mode"),
flags.BoolVarP(&args.ShowPrivacy, "show-privacy", "sp", false, "Debug mode Show Privacy"),
flags.BoolVarP(&args.Update, "update", "u", false, "Update fofax"),
Expand Down
26 changes: 15 additions & 11 deletions internal/fofa/fofa_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,30 @@ func (f *FoFa) fetchByFields(fields string, queryStr string) bool {
printer.Successf("Fetch Data From FoFa: [%d/%d]", len(apiResult.Results), apiResult.Size)

for _, result := range apiResult.Results {
//if len(result[0]) == 0 || result[0] == ":0" {
// printer.Debug("There is no HostInfo!")
// continue
// // https://fofa.so/api/v1/search/[email protected]&key=xxx&qbase64=YXBwPSJIaWt2aXNpb24tQ2FtZXJhcy1hbmQtU3VydmVpbGxhbmNlIiAmJiBwcm90b2NvbCE9cnN0cA==&size=100&page=1&fields=host
//}

if !f.FetchFn(result, int32(apiResult.Size)) {
return true
}
maxSize--
if maxSize == 0 {
return true
}
//maxSize--
//if maxSize == 0 {
// return true
//}
}

// 没有数据,退出
if len(apiResult.Results) == 0 || len(apiResult.Results) < perPage {
if len(apiResult.Results) == 0 || maxSize < perPage {
return true
}
maxSize -= perPage
if maxSize <= 0 {
return true
}
f.page++
if !f.option.Coin {
printer.Infof("Use fofa coins to get more than 10,000 data please use -coin to confirm")
return true
}
printer.Infof("The fofa coin will be deducted !!!")
time.Sleep(time.Duration(f.option.ReqIntervalTime) * time.Millisecond)
}
}

Expand Down

0 comments on commit 7af8c38

Please sign in to comment.