Documentation ¶
Overview ¶
client package provided a fofa api call
Index ¶
- Constants
- func GetApiUrl(path string) (reqUrl url.URL)
- type CodeResponse
- type ErrorMsg
- type Exploit
- type ExploitResponse
- type Message
- type PublishResponse
- type RuleInfoResponse
- type Search
- type SearchResponse
- type SearchRuleResponse
- type User
- func (u *User) AddQuery(query url.Values) (value url.Values)
- func (u *User) GetMessages() (messages []Message, err error)
- func (u *User) GetPoc() (exploits ExploitResponse, err error)
- func (u *User) GetPocCode(filename string) (code string, err error)
- func (u *User) GetRuleInfo(name string) (rule RuleInfoResponse, err error)
- func (u *User) GetShopPoc(page int) (exploits []Exploit, err error)
- func (u *User) GetShopPocNum() (num int, err error)
- func (u *User) Me() (err error)
- func (u *User) PublishPoc(exp Exploit, code []byte) (err error)
- func (u *User) Req(reqUrl url.URL) (data []byte, err error)
- func (u *User) ReqHtml(reqUrl url.URL) (doc *goquery.Document, err error)
- func (u *User) Search(query string, fields string, page int, limit int) (searchs SearchResponse, err error)
- func (u *User) SearchRule(key string) (resp SearchRuleResponse, err error)
- type UserInfo
Examples ¶
Constants ¶
View Source
const ( // review failure FAIL = "failed" // review pending PEND = "pending" // review ok PUBLISH = "publish" // you purchas poc PURCHAS = "purchased" )
poc status
View Source
const ( CliVersion = "4.10.2" FofaServer = "fofa.so" ApiMy = "/api/v1/info/my" ApiExploitList = "/api/v1/user/exploits" ApiMessage = "/messages" ApiSearchRule = "/api/v1/exploit/rule_list" ApiRuleInfo = "/api/v1/exploit/rule_info" ApiShop = "/exploits/shop" ApiShopSum = "/exploits/all_exploits_count" ApiSearch = "/api/v1/search/all" ApiCode = "/api/v1/exploit/code" ApiPublish = "/api/v1/exploit/publish" )
View Source
const ( // Member search Free quota MemberLimit = 100 // 1 Foin = 10000 FcoinToSearch = 10000 // Vip search Free quota VipLimit = 10000 )
fofa search limit
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CodeResponse ¶
CodeResponse is install poc code request response
type ErrorMsg ¶
type ErrorMsg struct { // is error? Error bool `json:"error"` // error msg Errmsg string `json:"errmsg"` }
error info
func NewErrorMsg ¶
type Exploit ¶
type Exploit struct { // author name Author string `json:"author"` // poc descript Description string `json:"description"` // poc filename Filename string `json:"filename"` // fofa query rule Fofaquery string `json:"fofaquery"` // exploir level Level int `json:"level"` // poc name Name string `json:"name"` // exploit product Product string `json:"product"` // product url Homapage string `json:"homapage"` // is zero day? IsZeroDay bool // poc update time UpdateAt string `json:"update_at"` // poc status Status string }
fofa poc file
type ExploitResponse ¶
type ExploitResponse struct { ErrorMsg Failed []Exploit `json:"failed"` Pending []Exploit `json:"pending"` Published []Exploit `json:"published"` Purchased []Exploit `json:"purchased"` }
ExploitResponse get expoloit list response
type PublishResponse ¶
type PublishResponse struct {
ErrorMsg
}
type RuleInfoResponse ¶
type RuleInfoResponse struct { ErrorMsg // 查询规则细节 Rule string `json:"rule"` // 规则名 Url string `json:"url"` }
rule info result
type SearchResponse ¶
type SearchResponse struct { ErrorMsg // search mode Mode string `json:"mode"` // query keyword Query string `json:"query"` // query page num Page int `json:"page"` // query total num Size int `json:"size"` // query result Results []Search `json:"results"` }
fofa search result
type SearchRuleResponse ¶
search rule result
type User ¶
type User struct { // account email Email string `json:"email"` // account api token Token string `json:"token, omitempty"` Client *http.Client UserInfo }
Fofa User
func NewUser ¶
NewUser Get an a instance from email and token
Example ¶
fakeEmail := "fake" fakeToken := "fake" _ = NewUser(fakeEmail, fakeToken)
Output:
func (*User) GetMessages ¶
GetMessages get you notice message
Example ¶
msg, err := user.GetMessages() if err != nil { fmt.Print(err) return } if len(msg) == 0 { fmt.Print("not have message") return } for _, value := range msg { fmt.Printf("%s : <msg>", value.Time) }
Output:
func (*User) GetPoc ¶
func (u *User) GetPoc() (exploits ExploitResponse, err error)
GetPoc wiil get you poc
func (*User) GetPocCode ¶
download you poc code
Example ¶
code, err := user.GetPocCode("phpyun_v4_install_getshell.rb") if err != nil { fmt.Print(err) return } output, err := os.OpenFile("phpyun_v4_install_getshell.rb", os.O_CREATE|os.O_APPEND|os.O_WRONLY, os.ModePerm) if err != nil { fmt.Print(err) return } _, err = output.WriteString(code) if err != nil { fmt.Print(err) return }
Output:
func (*User) GetRuleInfo ¶
func (u *User) GetRuleInfo(name string) (rule RuleInfoResponse, err error)
SearchRule receive rulename return rule info
func (*User) GetShopPoc ¶
get number of pages exploit info
func (*User) Me ¶
Me will get user info
Example ¶
err := user.Me() if err != nil { fmt.Print(err) return } fmt.Printf("%s have %d message %d Fcoin", user.UserName, user.MessageNum, user.Fcoin)
Output:
func (*User) PublishPoc ¶
PublishPoc will publish you poc
func (*User) Search ¶
func (u *User) Search(query string, fields string, page int, limit int) (searchs SearchResponse, err error)
Search receive a query, fields, pagenum, return search results
func (*User) SearchRule ¶
func (u *User) SearchRule(key string) (resp SearchRuleResponse, err error)
SearchRule receive search key return search response
type UserInfo ¶
type UserInfo struct { // user avatar Avatar string `json:"avatar"` // f coin num Fcoin int `json:"fcoin"` // FofaServer bool `json:"fofa_server"` // cli version CliVersion string `json:"fofacli_ver"` // is verify user? IsVerified bool `json:"is_verified"` // is vip user? IsVip bool `json:"isvip"` // unread message num MessageNum int `json:"message"` // username UserName string `json:"username"` // viplevel VipLevel int `json:"vip_level"` }
user info
Click to show internal directories.
Click to hide internal directories.