-
Notifications
You must be signed in to change notification settings - Fork 164
/
app.go
85 lines (68 loc) · 2.93 KB
/
app.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
package main
import (
"fmt"
"net/http"
_ "github.com/tidwall/gjson"
"github.com/julienschmidt/httprouter"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/setting"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/setup"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/user"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/util"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/util/config"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/util/middleware"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/vulnerability/csa"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/vulnerability/idor"
pathTraversal "github.com/ShiftLeftSecurity/shiftleft-go-demo/vulnerability/path-traversal"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/vulnerability/sqli"
"github.com/ShiftLeftSecurity/shiftleft-go-demo/vulnerability/xss"
)
const (
banner = `
ÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ ÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛ
ÛÛÛ°°°°°ÛÛÛ °°ÛÛÛ °°ÛÛÛ °°ÛÛÛ °ÛÛÛ °°ÛÛÛ ÛÛÛ°°°°°ÛÛÛ
ÛÛÛ °°° ÛÛÛÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ
°ÛÛÛ ÛÛÛ°°ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛ °ÛÛÛÛÛÛÛÛÛÛÛ
°ÛÛÛ ÛÛÛÛÛ°ÛÛÛ °ÛÛÛ °°ÛÛÛ ÛÛÛ °°ÛÛÛ ÛÛÛÛÛ ÛÛÛ °ÛÛÛ°°°°°ÛÛÛ
°°ÛÛÛ °°ÛÛÛ °ÛÛÛ °ÛÛÛ °°°ÛÛÛÛÛ° °°°ÛÛÛÛÛ°ÛÛÛÛÛ° °ÛÛÛ °ÛÛÛ
°°ÛÛÛÛÛÛÛÛÛ °°ÛÛÛÛÛÛ °°ÛÛÛ °°ÛÛÛ °°ÛÛÛ ÛÛÛÛÛ ÛÛÛÛÛ
°°°°°°°°° °°°°°° °°° °°° °°° °°°°° °°°°° `
)
//index and set cookie
func indexHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
util.SetCookieLevel(w, r, "low") //set cookie Level default to low
data := make(map[string]interface{})
data["title"] = "Index"
util.SafeRender(w, r, "template.index", data)
}
func main() {
fmt.Println(banner)
mw := middleware.New()
router := httprouter.New()
user := user.New()
sqlI := sqli.New()
xss := xss.New()
idor := idor.New()
csa := csa.New()
pathTraversal := pathTraversal.New()
setup := setup.New()
setting := setting.New()
router.ServeFiles("/public/*filepath", http.Dir("public/"))
router.GET("/", mw.LoggingMiddleware(mw.AuthCheck(indexHandler)))
router.GET("/index", mw.LoggingMiddleware(mw.DetectSQLMap(mw.AuthCheck(indexHandler))))
user.SetRouter(router)
sqlI.SetRouter(router)
xss.SetRouter(router)
idor.SetRouter(router)
csa.SetRouter(router)
pathTraversal.SetRouter(router)
setup.SetRouter(router)
setting.SetRouter(router)
s := http.Server{
Addr: ":8082",
Handler: router,
}
fmt.Printf("Server running at port %s\n", s.Addr)
fmt.Printf("Open this url %s on your browser to access GoVWA", config.Fullurl)
fmt.Println("")
s.ListenAndServe()
}