Git Product home page Git Product logo

fofa-go's Introduction

FOFA Pro SDK 使用说明文档

FOFA Pro API

FOFA Pro API 是资产搜索引擎 FOFA Pro 为开发者提供的 RESTful API 接口, 允许开发者在自己的项目中集成 FOFA Pro 的功能。

FOFA SDK

基于 FOFA Pro API 编写的 golangSDK, 方便 golang 开发者快速将 FOFA Pro 集成到自己的项目中。

环境

开发环境

$ go version
go version go1.7.3 darwin/amd64

测试环境

$ go version
go version go1.7.3 darwin/amd64

使用环境

建议在 go version > 1.7.2 && (Windows >= XP || OS X >= 10.8 || Linux >= 2.6.23) && 64-bit processor 使用 FOFA SDK

获取

govendor

安装 FOFA SDK 之前,请先确认已经安装 govendor.

$ go get -u -v github.com/kardianos/govendor

点击 GOVENDOR FAQ 了解更详细的使用说明

FOFA SDK

下载 FOFA SDK

$ go get github.com/fofapro/fofa-go

安装

$ govendor install +local

如果是 *nix 或者 mac 可以使用

$ make
$ make install

文档

$ godoc -http=:6060 -index

或者

$ make doc

测试

$ govendor test  ./fofa

如果是 *nix 或者 mac 可以使用

$ make test

依赖

Email & API Key

Email 用户登陆 FOFA Pro 使用的 Email
Key 前往 个人中心 查看 API Key
如果开发者经常使用固定的账号,建议将emailkey添加到环境变量中
echo "export [email protected]" >> ~/.zshrc
echo "export FOFA_KEY=32charsMD5String" >> ~/.zshrc

SDK 提供的示例代码就是使用的这种形式。

Example

func FofaExample() {
	email := os.Getenv("FOFA_EMAIL")
	key := os.Getenv("FOFA_KEY")

	clt := fofa.NewFofaClient([]byte(email), []byte(key))
	if clt == nil {
		fmt.Printf("create fofa client\n")
		return
	}
	result, err := clt.QueryAsJSON(1, []byte(`body="小米"`))
	if err != nil {
		fmt.Printf("%v\n", err.Error())
	}
	fmt.Printf("%s\n", result)
	arr, err := clt.QueryAsArray(1, []byte(`domain="haosec.cn"`), []byte("domain"))
	if err != nil {
		fmt.Printf("%v\n", err.Error())
	}
	fmt.Printf("count: %d\n", len(arr))
	encodeArr, _ := json.Marshal(arr)
	fmt.Printf("\n%s\n", encodeArr)
}

FOFA Tool

使用FOFA SDK 开发的控制台程序,无序登陆即可进行FOFA查询.
在同时满足安装FOFA SDK$GOPATH/bin包含在$PATH环境变量时,可以直接运行.

USAGE

$ fofa-go

    Fofa is a tool for discovering assets.

    Usage:

            fofa option argument ...

    The commands are:

            email           the email which you login to fofa.so
                            Use FOFA_EMAIL env by default.

            key             the md5 string which you can find on userinfo page
                            Use FOFA_KEY env by default.

            fields          fields which you want to select
                            Use host,ip,port as default.

            query           query statement which is similar to the statement used in the fofa.so

            format          output format
                            Json(json) as default, alternatively you can select array(array).

            page            page number you want to query, 1000 records per page
                            If page is not set or page is less than 1, page will be set to 1.

            out             output file path
                            Use fofa_${timestamp} as default.

协议

FOFA SDK 遵循 MIT 协议 https://opensource.org/licenses/mit

fofa-go's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.