diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51cc5f4..b9ea594 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: uses: goreleaser/goreleaser-action@v2 if: success() && startsWith(github.ref, 'refs/tags/') with: - version: latest + version: 1.7.0 args: release --rm-dist -f scripts/gorelease.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 4220032..5067419 100644 --- a/README.md +++ b/README.md @@ -49,23 +49,20 @@ fofax 2021/12/23 21:21:28 [SUCC] create config file /Users/user/.config/fofax/fofax.yaml. please modify and use ``` -接下来就是对此配置文件进行配置了,一般来说只需要配置完 `email` 和 `key` 就可以了。 +接下来就是对此配置文件进行配置了,一般来说只需要配置完 `key` 就可以了。 ```console vim ~/.config/fofax/fofax.yaml ``` ```console -# fofa api email -fofa-email: ******@gmail.com - # fofa api key fofakey: *************** ``` - +**注意:** email 字段已经被弃用 (2023年12月21日) ### Windows -解压压缩包,第一次运行 fofax.exe 会在同级目录下生成一个 fofax.yaml 的配置文件。然后打开此配置文件,并填写 `email` 和 `key`。 +解压压缩包,第一次运行 fofax.exe 会在同级目录下生成一个 fofax.yaml 的配置文件。然后打开此配置文件,并填写 `key` 字段。 ## 0x03 使用方法 @@ -285,7 +282,7 @@ http://usa.baidu.com [Baidu USA] echo 'app="APACHE-Solr"' | fofax -fs 5 -ffi -debug 2021/12/25 21:28:57 [DEBUG] FoFa Size : 5 2021/12/25 21:28:57 [DEBUG] FoFa Query of: app="APACHE-Solr" -2021/12/25 21:28:57 [DEBUG] https://fofa.so/api/v1/search/all?email=**********@gmail.com&key=**************************&qbase64=YXBwPSJBUEFDSEUtU29sciI=&size=5&page=1&fields=protocol,ip,port,host +2021/12/25 21:28:57 [DEBUG] https://fofa.so/api/v1/search/all?key=**************************&qbase64=YXBwPSJBUEFDSEUtU29sciI=&size=5&page=1&fields=protocol,ip,port,host 2021/12/25 21:28:57 [DEBUG] Resp Time: 432/millis 2021/12/25 21:28:57 [SUCC] Fetch Data From FoFa: [5/30942] http://35.183.115.103 diff --git a/internal/cli/parser.go b/internal/cli/parser.go index 77af1a6..71d0ff1 100644 --- a/internal/cli/parser.go +++ b/internal/cli/parser.go @@ -95,8 +95,8 @@ type config struct { // fofa 地址 FoFaURL string FoFaOpenURL string - // FoFaEmail string - FoFaKey string + FoFaEmail string + FoFaKey string // 脱敏密码 FoFaKeyFake string Proxy string @@ -127,7 +127,7 @@ var ( func initOptions() { rand.Seed(time.Now().UnixNano()) args = new(Options) - // args.FoFaEmail = os.Getenv("FOFA_EMAIL") + args.FoFaEmail = os.Getenv("FOFA_EMAIL") args.FoFaKey = utils.HiddenUrlKey(false, os.Getenv("FOFA_KEY")) args.FoFaKeyFake = os.Getenv("FOFA_KEY") args.FoFaURL = "https://fofa.info" @@ -145,7 +145,7 @@ func init() { flags.StringVar(&args.ConfigFile, "config", args.ConfigFile, "fofax configuration file.The file reading order("+strings.Join(utils.ConfDefaultPath, ",")+")") createGroup( flags, "config", "CONFIGS", - // flags.StringVarP(&args.FoFaEmail, "fofa-email", "email", args.FoFaEmail, "Fofa API Email"), + flags.StringVarP(&args.FoFaEmail, "fofa-email", "email", args.FoFaEmail, "Fofa API Email(the field has already been deprecated.)"), flags.StringVarP(&args.FoFaKey, "fofakey", "key", args.FoFaKey, "Fofa API Key"), flags.StringVarP(&args.Proxy, "proxy", "p", "", "proxy for http like http://127.0.0.1:8080"), flags.StringVar(&args.FoFaURL, "fofa-url", args.FoFaURL, "Fofa api url"), @@ -398,6 +398,9 @@ func checkMutFlags() error { // 检查 key func checkFoFaInfo() { + if args.FoFaEmail != "" { + printer.Infof("The FOFA email field has already been deprecated") + } if args.FoFaKey == "" { printer.Error("FoFaKey is empty") os.Exit(1) diff --git a/internal/fofa/fofa_api.go b/internal/fofa/fofa_api.go index 1907c6c..a184230 100644 --- a/internal/fofa/fofa_api.go +++ b/internal/fofa/fofa_api.go @@ -74,9 +74,15 @@ func (f *FoFa) fetchByFields(fields string, queryStr string) bool { if f.option.OldData { isOptionsArgs += "&full=true" } + auth := fmt.Sprintf("key=%s", f.option.FoFaKey) + + if f.option.FoFaEmail != "" { + auth = fmt.Sprintf("email=%s&key=%s", f.option.FoFaEmail, f.option.FoFaKey) + } + uri := fmt.Sprintf( - "/api/v1/search/all?key=%s%s&qbase64=%s&size=%d&page=%d&fields=%s", - f.option.FoFaKey, isOptionsArgs, + "/api/v1/search/all?%s%s&qbase64=%s&size=%d&page=%d&fields=%s", + auth, isOptionsArgs, base64.StdEncoding.EncodeToString([]byte(queryStr)), perPage, f.page,