{"id":13841895,"url":"https://github.com/LubyRuffy/gofofa","last_synced_at":"2025-07-11T13:33:03.411Z","repository":{"id":37386445,"uuid":"492444137","full_name":"LubyRuffy/gofofa","owner":"LubyRuffy","description":"fofa client in Go","archived":false,"fork":false,"pushed_at":"2024-04-09T07:21:59.000Z","size":1121,"stargazers_count":39,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-05T17:29:42.736Z","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/LubyRuffy.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-15T09:40:00.000Z","updated_at":"2024-07-17T14:00:20.000Z","dependencies_parsed_at":"2024-06-19T00:15:02.873Z","dependency_job_id":"5105adbd-4a5b-46ce-9eab-04cdfe3ce4f4","html_url":"https://github.com/LubyRuffy/gofofa","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LubyRuffy%2Fgofofa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LubyRuffy%2Fgofofa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LubyRuffy%2Fgofofa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LubyRuffy%2Fgofofa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LubyRuffy","download_url":"https://codeload.github.com/LubyRuffy/gofofa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225729742,"owners_count":17515158,"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-08-04T17:01:23.656Z","updated_at":"2025-07-11T13:33:03.399Z","avatar_url":"https://github.com/LubyRuffy.png","language":"Go","funding_links":[],"categories":["Useful FOFA API Tool","Go"],"sub_categories":[],"readme":"# gofofa\n\nfofa client in Go\n\n[![Test status](https://github.com/lubyruffy/gofofa/workflows/Go/badge.svg)](https://github.com/lubyruffy/gofofa/actions?query=workflow%3A%22Go%22)\n[![codecov](https://codecov.io/gh/lubyruffy/gofofa/branch/main/graph/badge.svg)](https://codecov.io/gh/lubyruffy/gofofa)\n[![License: MIT](https://img.shields.io/github/license/lubyruffy/gofofa)](https://github.com/LubyRuffy/gofofa/blob/main/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/lubyruffy/gofofa)](https://goreportcard.com/report/github.com/lubyruffy/gofofa)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3eadab4e412e4c3494bbc5f188d441e8)](https://www.codacy.com/gh/LubyRuffy/gofofa/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=LubyRuffy/gofofa\u0026utm_campaign=Badge_Grade)\n[![Github Release](https://img.shields.io/github/release/lubyruffy/gofofa/all.svg)](https://github.com/lubyruffy/gofofa/releases)\n[![Go Reference](https://pkg.go.dev/badge/github.com/LubyRuffy/gofofa.svg)](https://pkg.go.dev/github.com/LubyRuffy/gofofa)\n\n## Background\n\nThe official library doesn't has unittests,  之前官方的库功能不全，代码质量差，完全没有社区活跃度，不符合开源项目的基本要求。因此，想就fofa的客户端作为练手，解决上述问题。\n\n## Usage\n\n### Build and run\n\n```\n~ go install github.com/LubyRuffy/gofofa/cmd/fofa@latest\n~ fofa\n~ FOFA_CLIENT_URL='https://fofa.info/?email=xxx@gmail.com\u0026key=xxx' fofa search port=80\n```\n\n### Search\n\n-   search query, only query needed:\n\n```shell\n./fofa search port=80\n./fofa search 'port=80 \u0026\u0026 protocol=ftp'\n```\n\n-   search short, default subcommand is search:\n\n```shell\n./fofa domain=qq.com\n```\n\n-   custom fields, default 'ip,port':\n\n```shell\n./fofa search --fields host,ip,port,protocol,lastupdatetime 'port=6379'\n./fofa search -f host,ip,port,protocol,lastupdatetime 'port=6379'\n```\n\n-   custom size, default 100:\n\n```shell\n./fofa search --size 10 'port=6379'\n./fofa search -s 10 'port=6379'\n```\n\nif size is larger than your account free limit, you can set `-deductMode` to decide whether deduct fcoin automatically or not\n\n-   custom out format, default csv:\n    can be csv/json/xml, line by line\n\n```shell\n./fofa search --format=json 'port=6379'\n./fofa search --format json 'port=6379'\n```\n\n-   write to file, default stdout:\n\n```shell\n./fofa search --outFile a.txt 'port=6379'\n./fofa search -o a.txt 'port=6379'\n```\n\n-   fix host to url:\n\n```shell\n./fofa --size 2 --fields \"host\" title=Gitblit\n47.92.145.232:8998\nhttps://114.55.35.145:8443\n./fofa --size 2 --fields \"host\" --fixUrl title=Gitblit\nhttp://47.92.145.232:8998\nhttps://114.55.35.145:8443\n./fofa --size 2 --fields \"host\" --fixUrl title=Gitblit\n```\nuse another url prefix:\n```shell\n./fofa --size 1 --fields \"host\" --fixUrl --urlPrefix \"redis://\" protocol=redis\nredis://152.136.145.87:6379\n```\n\n-   verbose mode\n\n```shell\n./fofa --verbose search port=80\n```\n\n-   pipeline to nuclei\n\n```shell\n./fofa -fields \"host\" -fixUrl 'app=\"Aspera-Faspex\"' | nuclei -t http/cves/2022/CVE-2022-47986.yaml\n```\n\n-   uniq by ip\n\n```shell\n./fofa --fixUrl --size 1000 --fields host --uniqByIP 'host=\"edu.cn\"'\n```\n\n-   pipeline with parallel mode\n\n```shell\nfofa -f ip \"is_ipv6=false \u0026\u0026 port=22\" | fofa -f ip -uniqByIP -template \"port=8443 \u0026\u0026 ip={}\" \n```\ncan use `-rate 3` to increase rate limit, default is 2\n\n### Stats\n\n-   stats subcommand\n\n```shell\n./fofa stats --fields title,country title=\"hacked by\"\n```\n![fofa stats](./data/fofa_stats.png)\n\n-   cert.sn with detail\n\n```shell\n./fofa stats -f cert.sn 'domain=fofa.info'\n```\n\nresponse like below:\n\n```text\n===  cert.sn\n2685875099059809389019875560888281013   assets(16)      ip(12)\n        valid:  true\n        expired:  false\n        not_before:  2024-08-19 00:00:00\n        organization:  \n        root_domains:  fofa.info\n106776008363609665167674504083577007174 assets(1)       ip(1)\n        valid:  true\n        expired:  false\n        not_before:  2025-02-11 05:53:12\n        organization:  \n        root_domains:  fofa.info\n18188111735873196410686859430087482807  assets(1)       ip(1)\n        valid:  true\n        expired:  true\n        not_before:  2023-11-29 00:00:00\n        organization:  Sina.com Technology(China)Co.,ltd\n        root_domains:  sina.com.cn,weibo.com,sina.net,t.cn,weipan.cn,sina.com,sinaimg.cn,sina.cn,sinajs.cn,weibo.cn\n231526393573365645767615725694212547312 assets(1)       ip(1)\n        valid:  true\n        expired:  false\n        not_before:  2025-02-11 05:57:42\n        organization:  \n        root_domains:  fofa.info\n330239683942509455538597560579056264013 assets(1)       ip(1)\n        valid:  true\n        expired:  false\n        not_before:  2024-04-01 00:00:00\n        organization:  \n        root_domains:  fofa.vip\n```\n\n### Icon\n\n-   icon subcommand\n\nsearch icon at fofa:\n\n```shell\n./fofa icon --open ./data/favicon.ico\n./fofa icon --open https://fofa.info/favicon.ico\n./fofa icon --open http://www.baidu.com\n```\n\ncalc local file icon hash:\n\n```shell\n./fofa icon ./data/favicon.ico\n```\n\ncalc remote icon hash:\n\n```shell\n./fofa icon https://fofa.info/favicon.ico\n```\n\ncalc remote homepage icon hash:\n\n```shell\n./fofa icon http://www.baidu.com\n```\n\n### Host\n\n-   host subcommand\n\n```shell\n./fofa host demo.cpanel.net\nHost:            demo.cpanel.net\nIP:              208.74.120.133\nASN:             33522\nORG:             CPANEL-INC\nCountry:         United States of America\nCountryCode:     US\nPorts:           [2078 3306 2079 2082 143 993 2086 2095 2083 2087 110 2080 80 995 2096 2077 443]\nProtocols:       imaps,mysql,https,imap,pop3s,http,pop3\nCategories:      Server Management\nProducts:        cPanel-MGMT-Products\nUpdateTime:      2022-05-30 17:00:00\n```\n\n### Dump\n\n-   dump large-scale data\n\n```shell\n./fofa dump --format json -fixUrl -outFile a.json -batchSize 10000 'title=phpinfo'\n```\n\n-   dump large-scale data by queries file (line by line)\n\n```shell\n\ncat queries.txt\nport=13344\nport=23455\n\n# csv\n./fofa dump -outFile out.csv -inFile queries.txt\n\n# json\n./fofa dump -inFile queries.txt -outFile out.json -j\n2023/08/09 10:05:33 dump data of query: port=13344\n2023/08/09 10:05:35 size: 11/11, 100.00%\n2023/08/09 10:05:35 dump data of query: port=23455\n2023/08/09 10:05:37 size: 499/499, 100.00%\n```\n\n### Domains\n\n-   domain subcommand 主要用于最简单的拓线\n\nadd domains mode to extend domains from domain, through certs\n```shell\nfofa domains -s 1000 -withCount baidu.com\nbaidu.com       660\ndwz.cn  620\ndlnel.com       614\nbcehost.com     614\nbdstatic.com    614\n......\n......\n```\n\nwithCount mean with domain count value, you can also use `-uniqByIP` to uniq by ip:\n```shell\nfofa domains -s 1000 -withCount -uniqByIP baidu.com \nbaidu.com       448\ndwz.cn  410\naipage.cn       406\n\n```\n\n### Utils\n\n-   random subcommand\n\nrandom generate date from fofa, line by line\n```shell\n./fofa random\n./fofa random -f host,ip,port,lastupdatetime,title,header,body --format json\n```\n\nevery 500ms generate one line, never stop\n\n```shell\n./fofa random -s -1 -sleep 500\n```\n\n-   count subcommand\n\n```shell\n./fofa count port=80\n```\n\n-   account subcommand\n\n```shell\n./fofa account\n```\n\n-   version\n\n```shell\n./fofa --version\n```\n\n## Features\n\n-   ☑ Cross-platform\n    -   ☑ Windows\n    -   ☑ Linux\n    -   ☑ Mac\n-   ☑ Code coverage \u003e 90%\n-   ☑ As SDK\n    -   ☑ Client: NewClient\n        -   ☑ HostSearch\n        -   ☑ HostSize\n        -   ☑ AccountInfo\n        -   ☑ IconHash\n        -   ☑ support cancel through SetContext\n-   ☑ As Client\n    -   ☑ Sub Commands\n        -   ☑ account\n        -   ☑ search\n            -   ☑ query\n            -   ☑ fields/f\n            -   ☑ size/s\n            - group/g 根据字段聚合：group by ip 根据ip合并，比如查询一个app会有很多域名，其中多个域名对应一个ip，这时只测试其中一个就好了\n            -   ☑ fixUrl build valid url，默认的字段如果是http的话前面没有http://前缀，导致命令行一些工具不能使用，通过这个参数进行修复\n              -   ☑ can use with urlPrefix, such as use `app://` instead of `http://`\n              -   ☑ support socks5\n              -   ☑ support redis\n            -   ☑ full 匹配所有，而不只是一年内的\n            -   ☑ format\n                -   ☑ csv\n                -   ☑ json\n                -   ☑ xml\n                -   ☐ table\n                -   ☐ excel\n            -   ☑ outFile/o\n        -   ☑ stats\n        -   ☑ icon\n        -   ☐ web\n        -   ☑ dump https://en.fofa.info/api/batches_pages large-scale data retrieval\n        -   ☑ domains\n    -   ☑ Terminal color \n    -   ☑ Global Config\n        -   ☑ fofaURL\n        -   ☑ deductMode\n    -   ☑ Envirement\n        -   ☑ FOFA_CLIENT_URL format: \u003curl\u003e/?email=\\\u003cemail\\\u003e\u0026key=\\\u003ckey\\\u003e\u0026version=\\\u003cv1\\\u003e\n        -   ☑ FOFA_SERVER\n        -   ☑ FOFA_EMAIL\n        -   ☑ FOFA_KEY\n-   ☐ Publish\n    -   ☑ github\n    -   ☐ brew\n    -   ☐ apt\n    -   ☐ yum\n\n\n## Scenes\n\n### How to dump all domains that cert is valid and contains google?\n\n```shell\n./fofa stats -f domain -s 100 'cert.is_valid=true \u0026\u0026 (cert=\"google\")'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLubyRuffy%2Fgofofa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLubyRuffy%2Fgofofa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLubyRuffy%2Fgofofa/lists"}