This is the unofficial Ruby wrapper for the GoPhish API. Documentation can be found here.
Add this line to your application's Gemfile:
gem 'gophish'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gophish
Configuration:
require 'gophish'
client = GoPhish::Client.new do |config|
config.url = <GOPHISH HOSTNAME/URL>
config.api_key = <API KEY>
end
Basic usage:
client.get_campaigns
client.get_campaign(<ID>)
client.get_groups
client.get_group(<ID>)
...
Object Creation:
cmpn = {
"name": 'Example Campaign',
"template": {
"name": 'Example Template'
},
"url": 'localhost',
"page": {
"name": 'example.com'
},
"smtp": {
"name": 'Example Sending Profile'
},
"launch_date": Time.now.strftime('%Y-%m-%dT%H:%m:00+00:00'),
"groups": [
{
"name": 'Example Group'
}
]
}
res = client.create_campaign(cmpn)
Bug reports and pull requests are welcome on GitHub at https://github.com/drewlong/gophish.
The gem is available as open source under the terms of the MIT License.