Re-organizing files to use Jquery instead of Angular

pull/24/head
unknown 2015-06-15 16:49:16 -05:00
parent 59b6aa16c1
commit e1eadc3892
12 changed files with 525 additions and 149 deletions

View File

@ -16,8 +16,6 @@ import (
"github.com/justinas/nosurf" "github.com/justinas/nosurf"
) )
var templateDelims = []string{"{{%", "%}}"}
// Logger is used to send logging messages to stdout. // Logger is used to send logging messages to stdout.
var Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile) var Logger = log.New(os.Stdout, " ", log.Ldate|log.Ltime|log.Lshortfile)
@ -29,6 +27,11 @@ func CreateAdminRouter() http.Handler {
router.HandleFunc("/", Use(Base, mid.RequireLogin)) router.HandleFunc("/", Use(Base, mid.RequireLogin))
router.HandleFunc("/login", Login) router.HandleFunc("/login", Login)
router.HandleFunc("/logout", Use(Logout, mid.RequireLogin)) router.HandleFunc("/logout", Use(Logout, mid.RequireLogin))
router.HandleFunc("/campaigns", Use(Campaigns, mid.RequireLogin))
router.HandleFunc("/campaigns/{id:[0-9]+}", Use(CampaignID, mid.RequireLogin))
router.HandleFunc("/templates", Use(Templates, mid.RequireLogin))
router.HandleFunc("/users", Use(Users, mid.RequireLogin))
router.HandleFunc("/landing_pages", Use(LandingPages, mid.RequireLogin))
router.HandleFunc("/register", Register) router.HandleFunc("/register", Register)
router.HandleFunc("/settings", Use(Settings, mid.RequireLogin)) router.HandleFunc("/settings", Use(Settings, mid.RequireLogin))
// Create the API routes // Create the API routes
@ -141,7 +144,6 @@ func Register(w http.ResponseWriter, r *http.Request) {
params.Flashes = session.Flashes() params.Flashes = session.Flashes()
session.Save(r, w) session.Save(r, w)
templates := template.New("template") templates := template.New("template")
templates.Delims(templateDelims[0], templateDelims[1])
_, err := templates.ParseFiles("templates/register.html", "templates/flashes.html") _, err := templates.ParseFiles("templates/register.html", "templates/flashes.html")
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
@ -190,6 +192,66 @@ func Base(w http.ResponseWriter, r *http.Request) {
getTemplate(w, "dashboard").ExecuteTemplate(w, "base", params) getTemplate(w, "dashboard").ExecuteTemplate(w, "base", params)
} }
// Campaigns handles the default path and template execution
func Campaigns(w http.ResponseWriter, r *http.Request) {
// Example of using session - will be removed.
params := struct {
User models.User
Title string
Flashes []interface{}
Token string
}{Title: "Campaigns", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)}
getTemplate(w, "campaigns").ExecuteTemplate(w, "base", params)
}
// CampaignID handles the default path and template execution
func CampaignID(w http.ResponseWriter, r *http.Request) {
// Example of using session - will be removed.
params := struct {
User models.User
Title string
Flashes []interface{}
Token string
}{Title: "Dashboard", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)}
getTemplate(w, "campaign_results").ExecuteTemplate(w, "base", params)
}
// Templates handles the default path and template execution
func Templates(w http.ResponseWriter, r *http.Request) {
// Example of using session - will be removed.
params := struct {
User models.User
Title string
Flashes []interface{}
Token string
}{Title: "Dashboard", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)}
getTemplate(w, "templates").ExecuteTemplate(w, "base", params)
}
// Users handles the default path and template execution
func Users(w http.ResponseWriter, r *http.Request) {
// Example of using session - will be removed.
params := struct {
User models.User
Title string
Flashes []interface{}
Token string
}{Title: "Dashboard", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)}
getTemplate(w, "users").ExecuteTemplate(w, "base", params)
}
// LandingPages handles the default path and template execution
func LandingPages(w http.ResponseWriter, r *http.Request) {
// Example of using session - will be removed.
params := struct {
User models.User
Title string
Flashes []interface{}
Token string
}{Title: "Dashboard", User: ctx.Get(r, "user").(models.User), Token: nosurf.Token(r)}
getTemplate(w, "landing_pages").ExecuteTemplate(w, "base", params)
}
// Settings handles the changing of settings // Settings handles the changing of settings
func Settings(w http.ResponseWriter, r *http.Request) { func Settings(w http.ResponseWriter, r *http.Request) {
switch { switch {
@ -222,7 +284,6 @@ func Login(w http.ResponseWriter, r *http.Request) {
params.Flashes = session.Flashes() params.Flashes = session.Flashes()
session.Save(r, w) session.Save(r, w)
templates := template.New("template") templates := template.New("template")
templates.Delims(templateDelims[0], templateDelims[1])
_, err := templates.ParseFiles("templates/login.html", "templates/flashes.html") _, err := templates.ParseFiles("templates/login.html", "templates/flashes.html")
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
@ -277,7 +338,6 @@ func Clone(w http.ResponseWriter, r *http.Request) {
func getTemplate(w http.ResponseWriter, tmpl string) *template.Template { func getTemplate(w http.ResponseWriter, tmpl string) *template.Template {
templates := template.New("template") templates := template.New("template")
templates.Delims(templateDelims[0], templateDelims[1])
_, err := templates.ParseFiles("templates/base.html", "templates/"+tmpl+".html", "templates/flashes.html") _, err := templates.ParseFiles("templates/base.html", "templates/"+tmpl+".html", "templates/flashes.html")
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)

View File

@ -1,16 +1,16 @@
{{% define "base" %}} {{ define "base" }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" ng-app="gophish"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Gophish - Open-Source Phishing Toolkit"> <meta name="description" content="Gophish - Phishing Toolkit">
<meta name="author" content="Jordan Wright (http://github.com/jordan-wright)"> <meta name="author" content="Jordan Wright (http://github.com/jordan-wright)">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png"> <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>Gophish - {{% .Title %}}</title> <title>Gophish - {{ .Title }}</title>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<!-- <link href="/css/bootstrap.css" rel="stylesheet"> --> <!-- <link href="/css/bootstrap.css" rel="stylesheet"> -->
@ -22,15 +22,15 @@
<link href="/css/font-awesome.min.css" rel="stylesheet"> <link href="/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
<script> <script>
{{%if .User%}} {{if .User}}
var user = { var user = {
api_key : {{% .User.ApiKey %}}, api_key : {{ .User.ApiKey }},
username : {{% .User.Username %}} username : {{ .User.Username }}
} }
{{%end%}} {{end}}
{{%if .Token%}} {{if .Token}}
var csrf_token = {{%.Token%}} var csrf_token = {{.Token}}
{{%end%}} {{end}}
</script> </script>
</head> </head>
@ -64,9 +64,9 @@
<li><a href="/api/">API Documentation</a> <li><a href="/api/">API Documentation</a>
</li> </li>
<li> <li>
{{%if .User%}} {{if .User}}
<div class="btn-group" id="navbar-dropdown"> <div class="btn-group" id="navbar-dropdown">
<button type="button" class="btn btn-primary"><i class="fa fa-user"></i> {{%.User.Username%}}</button> <button type="button" class="btn btn-primary"><i class="fa fa-user"></i> {{.User.Username}}</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span> <span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span> <span class="sr-only">Toggle Dropdown</span>
@ -79,34 +79,34 @@
</li> </li>
</ul> </ul>
</div> </div>
{{%else%}} {{else}}
<a href="/login"> <a href="/login">
<button type="button" class="btn btn-primary">Login</button> <button type="button" class="btn btn-primary">Login</button>
</a> </a>
{{%end%}} {{end}}
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div ng-view></div> {{template "body" .}}
<!-- 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>
<script src="/js/angular-file-upload-shim.min.js"></script> <!--<script src="/js/angular-file-upload-shim.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.js"></script>
<script src="/js/angular-file-upload.min.js"></script> <script src="/js/angular-file-upload.min.js"></script>-->
<script src="/js/ui-bootstrap-0.10.0.min.js"></script> <script src="/js/ui-bootstrap-0.10.0.min.js"></script>
<script src="/js/ng-resource.min.js"></script> <!--<script src="/js/ng-resource.min.js"></script>
<script src="/js/ng-table.min.js"></script> <script src="/js/ng-table.min.js"></script>-->
<script src="/js/highcharts.min.js"></script> <script src="/js/highcharts.min.js"></script>
<script src="/js/highcharts-ng.js"></script> <script src="/js/highcharts-ng.js"></script>
<script src="/js/app/app.js"></script> <!--<script src="/js/app/app.js"></script>
<script src="/js/app/controllers.js"></script> <script src="/js/app/controllers.js"></script>
<script src="/js/app/factories.js"></script> <script src="/js/app/factories.js"></script>-->
<script src="/js/ckeditor/ckeditor.js"></script> <script src="/js/ckeditor/ckeditor.js"></script>
<script src="/js/ng-ckeditor.js"></script> <!--<script src="/js/ng-ckeditor.js"></script>-->
<script> <script>
Highcharts.setOptions({ Highcharts.setOptions({
global: { global: {
@ -117,4 +117,4 @@
</body> </body>
</html> </html>
{{% end %}} {{ end }}

View File

@ -0,0 +1,83 @@
{{define "body"}}
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#">Dashboard</a>
</li>
<li class="active"><a href="#/campaigns">Campaigns</a>
</li>
<li><a href="#/users">Users &amp; Groups</a>
</li>
<li><a href="#/templates">Email Templates</a>
</li>
<li><a href="#/landing_pages">Landing Pages</a>
</li>
<li><a href="#/settings">Settings</a>
</li>
<li><a href="/api/">API Documentation</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="CampaignResultsCtrl">
<div ng-show="campaign">
<div class="row">
<h1 class="page-header">Results for {{campaign.name}}</h1>
</div>
<div class="row">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cogs fa-lg"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Export</a>
</li>
<li><a href="#">Relaunch</a>
</li>
</ul>
</div>
<button type="button" class="btn btn-danger" tooltip="Delete Campaign" tooltip-placement="right" ng-click="delete(campaign)" ng-href="#/dashboard"><i class="fa fa-times fa-lg"></i>
</button>
</div>
<br />
<div class="row">
<tabset>
<tab heading="Overview">
<br/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<highchart config="timeline_chart"></highchart>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<highchart config="email_chart"></highchart>
</div>
</div>
</tab>
<tab heading="Plugins">Plugins here</tab>
<tab heading="Demographics">Demographics here</tab>
</tabset>
</div>
<div class="row">
<h2>Details</h2>
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody>
<tr ng-repeat="result in $data" class="editable-row">
<td data-title="'Email'" class="col-sm-1">{{result.email}}</td>
<td data-title="'Status'" class="col-sm-2">{{result.status}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-show="!campaign">
<div class="row">
<div class="alert alert-danger">
<i class="fa fa-exclamation-circle"></i> Campaign not found!
</div>
</div>
</div>
</div>
{{end}}

73
templates/campaigns.html Normal file
View File

@ -0,0 +1,73 @@
{{define "body"}}
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#">Dashboard</a>
</li>
<li class="active"><a href="#/campaigns">Campaigns</a>
</li>
<li><a href="#/users">Users &amp; Groups</a>
</li>
<li><a href="#/templates">Email Templates</a>
</li>
<li><a href="#/landing_pages">Landing Pages</a>
</li>
<li><a href="#/settings">Settings</a>
</li>
<li><a href="/api/">API Documentation</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="CampaignCtrl">
<h1 class="page-header">
Campaigns
</h1>
<div id="flashes" class="row">
<!-- <div ng-repeat="flash in flashes.main" style="text-align:center" class="alert alert-flash.type">
<i class="fa flash.icon"></i> flash.message
</div> -->
</div>
<div class="row">
<button type="button" class="btn btn-primary" ng-click="newCampaign()"><i class="fa fa-plus"></i> New Campaign</button>
</div>
&nbsp;
<div ng-show="!campaigns.length">
<div class="row">
<div class="alert alert-info">
No campaigns created yet. Let's create one!
</div>
</div>
</div>
<div ng-show="campaigns.length" class="row">
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody>
<tr ng-repeat="campaign in $data | orderBy:modified_date:true" class="editable-row">
<td data-title="'Created Date'" class="col-sm-1">campaign.created_date | date:'medium'</td>
<td data-title="'Name'" class="col-sm-2">campaign.name
<div class="btn-group" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
<li><a ng-href="#/campaigns/campaign.id">View</a>
</li>
<li><a href="/campaigns/campaign.id/relaunch">Relaunch</a>
</li>
<li class="divider"></li>
<li><a ng-click="deleteCampaign(campaign)">Delete</a>
</li>
</ul>
</div>
</td>
<td data-title="'Status'" class="col-sm-1">campaign.status</td>
</tr>
</tbody>
</table>
</div>
</div>
{{end}}

View File

@ -1,13 +1,15 @@
<!-- {{% define "content" %}} {{% template "nav" .User %}} --> {{define "body"}}
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-3 col-md-2 sidebar"> <div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar"> <ul class="nav nav-sidebar">
<li class="active"><a href="#">Dashboard</a> <li class="active"><a href="#">Dashboard</a>
</li> </li>
<li><a href="#/campaigns">Campaigns</a>
</li>
<li><a href="#/users">Users &amp; Groups</a> <li><a href="#/users">Users &amp; Groups</a>
</li> </li>
<li><a href="#/templates">Templates</a> <li><a href="#/templates">Email Templates</a>
</li> </li>
<li><a href="#/landing_pages">Landing Pages</a> <li><a href="#/landing_pages">Landing Pages</a>
</li> </li>
@ -18,35 +20,49 @@
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="CampaignCtrl"> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="DashboardCtrl">
<h1 class="page-header"> <h1 class="page-header">
Dashboard Dashboard
</h1> </h1>
<div ng-show="!campaigns.length">
<div class="row"> <div class="row">
<div ng-repeat="flash in flashes" style="text-align:center" class="alert alert-{{flash.type}}"> <div class="alert alert-info">
<i class="fa {{flash.icon}}"></i> {{flash.message}} No campaigns yet.
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<highchart config="overview_chart"></highchart>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<highchart config="average_chart"></highchart>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<button type="button" class="btn btn-primary" ng-click="newCampaign()" data-toggle="modal" data-target="#newCampaignModal"><i class="fa fa-plus"></i> New Campaign</button> <h2>Recent Campaigns</h2>
</div> </div>
&nbsp; <div class="row">
<a href="#/campaigns"><button type="button" class="btn btn-primary">View All</button></a>
</div>
&nbsp;&nbsp;
<div class="row"> <div class="row">
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered"> <table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody> <tbody>
<tr ng-repeat="campaign in $data" class="editable-row"> <tr ng-repeat="campaign in $data" class="editable-row">
<td data-title="'Created Date'" class="col-sm-1">{{campaign.created_date | date:'medium'}}</td> <td data-title="'Created Date'" class="col-sm-1">campaign.created_date | date:'medium'</td>
<td data-title="'Name'" class="col-sm-2">{{campaign.name}} <td data-title="'Name'" class="col-sm-2">campaign.name
<div class="btn-group" style="float: right;"> <div class="btn-group" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span> <span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span> <span class="sr-only">Toggle Dropdown</span>
</button> </button>
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu"> <ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
<li><a ng-href="/campaigns/{{campaign.id}}">View</a> <li><a ng-href="#/campaigns/campaign.id">View</a>
</li> </li>
<li><a href="/campaigns/{{campaign.id}}/relaunch">Relaunch</a> <li><a href="/campaigns/campaign.id/relaunch">Relaunch</a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
<li><a ng-click="deleteCampaign(campaign)" ng-href="#">Delete</a> <li><a ng-click="deleteCampaign(campaign)" ng-href="#">Delete</a>
@ -54,61 +70,11 @@
</ul> </ul>
</div> </div>
</td> </td>
<td data-title="'Status'" class="col-sm-1">{{campaign.status}}</td> <td data-title="'Status'" class="col-sm-1">campaign.status</td>
</tr>
</tbody>
</table>
</div>
<!-- New Campaign Modal -->
<div class="modal" id="newCampaignModal" role="dialog" aria-labelledby="campaignModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="campaignModalLabel">New Campaign</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" ng-model="campaign.name" id="name" placeholder="Campaign name" autofocus>
<br />
<label class="control-label" for="template">Template:</label>
<input type="text" class="form-control" placeholder="Template Name" id="template" typeahead="template.name for template in templates | filter:{name:$viewValue}" typeahead-editable="false" ng-model="template.name" />
<br />
<label class="control-label" for="from">From:</label>
<input type="text" class="form-control" placeholder="First Last <test@example.com>" id="form">
<br />
<label class="control-label" for="smtp_server">SMTP Server:</label>
<input type="text" class="form-control" placeholder="host:port" id="smtp_server">
<br />
<label class="control-label" for="users">Groups:</label>
<form ng:submit="addGroup()">
<div class="input-group">
<input type="text" class="form-control" placeholder="Group Name" id="users" typeahead="group.name for group in groups | filter:{name:$viewValue}" typeahead-editable="false" ng-model="group.name" />
<span class="input-group-btn">
<button class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
</span>
</div>
</form>
<br />
<table ng-table="editGroupTableParams" class="table table-hover table-striped table-condensed">
<tbody>
<tr ng-repeat="group in $data" class="editable-row">
<td>{{group.name}}
<span ng-click="removeGroup(group)" class="remove-row"><i class="fa fa-trash-o"></i>
</span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="modal-footer"> </div>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> {{end}}
<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="saveCampaign(campaign)" type="submit">Launch Campaign</button>
</div>
</div>
</div>
</div>
</div>
<!-- {{% end %}} -->

View File

@ -1,15 +1,15 @@
{{%define "flashes"%}} {{define "flashes"}}
{{%range .%}} {{range .}}
<div style="text-align:center" class="alert alert-{{%.Type%}}"> <div style="text-align:center" class="alert alert-{{.Type}}">
<i class="fa <i class="fa
{{%if eq .Type "danger"%}} {{if eq .Type "danger"}}
fa-exclamation-circle fa-exclamation-circle
{{%else if eq .Type "warning"%}} {{else if eq .Type "warning"}}
fa-exclamation-triangle fa-exclamation-triangle
{{%else if eq .Type "success"%}} {{else if eq .Type "success"}}
fa-check-circle fa-check-circle
{{%end%}}"></i> {{end}}"></i>
{{%.Message%}} {{.Message}}
</div> </div>
{{%end%}} {{end}}
{{%end%}} {{end}}

View File

@ -0,0 +1,67 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#">Dashboard</a>
</li>
<li><a href="#/campaigns">Campaigns</a>
</li>
<li><a href="#/users">Users &amp; Groups</a>
</li>
<li><a href="#/templates">Email Templates</a>
</li>
<li class="active"><a href="#/landing_pages">Landing Pages</a>
</li>
<li><a href="#/settings">Settings</a>
</li>
<li><a href="/api/">API Documentation</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="LandingPageCtrl">
<h1 class="page-header">
Landing Pages
</h1>
<div class="row">
<div ng-repeat="flash in flashes" style="text-align:center" class="alert alert-{{flash.type}}">
<i class="fa {{flash.icon}}"></i> {{flash.message}}
</div>
</div>
<div class="row">
<button type="button" class="btn btn-primary" ng-click="editPage('new')" data-toggle="modal" data-target="#newLandingPageModal"><i class="fa fa-plus"></i> New Page</button>
</div>
&nbsp;
<div ng-show="!pages.length">
<div class="row">
<div class="alert alert-info">
No pages created yet. Let's create one!
</div>
</div>
</div>
<div ng-show="pages.length" class="row">
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody>
<tr ng-repeat="page in $data | orderBy: '-modified_date'" class="editable-row">
<td data-title="'Name'" sortable="'name'" class="col-sm-2">{{page.name}}
<div class="btn-group" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
<li><a ng-click="editPage(page)">Edit</a>
</li>
<li class="divider"></li>
<li><a ng-click="deletePage(page)" ng-href="#">Delete</a>
</li>
</ul>
</div>
</td>
<td data-title="'Modified Date'" class="col-sm-1">{{page.modified_date | date:'medium'}}</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -1,4 +1,4 @@
{{% define "base" %}} {{ define "base" }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -10,7 +10,7 @@
<meta name="author" content="Jordan Wright (http://github.com/jordan-wright)"> <meta name="author" content="Jordan Wright (http://github.com/jordan-wright)">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png"> <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>Gophish - {{% .Title %}}</title> <title>Gophish - {{ .Title }}</title>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<!-- <link href="/css/bootstrap.css" rel="stylesheet"> --> <!-- <link href="/css/bootstrap.css" rel="stylesheet"> -->
@ -51,10 +51,10 @@
<form class="form-signin" action="/login" method="POST"> <form class="form-signin" action="/login" method="POST">
<img id="logo" src="/images/logo_purple.png" /> <img id="logo" src="/images/logo_purple.png" />
<h2 class="form-signin-heading">Please sign in</h2> <h2 class="form-signin-heading">Please sign in</h2>
{{%template "flashes" .Flashes%}} {{template "flashes" .Flashes}}
<input type="text" name="username" class="form-control" placeholder="Username" required autofocus> <input type="text" name="username" class="form-control" placeholder="Username" required autofocus>
<input type="password" name="password" class="form-control" placeholder="Password" required> <input type="password" name="password" class="form-control" placeholder="Password" required>
<input type="hidden" name="csrf_token" value="{{%.Token%}}"/> <input type="hidden" name="csrf_token" value="{{.Token}}"/>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form> </form>
</div> </div>
@ -67,4 +67,4 @@
</body> </body>
</html> </html>
{{% end %}} {{ end }}

View File

@ -1,4 +1,4 @@
{{% define "base" %}} {{ define "base" }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -10,7 +10,7 @@
<meta name="author" content="Jordan Wright (http://github.com/jordan-wright)"> <meta name="author" content="Jordan Wright (http://github.com/jordan-wright)">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png"> <link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
<title>Gophish - {{% .Title %}}</title> <title>Gophish - {{ .Title }}</title>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<!-- <link href="/css/bootstrap.css" rel="stylesheet"> --> <!-- <link href="/css/bootstrap.css" rel="stylesheet"> -->
@ -51,7 +51,7 @@
<form class="form-signin" action="/register" method="POST"> <form class="form-signin" action="/register" method="POST">
<img id="logo" src="/images/logo_purple.png" /> <img id="logo" src="/images/logo_purple.png" />
<h2 class="form-signin-heading">Please register below</h2> <h2 class="form-signin-heading">Please register below</h2>
{{%template "flashes" .Flashes%}} {{template "flashes" .Flashes}}
<input type="text" name="username" class="form-control" placeholder="Username" required autofocus/> <input type="text" name="username" class="form-control" placeholder="Username" required autofocus/>
<input type="password" name="password" class="form-control" placeholder="Password" required/> <input type="password" name="password" class="form-control" placeholder="Password" required/>
<input type="hidden" name="csrf_token" value="{{%.Token%}}"/> <input type="hidden" name="csrf_token" value="{{%.Token%}}"/>
@ -67,19 +67,4 @@
</body> </body>
</html> </html>
{{% end %}} {{ end }}
{{%define "content"%}}
<div class="container">
<form class="form-signin" action="/register" method="POST">
<img id="logo" src="/images/logo.png" />
<h2 class="form-signin-heading">Please register below</h2>
{{%template "flashes" .Flashes%}}
<input type="text" name="username" class="form-control" placeholder="Username" required autofocus/>
<input type="password" name="password" class="form-control" placeholder="Password" required/>
<input type="hidden" name="csrf_token" value={{%.Token%}}/>
<button class="btn btn-lg btn-primary btn-block" type="submit">Register</button>
</form>
</div>
{{%end%}}

View File

@ -1,4 +1,4 @@
{{%define "content"%}} {{%template "nav" .User%}} {{define "body"}}
<div class="jumbotron"> <div class="jumbotron">
<div class="container" style="text-align:center;"> <div class="container" style="text-align:center;">
<h1 class="sans header"> <h1 class="sans header">
@ -22,7 +22,7 @@
</ul> </ul>
</div> </div>
<div class="col-md-9 sans"> <div class="col-md-9 sans">
{{%template "flashes" .Flashes%}} {{template "flashes" .Flashes}}
<h1 style="margin:0px 0px 15px 0px;">User Settings</h1> <h1 style="margin:0px 0px 15px 0px;">User Settings</h1>
<div class="row"> <div class="row">
<label for="api_key" class="col-sm-2 control-label form-label">API Key:</label> <label for="api_key" class="col-sm-2 control-label form-label">API Key:</label>
@ -63,4 +63,4 @@
<br/> <br/>
</div> </div>
</div> </div>
{{%end%}} {{end}}

69
templates/templates.html Normal file
View File

@ -0,0 +1,69 @@
{{define "body"}}
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#">Dashboard</a>
</li>
<li><a href="#/campaigns">Campaigns</a>
</li>
<li><a href="#/users">Users &amp; Groups</a>
</li>
<li class="active"><a href="#/templates">Email Templates</a>
</li>
<li><a href="#/landing_pages">Landing Pages</a>
</li>
<li><a href="#/settings">Settings</a>
</li>
<li><a href="/api/">API Documentation</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="TemplateCtrl">
<h1 class="page-header">
Email Templates
</h1>
<div class="row">
<div ng-repeat="flash in flashes.main" style="text-align:center" class="alert alert-{{flash.type}}">
<i class="fa {{flash.icon}}"></i> {{flash.message}}
</div>
</div>
<div class="row">
<button type="button" class="btn btn-primary" ng-click="editTemplate('new')"><i class="fa fa-plus"></i> New Template</button>
</div>
&nbsp;
<div ng-show="!templates.length">
<div class="row">
<div class="alert alert-info">
No templates created yet. Let's create one!
</div>
</div>
</div>
<div ng-show="templates.length" class="row">
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody>
<tr ng-repeat="template in $data | orderBy: '-modified_date'" class="editable-row">
<td data-title="'Name'" sortable="'name'" class="col-sm-2">{{template.name}}
<div class="btn-group" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
<li><a ng-click="editTemplate(template)">Edit</a>
</li>
<li class="divider"></li>
<li><a ng-click="deleteTemplate(template)">Delete</a>
</li>
</ul>
</div>
</td>
<td data-title="'Modified Date'" class="col-sm-1">{{template.modified_date | date:'medium'}}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{end}}

73
templates/users.html Normal file
View File

@ -0,0 +1,73 @@
{{define "body"}}
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#">Dashboard</a>
</li>
<li><a href="#/campaigns">Campaigns</a>
</li>
<li class="active"><a href="#/users">Users &amp; Groups</a>
</li>
<li><a href="#/templates">Email Templates</a>
</li>
<li><a href="#/landing_pages">Landing Pages</a>
</li>
<li><a href="#/settings">Settings</a>
</li>
<li><a href="/api/">API Documentation</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main" ng-controller="GroupCtrl">
<h1 class="page-header">
Users &amp; Groups
</h1>
<div class="row">
<div ng-repeat="flash in flashes.main" style="text-align:center" class="alert alert-{{flash.type}}">
<i class="fa {{flash.icon}}"></i> {{flash.message}}
</div>
</div>
<div class="row">
<button type="button" class="btn btn-primary" ng-click="editGroup('new')" data-toggle="modal" data-target="#newGroupModal"><i class="fa fa-plus"></i> New Group</button>
</div>
&nbsp;
<div ng-show="!groups.length">
<div class="row">
<div class="alert alert-info">
No groups created yet. Let's create one!
</div>
</div>
</div>
<div ng-show="groups.length" class="row">
<table ng-table="mainTableParams" class="table table-hover table-striped table-bordered">
<tbody>
<tr ng-repeat="group in $data | orderBy: '-modified_date'" class="editable-row">
<td data-title="'Name'" sortable="'name'" class="col-sm-1">{{group.name}}</td>
<td data-title="'Members'" class="col-sm-2">
<span ng-repeat="target in group.targets | cut:5 track by $index ">
{{target}}{{$last ? '' : ', '}}
</span>
<div class="btn-group" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle edit-button" data-toggle="dropdown">
<span class="caret" style="border-top-color:#FFFFFF"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
<li><a ng-click="editGroup(group)">Edit</a>
</li>
<li class="divider"></li>
<li><a ng-click="deleteGroup(group)">Delete</a>
</li>
</ul>
</div>
</td>
<td data-title="'Modified Date'" class="col-sm-1">{{group.modified_date | date:'medium'}}</td>
</tr>
</tbody>
</table>
</div>
</div>
{{end}}