-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.go
More file actions
69 lines (56 loc) · 1.39 KB
/
main.go
File metadata and controls
69 lines (56 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import (
"fmt"
"fofa/fetch"
"fofa/logger"
"fofa/option"
"fofa/report"
"fofa/utils"
"os"
)
func main() {
logger.InitPlatform()
logger.AsciiBanner()
email, apiKey, query, ruleFile, size, output, err := option.ParseCli(os.Args[1:])
if err != nil {
if err == option.PrintUsage {
logger.Usage()
} else if err == option.PrintGrammar {
logger.FofaGrammar()
} else if err == option.IconHash {
fetch.GetIconHash(err.Error())
} else if err == option.FofaTip {
fetch.GetFofaTip(err.Error())
} else {
logger.Warn(err.Error())
}
return
}
logger.Success(fmt.Sprintf("Current Email: %v", email))
logger.Success(fmt.Sprintf("Current Key: %v", apiKey))
var querys []string
if query != "" {
logger.Success(fmt.Sprintf("Current Query: %v", query))
querys = append(querys, query)
} else {
logger.Success(fmt.Sprintf("Current Rules File: %v", ruleFile))
querys = utils.ScanFile(ruleFile)
}
logger.Success(fmt.Sprintf("Current Fetch Size: %v", size))
logger.Success(fmt.Sprintf("Current Output Path: %v", output))
clt := fetch.NewFofaClient(email, apiKey, size)
vaild, err := clt.Auth()
if vaild != true {
if err != nil {
logger.Warn(err.Error())
} else {
logger.Warn("not vaild!")
}
return
} else {
logger.Success("Account(email & key) verified successfully.")
}
clt.QueryAllT(querys)
report.WriteXlsx(fetch.FetchResultT.M, output)
return
}