{"id":19755727,"url":"https://github.com/fofapro/fofa-go","last_synced_at":"2025-04-30T11:33:06.134Z","repository":{"id":57487993,"uuid":"73275995","full_name":"fofapro/fofa-go","owner":"fofapro","description":"fofa pro的sdk，go语言版本","archived":false,"fork":false,"pushed_at":"2020-03-17T09:52:00.000Z","size":36,"stargazers_count":39,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T01:31:56.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fofapro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-09T10:56:36.000Z","updated_at":"2025-02-17T07:16:20.000Z","dependencies_parsed_at":"2022-08-29T11:22:07.284Z","dependency_job_id":null,"html_url":"https://github.com/fofapro/fofa-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fofapro%2Ffofa-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fofapro%2Ffofa-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fofapro%2Ffofa-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fofapro%2Ffofa-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fofapro","download_url":"https://codeload.github.com/fofapro/fofa-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251691522,"owners_count":21628335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T03:12:55.248Z","updated_at":"2025-04-30T11:33:05.764Z","avatar_url":"https://github.com/fofapro.png","language":"Go","funding_links":[],"categories":["Go Search Automation Tools"],"sub_categories":[],"readme":"# FOFA Pro SDK 使用说明文档\n## FOFA Pro API   \n\u003ca href=\"https://fofa.so/api\"\u003e\u003cfont face=\"menlo\"\u003e`FOFA Pro API`\u003c/font\u003e\u003c/a\u003e 是资产搜索引擎 \u003ca href=\"https://fofa.so/\"\u003e`FOFA Pro`\u003c/a\u003e 为开发者提供的 `RESTful API` 接口, 允许开发者在自己的项目中集成 `FOFA Pro` 的功能。    \n\n\n## FOFA SDK\n基于 `FOFA Pro API` 编写的 `golang` 版 `SDK`, 方便 `golang` 开发者快速将 `FOFA Pro` 集成到自己的项目中。\n\n\n## 环境\n### 开发环境\n``` zsh\n$ go version\ngo version go1.7.3 darwin/amd64\n```\n### 测试环境\n``` zsh\n$ go version\ngo version go1.7.3 darwin/amd64\n```\n### 使用环境\n建议在 `go version \u003e 1.7.2 \u0026\u0026 (Windows \u003e= XP || OS X \u003e= 10.8 || Linux \u003e= 2.6.23) \u0026\u0026 64-bit processor` 使用 `FOFA SDK`\n\n## 获取\n### `govendor`\n安装 `FOFA SDK` 之前，请先确认已经安装 \u003ca href=\"https://github.com/kardianos/govendor/\"\u003e\u003cfont face=\"menlo\"\u003egovendor\u003c/font\u003e\u003c/a\u003e.   \n``` zsh\n$ go get -u -v github.com/kardianos/govendor\n```\n`点击`  \u003ca href=\"https://github.com/kardianos/govendor/blob/master/doc/faq.md\"\u003e\u003cfont face=\"menlo\"\u003eGOVENDOR FAQ\u003c/font\u003e\u003c/a\u003e `了解更详细的使用说明`      \n\n\n### FOFA SDK\n\u003cstrong\u003e下载 `FOFA SDK` \u003c/strong\u003e   \n``` zsh\n$ go get github.com/fofapro/fofa-go\n```   \n\u003cstrong\u003e安装\u003c/strong\u003e  \n``` zsh\n$ govendor install +local\n```\n\u003ci\u003e如果是 `*nix` 或者 `mac` 可以使用\u003c/i\u003e   \n``` zsh\n$ make\n$ make install\n```\n\u003cstrong\u003e文档\u003c/strong\u003e \n``` zsh\n$ godoc -http=:6060 -index\n```\n`或者`\n``` zsh\n$ make doc\n```\n\u003cstrong\u003e测试\u003c/strong\u003e   \n``` zsh\n$ govendor test  ./fofa\n```\n\u003ci\u003e如果是 `*nix` 或者 `mac` 可以使用\u003c/i\u003e   \n``` zsh\n$ make test\n```\n## 依赖\n### Email \u0026 API Key   \n| `Email` |用户登陆 `FOFA Pro` 使用的 `Email`|\n|---------|:-----------------:|\n|`Key`| 前往 \u003ca href=\"https://fofa.so/my/users/info\" style=\"color:#0000ff\"\u003e\u003cstrong\u003e`个人中心`\u003c/strong\u003e\u003c/a\u003e 查看 `API Key` |\n如果开发者经常使用固定的账号，建议将`email`与`key`添加到环境变量中   \n``` zsh\necho \"export FOFA_EMAIL=example@fofa.so\" \u003e\u003e ~/.zshrc\necho \"export FOFA_KEY=32charsMD5String\" \u003e\u003e ~/.zshrc\n```\n`SDK` 提供的示例代码就是使用的这种形式。\n\n\n## Example   \n``` go\nfunc FofaExample() {\n\temail := os.Getenv(\"FOFA_EMAIL\")\n\tkey := os.Getenv(\"FOFA_KEY\")\n\n\tclt := fofa.NewFofaClient([]byte(email), []byte(key))\n\tif clt == nil {\n\t\tfmt.Printf(\"create fofa client\\n\")\n\t\treturn\n\t}\n\tresult, err := clt.QueryAsJSON(1, []byte(`body=\"小米\"`))\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err.Error())\n\t}\n\tfmt.Printf(\"%s\\n\", result)\n\tarr, err := clt.QueryAsArray(1, []byte(`domain=\"haosec.cn\"`), []byte(\"domain\"))\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err.Error())\n\t}\n\tfmt.Printf(\"count: %d\\n\", len(arr))\n\tencodeArr, _ := json.Marshal(arr)\n\tfmt.Printf(\"\\n%s\\n\", encodeArr)\n}\n```\n\n## FOFA Tool   \n使用`FOFA SDK` 开发的控制台程序,无序登陆即可进行`FOFA`查询.    \n在同时满足安装`FOFA SDK`与`$GOPATH/bin`包含在`$PATH`环境变量时，可以直接运行.\n### USAGE   \n``` zsh\n$ fofa-go\n\n    Fofa is a tool for discovering assets.\n\n    Usage:\n\n            fofa option argument ...\n\n    The commands are:\n\n            email           the email which you login to fofa.so\n                            Use FOFA_EMAIL env by default.\n\n            key             the md5 string which you can find on userinfo page\n                            Use FOFA_KEY env by default.\n\n            fields          fields which you want to select\n                            Use host,ip,port as default.\n\n            query           query statement which is similar to the statement used in the fofa.so\n\n            format          output format\n                            Json(json) as default, alternatively you can select array(array).\n\n            page            page number you want to query, 1000 records per page\n                            If page is not set or page is less than 1, page will be set to 1.\n\n            out             output file path\n                            Use fofa_${timestamp} as default.\n```\n\n## 协议\n`FOFA SDK` 遵循 `MIT` 协议 \u003ca href=\"https://opensource.org/licenses/mit\"\u003e\u003cfont face=\"menlo\"\u003ehttps://opensource.org/licenses/mit\u003c/font\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffofapro%2Ffofa-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffofapro%2Ffofa-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffofapro%2Ffofa-go/lists"}