-
Notifications
You must be signed in to change notification settings - Fork 0
/
apps.go
103 lines (87 loc) · 2.25 KB
/
apps.go
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
db "pandawa/database"
//"pandawa/shodan"
prompt "pandawa/cli"
shodan "pandawa/shodan"
)
var (
domain = flag.String("domain", "google.com", "Domain for osint")
config = flag.String("config", "~/.pandawa-config.json", "Specify the configuration file.")
favicon = flag.String("fav", "no", "favicon.ico URL ")
operation = flag.String("ops", "no", "Operation name")
cli = flag.String("cli", "no", "cli mode connect to sqldatabase")
)
// Membaca file configurasi dari config.json
type Configuration struct {
Shodan struct {
Key string
}
Listen struct {
Address string
Port string
}
OutboundCall struct {
CallerID string
Retries int
SpoolPath string
}
VmRoot string
}
// Membaca file conf untuk mendapatkan key / API KEY shodan dan dll
func ReadFileConf() Configuration {
flag.Parse()
file, err := os.Open(*config)
if err != nil {
log.Fatal("can't open config file: ", err)
}
defer file.Close()
decoder := json.NewDecoder(file)
Config := Configuration{}
err = decoder.Decode(&Config)
if err != nil {
log.Fatal("can't decode config JSON: ", err)
}
return Config
}
func main() {
fmt.Println("[+] Pandawa osint")
flag.Parse()
// pada saat mode cli digunakan untuk melakukan query pada database sqlite
// next nya akan dikembangkan untuk terminal command
if *cli == "yes" {
fmt.Println("[+] Enter operation name", *operation)
prompt.Cli()
os.Exit(1)
}
if *operation == "no" {
fmt.Println("[+] Enter operation name example --ops=pandawa")
os.Exit(1)
}
if *favicon == "no" {
fmt.Println("[+] Enter favicon url example --fav=https://localhost.com/favicon.ico")
os.Exit(1)
}
dbname := db.GenerateDb(*operation)
fmt.Println("[+] Location DB ", dbname)
//file := ReadFileConf()
shodankey := os.Getenv("shodan")
if shodankey == "" {
fmt.Println("[!] shodan key not found please export shodan key in .bashrc or .zshrc")
os.Exit(1)
}
// convert favicon ico ke mumurhash
// mmh3 := shodan.GetFav(*favicon)
mmh3 := "tes"
//Exec shodan main
shodan.PreSearch(shodankey, mmh3, dbname)
// search keyword didalam code github
// req : keyword and order type (asc , desc)
// db.GenDbGithub(dbname)
// github.GetGitRepo(*domain, "desc", dbname)
}