Moved structs to models.go file

Changed config to have "host" string
Working on simple mailing library
Some basic template bug fixes (eventually I might move the side nav to a template)
This commit is contained in:
Jordan Wright 2013-12-12 00:27:43 -06:00
parent 25a06a14a0
commit a64b0c10c9
9 changed files with 95 additions and 17 deletions

View file

@ -1,8 +1,7 @@
{
"url" : "localhost:3333",
"smtp" : {
"host" : "smtp.example.com",
"port" : 25,
"host" : "smtp.example.com:25",
"user" : "username",
"pass" : "password"
}

View file

@ -33,18 +33,6 @@ import (
"os"
)
type SMTPServer struct {
Server string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
Password string `json:"password"`
}
type Config struct {
URL string `json:"url"`
SMTP SMTPServer `json:"smtp"`
}
var config Config
func main() {

9
lib/mailer.go Normal file
View file

@ -0,0 +1,9 @@
package main
import (
"net/smtp"
)
func Send(email Email, server Server) {
auth = smtp.PlainAuth("", server.User, server.Password, server.Server)
}

21
models.go Normal file
View file

@ -0,0 +1,21 @@
package main
type SMTPServer struct {
Host string `json:"host"`
User string `json:"user"`
Password string `json:"password"`
}
type Email struct {
Subject string
Body string
To []string
Bcc []string
Cc []string
From string
}
type Config struct {
URL string `json:"url"`
SMTP SMTPServer `json:"smtp"`
}

View file

@ -70,7 +70,7 @@ func Base(w http.ResponseWriter, r *http.Request) {
}
func Base_Campaigns(w http.ResponseWriter, r *http.Request) {
session, _ := store.Get(r, "gophish")
//session, _ := store.Get(r, "gophish")
renderTemplate(w, "dashboard")
}

View file

@ -1,3 +1,4 @@
.navbar-logo {
margin: 4px 0px;
float: left;

View file

@ -9,13 +9,13 @@
<div class="container">
<div class="col-md-3 sidebar">
<ul class="nav nav-pills nav-stacked">
<li class="active"><a href="#">Dashboard</a>
<li><a href="/">Dashboard</a>
</li>
<li><a href="/users">Users &amp; Groups</a>
</li>
<li><a href="/settings">Settings</a>
</li>
<li><a href="/api/doc">API Documentation</a>
<li class="active"><a href="/api/doc">API Documentation</a>
</li>
</ul>
</div>

30
templates/settings.html Normal file
View file

@ -0,0 +1,30 @@
{{define "content"}} {{template "nav"}}
<div class="jumbotron">
<div class="container" style="text-align:center;">
<h1 class="sans header">
Settings
</h1>
</div>
</div>
<div class="container">
<div class="col-md-3 sidebar">
<ul class="nav nav-pills nav-stacked">
<li><a href="/">Dashboard</a>
</li>
<li><a href="/users">Users &amp; Groups</a>
</li>
<li class="active"><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}}

30
templates/users.html Normal file
View file

@ -0,0 +1,30 @@
{{define "content"}} {{template "nav"}}
<div class="jumbotron">
<div class="container" style="text-align:center;">
<h1 class="sans header">
Users &amp; Groups
</h1>
</div>
</div>
<div class="container">
<div class="col-md-3 sidebar">
<ul class="nav nav-pills nav-stacked">
<li><a href="/">Dashboard</a>
</li>
<li class="active"><a href="/users">Users &amp; 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}}