Skip to content

Commit

Permalink
the field has already been deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Becivells committed Dec 21, 2023
1 parent f99fa8e commit 9aeac6e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 使用方法

Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions internal/cli/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ type config struct {
// fofa 地址
FoFaURL string
FoFaOpenURL string
// FoFaEmail string
FoFaKey string
FoFaEmail string
FoFaKey string
// 脱敏密码
FoFaKeyFake string
Proxy string
Expand Down Expand Up @@ -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"
Expand All @@ -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"),
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions internal/fofa/fofa_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9aeac6e

Please sign in to comment.