mirror of https://github.com/gophish/gophish
Working on adding session support
Starting to add API documentation page Moved footer to base.html - Might move more laterpull/24/head
parent
ceaf400206
commit
25a06a14a0
4
api.go
4
api.go
|
@ -19,3 +19,7 @@ func API_Campaigns_Id(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
fmt.Fprintf(w, "{\"method\" : \""+r.Method+"\", \"id\" : "+vars["id"]+"}")
|
fmt.Fprintf(w, "{\"method\" : \""+r.Method+"\", \"id\" : "+vars["id"]+"}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func API_Doc(w http.ResponseWriter, r *http.Request) {
|
||||||
|
renderTemplate(w, "api_doc")
|
||||||
|
}
|
||||||
|
|
6
route.go
6
route.go
|
@ -49,6 +49,7 @@ func createRouter() http.Handler {
|
||||||
api.HandleFunc("/", API)
|
api.HandleFunc("/", API)
|
||||||
api.HandleFunc("/campaigns", API_Campaigns)
|
api.HandleFunc("/campaigns", API_Campaigns)
|
||||||
api.HandleFunc("/campaigns/{id}", API_Campaigns_Id)
|
api.HandleFunc("/campaigns/{id}", API_Campaigns_Id)
|
||||||
|
api.HandleFunc("/doc", API_Doc)
|
||||||
|
|
||||||
//Setup static file serving
|
//Setup static file serving
|
||||||
router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/")))
|
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) {
|
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")
|
renderTemplate(w, "dashboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Base_Campaigns(w http.ResponseWriter, r *http.Request) {
|
func Base_Campaigns(w http.ResponseWriter, r *http.Request) {
|
||||||
|
session, _ := store.Get(r, "gophish")
|
||||||
renderTemplate(w, "dashboard")
|
renderTemplate(w, "dashboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,30 +6,25 @@
|
||||||
padding-top:8px;
|
padding-top:8px;
|
||||||
padding-bottom:0px;
|
padding-bottom:0px;
|
||||||
}
|
}
|
||||||
|
.sans {
|
||||||
.sans {
|
font-family:'Open Sans', sans-serif !important;
|
||||||
font-family: 'Open Sans', sans-serif;
|
}
|
||||||
}
|
.form-signin {
|
||||||
|
|
||||||
.form-signin {
|
|
||||||
max-width: 330px;
|
max-width: 330px;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
.form-signin-heading {
|
||||||
.form-signin-heading {
|
|
||||||
text-align:center;
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
.form-signin .form-signin-heading, .form-signin .checkbox {
|
||||||
.form-signin .form-signin-heading,
|
|
||||||
.form-signin .checkbox {
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
.form-signin .checkbox {
|
.form-signin .checkbox {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
.form-signin .form-control {
|
.form-signin .form-control {
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family:'Open Sans', sans-serif;
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
@ -37,34 +32,49 @@
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.form-signin .form-control:focus {
|
.form-signin .form-control:focus {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.form-signin input[type="text"] {
|
.form-signin input[type="text"] {
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
}
|
}
|
||||||
.form-signin input[type="password"] {
|
.form-signin input[type="password"] {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-top-right-radius: 0;
|
border-top-right-radius: 0;
|
||||||
}
|
}
|
||||||
|
#logo {
|
||||||
#logo {
|
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
footer > p {
|
footer > p {
|
||||||
color:#444444;
|
color:#444444;
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family:'Open Sans', sans-serif;
|
||||||
}
|
}
|
||||||
|
.header {
|
||||||
.header {
|
|
||||||
margin-top:10px;
|
margin-top:10px;
|
||||||
}
|
}
|
||||||
.sidebar {
|
.sidebar {
|
||||||
padding-left:0px;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{{define "content"}} {{template "nav"}}
|
||||||
|
<div class="jumbotron">
|
||||||
|
<div class="container" style="text-align:center;">
|
||||||
|
<h1 class="sans header">
|
||||||
|
API Documentation
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="col-md-3 sidebar">
|
||||||
|
<ul class="nav nav-pills nav-stacked">
|
||||||
|
<li class="active"><a href="#">Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="/users">Users & Groups</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="/settings">Settings</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="/api/doc">API Documentation</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 sans">
|
||||||
|
<h1 style="margin-top:0px"><i class="fa fa-gear"></i> Gophish API</h1>
|
||||||
|
<p>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</p>
|
||||||
|
<h2 class="api_heading">/api/campaigns</h2>
|
||||||
|
<p>Test.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
|
@ -23,8 +23,13 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{template "content"}}
|
{{template "content"}}
|
||||||
<!-- Bootstrap core JavaScript
|
<!-- Footer -->
|
||||||
================================================== -->
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p>© Jordan (<a href="https://github.com/jordan-wright">jordan-wright</a>) 2013</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
<script src="/js/jquery.js"></script>
|
<script src="/js/jquery.js"></script>
|
||||||
<script src="/js/bootstrap.min.js"></script>
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{define "content"}} {{template "nav"}}
|
{{define "content"}} {{template "nav"}}
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<div class="container" style="text-align:center;">
|
<div class="container" style="text-align:center;">
|
||||||
<h1 class="header">
|
<h1 class="sans header">
|
||||||
Dashboard
|
Dashboard
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,16 +15,73 @@
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/settings">Settings</a>
|
<li><a href="/settings">Settings</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="/api/doc">API Documentation</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
Testing
|
<div class="row">
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newCampaignModal"><i class="fa fa-plus"></i> New Campaign</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<table class="table table-hover table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>1</td>
|
||||||
|
<td>Mark</td>
|
||||||
|
<td>Otto</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>3</td>
|
||||||
|
<td>Mark</td>
|
||||||
|
<td>Otto</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>2</td>
|
||||||
|
<td>Jacob</td>
|
||||||
|
<td>Thornton</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>3</td>
|
||||||
|
<td>Larry the Bird</td>
|
||||||
|
<td>@twitter</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<!-- New Campaign Modal -->
|
||||||
<hr>
|
<div class="modal" id="newCampaignModal" tabindex="-1" role="dialog" aria-labelledby="campaignModalLabel" aria-hidden="true">
|
||||||
<footer>
|
<div class="modal-dialog">
|
||||||
<p>© Jordan (jordan-wright) 2013</p>
|
<div class="modal-content">
|
||||||
</footer>
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title" id="campaignModalLabel">New Campaign</h4>
|
||||||
|
</div>
|
||||||
|
<form action="/">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Name:</label>
|
||||||
|
<input type="text" class="form-control" id="name">
|
||||||
|
<label for="users">Users & Groups:</label>
|
||||||
|
<input type="text" class="form-control" id="users">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-primary" type="submit">Launch Campaign</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue