forked from ShiftLeftSecurity/shiftleft-go-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
81 lines (64 loc) · 2.97 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
package main
import (
"fmt"
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/setting"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/setup"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/user"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/util"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/util/config"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/util/middleware"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/vulnerability/csa"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/vulnerability/idor"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/vulnerability/sqli"
"github.com/ShiftLeftSecurity/Helloshiftleft-internal/helloshiftleftgo/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()
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)
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()
}