From 25a06a14a0bf3b38976c50a32add07273a43db2f Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Mon, 9 Dec 2013 00:35:07 -0600 Subject: [PATCH] Working on adding session support Starting to add API documentation page Moved footer to base.html - Might move more later --- api.go | 4 ++ route.go | 6 +- static/css/main.css | 142 +++++++++++++++++++++------------------ templates/api_doc.html | 30 +++++++++ templates/base.html | 9 ++- templates/dashboard.html | 71 ++++++++++++++++++-- 6 files changed, 186 insertions(+), 76 deletions(-) create mode 100644 templates/api_doc.html diff --git a/api.go b/api.go index a2c3b86e..6938ce6c 100644 --- a/api.go +++ b/api.go @@ -19,3 +19,7 @@ func API_Campaigns_Id(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) fmt.Fprintf(w, "{\"method\" : \""+r.Method+"\", \"id\" : "+vars["id"]+"}") } + +func API_Doc(w http.ResponseWriter, r *http.Request) { + renderTemplate(w, "api_doc") +} diff --git a/route.go b/route.go index 8fb15afe..a4e3515e 100644 --- a/route.go +++ b/route.go @@ -49,6 +49,7 @@ func createRouter() http.Handler { api.HandleFunc("/", API) api.HandleFunc("/campaigns", API_Campaigns) api.HandleFunc("/campaigns/{id}", API_Campaigns_Id) + api.HandleFunc("/doc", API_Doc) //Setup static file serving router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/"))) @@ -62,11 +63,14 @@ func Register(w http.ResponseWriter, r *http.Request) { } func Base(w http.ResponseWriter, r *http.Request) { - //w.Header().Set("Content-Type", "application/json") + session, _ := store.Get(r, "gophish") + // Example of saving session - will be removed. + session.Save(r, w) renderTemplate(w, "dashboard") } func Base_Campaigns(w http.ResponseWriter, r *http.Request) { + session, _ := store.Get(r, "gophish") renderTemplate(w, "dashboard") } diff --git a/static/css/main.css b/static/css/main.css index eb174a0e..83b0df99 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,70 +1,80 @@ .navbar-logo { - margin: 4px 0px; - float: left; + margin: 4px 0px; + float: left; } #navbar-login { - padding-top:8px; - padding-bottom:0px; + padding-top:8px; + padding-bottom:0px; + } + .sans { + font-family:'Open Sans', sans-serif !important; + } + .form-signin { + max-width: 330px; + padding: 15px; + margin: 0 auto; + } + .form-signin-heading { + text-align:center; + } + .form-signin .form-signin-heading, .form-signin .checkbox { + margin-bottom: 10px; + } + .form-signin .checkbox { + font-weight: normal; + } + .form-signin .form-control { + font-family:'Open Sans', sans-serif; + position: relative; + font-size: 16px; + height: auto; + padding: 10px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + .form-signin .form-control:focus { + z-index: 2; + } + .form-signin input[type="text"] { + margin-bottom: -1px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + .form-signin input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; + } + #logo { + display: block; + margin-left: auto; + margin-right: auto; + } + footer > p { + color:#444444; + font-family:'Open Sans', sans-serif; + } + .header { + margin-top:10px; + } + .sidebar { + padding-left:0px; + } + .sidebar a { + color:#201e1c; + } + .sidebar a:hover { + color:#201e1c; + } + .api_heading { + font-family:'Open Sans', sans-serif; + background-color:#201e1c; + border-radius: 5px; + padding:10px; + color:#E2E2E2; + width:100%; + } + p { + font-size:1.2em; } - -.sans { - font-family: 'Open Sans', sans-serif; -} - -.form-signin { - max-width: 330px; - padding: 15px; - margin: 0 auto; -} - -.form-signin-heading { - text-align:center; -} - -.form-signin .form-signin-heading, -.form-signin .checkbox { - margin-bottom: 10px; -} -.form-signin .checkbox { - font-weight: normal; -} -.form-signin .form-control { - font-family: 'Open Sans', sans-serif; - position: relative; - font-size: 16px; - height: auto; - padding: 10px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.form-signin .form-control:focus { - z-index: 2; -} -.form-signin input[type="text"] { - margin-bottom: -1px; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} -.form-signin input[type="password"] { - margin-bottom: 10px; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -#logo { - display: block; - margin-left: auto; - margin-right: auto; -} -footer > p { - color:#444444; - font-family: 'Open Sans', sans-serif; -} - -.header { - margin-top:10px; -} -.sidebar { - padding-left:0px; -} \ No newline at end of file diff --git a/templates/api_doc.html b/templates/api_doc.html new file mode 100644 index 00000000..849253af --- /dev/null +++ b/templates/api_doc.html @@ -0,0 +1,30 @@ +{{define "content"}} {{template "nav"}} +
+
+

+ API Documentation +

+
+
+
+ +
+

Gophish API

+

Gophish runs on top of a RESTful API which allows developers to automate phishing campaigns easily. The following documentation and examples demonstrate the API functionality

+

/api/campaigns

+

Test.

+
+
+{{end}} + diff --git a/templates/base.html b/templates/base.html index c8c76207..006cf74c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -23,8 +23,13 @@ {{template "content"}} - + +
+
+ +
diff --git a/templates/dashboard.html b/templates/dashboard.html index 7b575bf8..7f98d268 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,7 +1,7 @@ {{define "content"}} {{template "nav"}}
-

+

Dashboard

@@ -15,16 +15,73 @@
  • Settings
  • +
  • API Documentation +
  • - Testing +
    + +
    +   +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DateNameStatus
    1MarkOtto
    3MarkOtto
    2JacobThornton
    3Larry the Bird@twitter
    +
    -
    -
    -
    -

    © Jordan (jordan-wright) 2013

    -
    + + {{end}}