Commit Graph

179 Commits (7debe7874567138d3b4995a291925d35670eff2e)

Author SHA1 Message Date
Ahmed Khalid 7debe78745 adding extended_templates feature 2020-04-16 02:55:43 +02:00
Jordan Wright 6251ea6a02
Fixing issues - get values from non objects (#1773)
After calls to get Template, Page, and SMTP, if the objects aren't found then we're currently trying to display error message using the name values of the non objects. This changes this behavior such that we use the name values from the campaign object to give better log messages.
2020-03-05 07:31:19 -06:00
Jordan Wright 8162a80cb1
Improve the Performance of Sending Emails (#1753)
Adding the ability to cache campaigns on maillogs to greatly improve generation time (and, by extension, sending speed and memory usage).
2020-02-29 20:19:54 -06:00
Jordan Wright be459e47bf
Refactoring tests to remove stretchr/testify dependency 2020-02-01 21:44:50 -06:00
Jordan Wright 3d525525ea Added campaign ID to the webhook JSON payload 2020-01-30 07:09:04 -06:00
Jordan Wright 0620671de6 Adding benchmarks for maillog.Generate. Ref #1726 2020-01-25 22:09:43 -06:00
Jordan Wright 947bb4ccba Adjusting SMTP TLS config to use just the hostname instead of the hostname+port when validating certificates. Fixes #1709 2020-01-21 07:21:56 -06:00
Glenn Wilkinson 9de32746ee Added IMAP support for checking reported emails (#1612)
Initial support of managing reporting through IMAP.

Co-Authored-By: Jordan Wright <jmwright798@gmail.com>
2020-01-18 11:58:34 -06:00
Jordan Wright 546da4ee7d Removing unneeded query to improve group performance.
As mentioned in #1702, the query in `insertTargetIntoGroup` isn't needed, since both instances where it's used we already know that the target isn't in the group. This means it's safe to remove that query, improving performance dramatically.

Before:

```
BenchmarkPostGroup100-4     	      81	  12629754 ns/op	 2989993 B/op	   52918 allocs/op
BenchmarkPostGroup1000-4    	       6	 189527792 ns/op	29891818 B/op	  528082 allocs/op
BenchmarkPostGroup10000-4   	       1	6203645806 ns/op	299253648 B/op	 5282859 allocs/op
BenchmarkPutGroup100-4      	     100	  10221833 ns/op	 2589165 B/op	   46078 allocs/op
BenchmarkPutGroup1000-4     	       7	 162692432 ns/op	25812440 B/op	  458425 allocs/op
BenchmarkPutGroup10000-4    	       1	7596445084 ns/op	260385808 B/op	 4581569 allocs/op
```

After:

```
BenchmarkPostGroup100-4     	     133	   8848973 ns/op	 2354605 B/op	   42322 allocs/op
BenchmarkPostGroup1000-4    	       9	 112557410 ns/op	23549206 B/op	  422184 allocs/op
BenchmarkPostGroup10000-4   	       1	3414209403 ns/op	235635952 B/op	 4222090 allocs/op
BenchmarkPutGroup100-4      	     147	   8094333 ns/op	 2271297 B/op	   40777 allocs/op
BenchmarkPutGroup1000-4     	       9	 125092124 ns/op	22635067 B/op	  405421 allocs/op
BenchmarkPutGroup10000-4    	       1	5712591900 ns/op	228592920 B/op	 4051316 allocs/op
```
2020-01-16 20:41:13 -06:00
JoseW3b 91d798336f Get send_by_date (#1720)
Get send_by_date field when query on GetCampaignSummary and GetCampaignSummaries
2020-01-15 22:02:19 -06:00
Jordan Wright 01287e0dd5 Minor cleanup on webhook feature integration
- Ran gofmt
- Rebuilt minified static files
- Updated validation payload
2019-12-15 22:07:55 -06:00
Alex Maslakov 28cd7a238e Add Webhook Support
Adds support for managing outgoing webhooks. Closes #1602
2019-12-15 20:27:21 -06:00
Jordan Wright 44f88401bb
Performance Improvements for Campaign and Group Creation (#1686)
This commit significantly improves the performance of campaign and group creation by changing database access to use transactions.

It should also make things more consistent with campaign creation. Specifically, this will ensure that the entire campaign gets created before emails start sending, while I anticipate this will fix #1643, #1080, (possibly) #1677, and #1552.
2019-12-02 23:00:11 -06:00
Michael Eder 1aab1a34ba 1624 - Return API Key on Password Change (#1663)
Updates the user model to return the user’s API key for easier administration.
2019-11-16 12:18:03 -06:00
SamSutt c5dc71662a Bugfix Issue 1570 (#1640)
Relating to the Issue (https://github.com/gophish/gophish/issues/1570), this could be an easy fix.
2019-10-29 08:21:54 -05:00
Christian Schwartz 26d99b5a65 Add support for encrypted connections to mysql (#1460) 2019-06-03 22:04:54 -05:00
Jordan Wright 84096b8724
Implement User Management API (#1473)
This implements the first pass for a user management API allowing users with the `ModifySystem` permission to create, modify, and delete users. In addition to this, any user is able to use the API to view or modify their own account information.
2019-05-31 13:58:18 -05:00
Chris Zietlow 8d95ceb31a Update Sending Profile Message-ID headers (#1417) (#1441)
Adds a default message-ID header to outbound emails.
2019-04-23 17:31:30 -05:00
gfrancqu af4c8f61da Wait for db (#1402)
Added a loop that attempts to connect to the configured database.
2019-03-27 22:48:31 -05:00
Jordan Wright ba8ceb81da
Initial commit of RBAC support. (#1366)
* Initial commit of RBAC support. Closes #1333
2019-02-19 20:33:50 -06:00
Jordan Wright 53b3a98521 Deleting maillogs when a campaign is completed to prevent accidental future emails from being sent. Fixes #719 2018-12-15 22:09:15 -06:00
Jordan Wright c14be36e05 Delete maillogs if a campaign is deleted. Fixes #1318 2018-12-15 21:47:40 -06:00
Jordan Wright a73ac4ab7c Fixed various minor linting issues 2018-12-15 21:38:51 -06:00
Jordan Wright 47f0049c30
Refactor servers (#1321)
* Refactoring servers to support custom workers and graceful shutdown.
* Refactoring workers to support custom mailers.
* Refactoring mailer to be an interface, with proper instances instead of a single global instance
* Cleaning up a few things. Locking maillogs for campaigns set to launch immediately to prevent a race condition.
* Cleaning up API middleware to be simpler
* Moving template parameters to separate struct
* Changed LoadConfig to return config object
* Cleaned up some error handling, removing uninitialized global error in models package
* Changed static file serving to use the unindexed package
2018-12-15 15:42:32 -06:00
Jordan Wright 7fd0657a91
Support Re-enabling CapturePasswords for Landing Pages (#1271)
Fixed a bug when marking the capture password, saving and unmarking the capture password, the attribute does not comeback and the password will never be captured again for this template.
2018-11-11 12:34:26 -06:00
Jordan Wright 326649b177 Updating redirect URL to support template values. Fixes #1235 2018-10-15 16:42:05 -05:00
Jordan Wright d6cbc1a936 Minor cleanup for campaign results 2018-10-08 10:49:21 -05:00
Jordan Wright 81da804761 Properly returning 404 error if the requested sending profile isn't found. 2018-10-07 12:37:15 -05:00
Jordan Wright f39014bbfc Moved template validation into separate function, and added validation for pages 2018-09-09 11:33:51 -05:00
Jordan Wright 0c5925aeec Fixed template validation to better support the all the possible template tags. Fixes #1189 2018-09-08 18:04:21 -05:00
Jordan Wright 15e57b6cd0 Add {{.BaseURL}} template tag to provide the root URL for static files. Fixes #1182 2018-09-03 20:28:32 -05:00
Jordan Wright 7dcf30f277
Add Support for Timed Campaigns (#1184)
This builds on the work from @c-f in #1090 to fully add support for "timed" campaigns, in which the emails are spaced apart as opposed to all being sent at once.
2018-09-02 11:17:52 -05:00
Jordan Wright 9f334281ab Added X-Mailer and X-Gophish-Contact headers (Ref: #1057) 2018-06-18 21:37:59 -05:00
Jordan Wright 1efb71d1e9 Added transparency handler to return information JSON when a "+" is appended to a valid result ID (ref #1057) 2018-06-09 20:58:05 -05:00
Jordan Wright ebb6cd61b2 Implemented the ability to preview landing pages when sending a test email. 2018-06-08 21:20:52 -05:00
Jordan Wright 420410b52c Refactored result updating to be in result.go.
Added the modified_date field to results so it's easy to keep track of the last results that were modified without having to parse every event. Updated the tests to reflect the changes.
2018-05-26 21:26:34 -05:00
Jordan Wright 5d23263898
Moved logging to logrus package. Not perfect yet (still want to update the access logs), but should set the foundation to make better logging in the future. 2018-05-03 19:07:41 -05:00
Jordan Wright f21536da7c
Adding "Report Email" Support (#1014)
Adds the capability to report phishing campaigns using an email client extension.

**Note: Gophish does not currently provide an email client extension out of the box. This is simply a mechanism to let existing email client add-ons send report status information to Gophish, and have that information reflected in the dashboard.**
2018-03-18 22:03:00 -05:00
Jordan Wright c9ff8714a0
Moved rid parameter to a separate constant. Fixes #911 2018-02-22 23:02:27 -06:00
Jordan Wright 3d58d8362e
Moved creation of URLs to net.URL instances to handle custom paths and parameters. Fixes #969 2018-02-22 22:11:28 -06:00
Konrads Smelkovs 29555085c0 If Subject is empty, don't set the header
Fixes #955
2018-02-10 13:46:08 -06:00
Jordan Wright 0f4ac70049
Fixed the way the initial admin is created to better support MySQL installations. Fixes #948 2018-02-08 19:04:59 -06:00
Shuhei Kitagawa 44afb2b965 Isolate model tests (#933)
* isolates Group model tests

* move SMTP related tests from models_test.go to smtp_test.go

* isolate Page model tests

* isolate Result model tests
2018-01-19 18:11:00 -06:00
Shuhei Kitagawa 55b0da4aa9 Separate user model test cases into a independent test file (#930) 2018-01-18 19:54:12 -06:00
Jordan Wright e995b0fcb7 Adding ability to use template variables in the campaign URL. Fixes #844 2018-01-13 17:49:42 -06:00
Shuhei Kitagawa 405bc5effe Refactor GetUserByUsername method not to suppress an error (#920)
Also adding some other tests for the User models.
2018-01-11 18:37:38 -06:00
Shuhei Kitagawa db19f0ac2a Remove redundant return nil statement in user.go (#921)
Removing some redundant statements in user.go.
Adding test cases for user models.
2018-01-11 18:11:57 -06:00
Jordan Wright 44154f3bf0 Removing duplicates in campaigns. Fixes #855 2017-12-11 22:12:17 -06:00
Jordan Wright 76ece15b71
Email refactoring (#878)
The initial pass at refactoring the way we send emails.
2017-12-09 15:42:07 -06:00
Jordan Wright e785af5c0a Disabled turboThreshold to allow campaign timeline renders for campaigns with > 1k events. Fixes #765
Moved datatables `draw()` functions to the end of a table render, rather than on every row
2017-09-26 21:29:15 -05:00