mirror of https://github.com/gophish/gophish
Added config file integration, updated some styles
parent
f32989b4c5
commit
a3518032be
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"url" : "localhost:3333",
|
||||
"smtp" : {
|
||||
"server" : "smtp.example.com",
|
||||
"host" : "smtp.example.com",
|
||||
"port" : 25,
|
||||
"user" : "username",
|
||||
"pass" : "password"
|
||||
|
|
32
gophish.go
32
gophish.go
|
@ -26,10 +26,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
*/
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.Handle("/", createRouter())
|
||||
http.ListenAndServe("localhost:3333", nil)
|
||||
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() {
|
||||
// Get the config file
|
||||
config_file, e := ioutil.ReadFile("./config.json")
|
||||
if e != nil {
|
||||
fmt.Printf("File error: %v\n", e)
|
||||
os.Exit(1)
|
||||
}
|
||||
json.Unmarshal(config_file, &config)
|
||||
fmt.Printf("Gophish server started at http://%s\n", config.URL)
|
||||
http.Handle("/", createRouter())
|
||||
http.ListenAndServe(config.URL, nil)
|
||||
}
|
|
@ -61,3 +61,7 @@ footer > p {
|
|||
color:#444444;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-top:10px;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{{define "content"}} {{template "nav"}}
|
||||
<div class="jumbotron">
|
||||
<div class="container" style="text-align:center;">
|
||||
<h1>
|
||||
<h1 class="header">
|
||||
Dashboard
|
||||
</h1>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue