-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapping.go
56 lines (51 loc) · 890 Bytes
/
mapping.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
package schemedetector
var schemesMapping = map[string][]string{
"ssh": {"22"},
"http": {"80", "8080"},
"https": {"443"},
"mysql": {"3306"},
"pgsql": {"5432", "6432"},
"memcached": {"11211"},
"redis": {"6379"},
"prometheus": {"9090"},
"kafka": {"9092"},
"amqp": {"5672"},
}
var hostHints = []string{
"address",
"uri",
"url",
"endpoint",
"host",
}
var pathHints = []string{
"path",
"name",
"db",
}
var passHints = []string{
"pass",
"password",
"pwn",
}
var userHints = []string{
"user",
"username",
}
var portHints = []string{
"port",
}
func getPortFromScheme(scheme string) string {
if v, ok := schemesMapping[scheme]; ok {
return v[0]
}
return ""
}
func getSchemeFromPort(port string) string {
for scheme, ports := range schemesMapping {
if stringInArray(port, ports) {
return scheme
}
}
return ""
}