-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
74 lines (59 loc) · 1.4 KB
/
main.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
package main
import (
"fmt"
"log"
"os"
owasp "github.com/mamaoag/binosearch/services/owasp"
scanner "github.com/mamaoag/binosearch/services/scanner"
resource "github.com/mamaoag/binosearch/services/url"
wordlist "github.com/mamaoag/binosearch/services/wordlist"
)
func main() {
const APPNAME string = "Binoscan"
var baseUrl string
var wordlistPath string
var endpointsFound []resource.Url
var message string
fmt.Printf("%s - an api application scanner.\n", APPNAME)
fmt.Print("Enter your base url > ")
fmt.Scan(&baseUrl)
if len(os.Args) == 1 {
wordlistPath = wordlist.DEFAULT
} else {
wordlistPath = os.Args[1]
}
dir, err := wordlist.SetWordlist(wordlistPath)
if err != nil {
log.Fatalln(err)
}
for _, path := range dir {
url := resource.Parse(baseUrl, path)
found := scanner.ScanEndpoint(url)
if found.Path != "" {
endpointsFound = append(endpointsFound, found)
}
}
if len(endpointsFound) > 0 {
fmt.Printf("\nScanning for OWASP API Security 2019 Issues\n")
result, err := owasp.BrokenObjectLevelAuth(endpointsFound)
if err != nil {
log.Fatalln(err)
}
if result {
message = "There are issues found. ❌"
} else {
message = "No issues found. ✅"
}
logResult("API1:2019", message)
}
fmt.Printf("Scanning Complete.\n")
}
func logResult(code string, message string) {
log.Printf(
"%d %d: [%s] %s\n",
log.Ldate,
log.Ltime,
code,
message,
)
}