threat_agent 1.0.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE +23 -0
- data/README.md +23 -0
- data/Thorfile +33 -0
- data/bin/threatagent +36 -0
- data/lib/threat_agent/api_client.rb +53 -0
- data/lib/threat_agent/tasks/breachbot.rb +12 -0
- data/lib/threat_agent/tasks/drone.rb +12 -0
- data/lib/threat_agent/tasks/exfiltrate.rb +12 -0
- data/lib/threat_agent/tasks/passision.rb +12 -0
- data/lib/threat_agent/tasks/phishable.rb +12 -0
- data/lib/threat_agent/tasks/pwnxy.rb +29 -0
- data/lib/threat_agent/tasks.rb +14 -0
- data/lib/threat_agent/version.rb +4 -0
- data/lib/threat_agent.rb +8 -0
- data/spec/default_spec.rb +1 -0
- data/threat_agent.gemspec +29 -0
- metadata +183 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013 Erran Carey <e@threatagent.com>, Marcus Carey
|
2
|
+
<marcus@threatagent.com>
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# ThreatAgent [](http://travis-ci.org/threatagent/threatagent) [](https://gemnasium.com/threatagent/threatagent)
|
2
|
+
A gem to interface with the Threat Agent API.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Add this line to your application's Gemfile: `gem 'threatagent'` And then
|
6
|
+
execute: `bundle` Or install it yourself with: `gem install threatagent`
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
After installing the gem you can run `threatagent`
|
10
|
+
from the commandline to list available subcommands:
|
11
|
+
|
12
|
+
```
|
13
|
+
[ecarey @ ~]$ threatagent
|
14
|
+
Commands:
|
15
|
+
# TODO: Update me
|
16
|
+
```
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
1. Fork it
|
20
|
+
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
21
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
22
|
+
4. Push to the branch (`git push origin feature/my-new-feature`)
|
23
|
+
5. Create new Pull Request
|
data/Thorfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
require 'bundler'
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'thor/rake_compat'
|
7
|
+
require 'yard'
|
8
|
+
|
9
|
+
class Default < Thor
|
10
|
+
include Thor::RakeCompat
|
11
|
+
require 'bundler/gem_tasks'
|
12
|
+
|
13
|
+
desc 'build', "Build threat_agent-#{ThreatAgent::VERSION}.gem"
|
14
|
+
def build
|
15
|
+
Rake::Task['build'].execute
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'install', "Build and install threat_agent-#{ThreatAgent::VERSION}.gem into system gems"
|
19
|
+
def install
|
20
|
+
Rake::Task['install'].execute
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'release', "Create tag v#{ThreatAgent::VERSION} and build and push threat_agent-#{ThreatAgent::VERSION}.gem to Rubygems"
|
24
|
+
def release
|
25
|
+
Rake::Task['release'].execute
|
26
|
+
end
|
27
|
+
|
28
|
+
YARD::Rake::YardocTask.new
|
29
|
+
desc 'yard', 'Generate YARD Documentation'
|
30
|
+
def yard
|
31
|
+
Rake::Task['yard'].execute
|
32
|
+
end
|
33
|
+
end
|
data/bin/threatagent
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
# vi: set ft=ruby :
|
4
|
+
|
5
|
+
require 'threat_agent'
|
6
|
+
require 'threat_agent/tasks'
|
7
|
+
require 'thor'
|
8
|
+
|
9
|
+
class ThreatAgentCLI < Thor
|
10
|
+
desc 'breachbot [SUBCOMMAND]', 'Monitor website changes'
|
11
|
+
subcommand :breachbot, ThreatAgent::Tasks::Breachbot
|
12
|
+
|
13
|
+
desc 'drone [SUBCOMMAND]', 'Launch or review Drone security assessments'
|
14
|
+
subcommand :drone, ThreatAgent::Tasks::Drone
|
15
|
+
|
16
|
+
desc 'exfiltrate [SUBCOMMAND]', 'Determine if security devices detect sensitive data'
|
17
|
+
subcommand :exfiltrate, ThreatAgent::Tasks::Exfiltrate
|
18
|
+
|
19
|
+
desc 'passision [SUBCOMMAND]', 'Create a locale/organization aware wordlists'
|
20
|
+
subcommand :passision, ThreatAgent::Tasks::Passision
|
21
|
+
|
22
|
+
desc 'phishable [SUBCOMMAND]', 'Launch phishing campaigns'
|
23
|
+
subcommand :phishable, ThreatAgent::Tasks::Phishable
|
24
|
+
|
25
|
+
desc 'pwnxy [SUBCOMMAND]', 'Create a Pwnxy instance'
|
26
|
+
subcommand :pwnxy, ThreatAgent::Tasks::Pwnxy
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO: Is there a better way to globally define an API client?
|
30
|
+
# TODO: Support a threat_agent.yml configuration file
|
31
|
+
$threat_agent_client = ThreatAgent::APIClient.new(
|
32
|
+
ENV['THREAT_AGENT_KEY'],
|
33
|
+
ENV['THREAT_AGENT_SUP']
|
34
|
+
)
|
35
|
+
|
36
|
+
ThreatAgentCLI.start(ARGV)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
module ThreatAgent
|
5
|
+
# The API Client object handles most of the interactions with the ThreatAgent
|
6
|
+
# API
|
7
|
+
#
|
8
|
+
# @author Erran Carey <me@errancarey.com>
|
9
|
+
class APIClient
|
10
|
+
# Intializes the ThreatAgent::APIClient object
|
11
|
+
#
|
12
|
+
# @param [String] key the user's API key
|
13
|
+
# @param [String] sup the user's supplemental key
|
14
|
+
# @return [APIClient] the initialized ThreatAgent::APIClient object
|
15
|
+
def initialize(key, sup)
|
16
|
+
@key = key
|
17
|
+
@sup = sup
|
18
|
+
end
|
19
|
+
|
20
|
+
# Authenticates against threatagent.com
|
21
|
+
#
|
22
|
+
# @param [Hash] credentials credentials to attempt authentication with
|
23
|
+
# @option [String] key the user's API key
|
24
|
+
# @return [Boolean] whether the specified credentials where able to
|
25
|
+
# authenticate with the ThreatAgent API
|
26
|
+
def authenticate(credentials = {})
|
27
|
+
raise NotImplementedError
|
28
|
+
end
|
29
|
+
|
30
|
+
# Whether or not authentication was successful
|
31
|
+
#
|
32
|
+
# @return [Boolean] true if the ThreatAgent::APIClient has been
|
33
|
+
# authentication, false otherwise
|
34
|
+
def authenticated?
|
35
|
+
# @authenticated
|
36
|
+
raise NotImplementedError
|
37
|
+
end
|
38
|
+
|
39
|
+
# Send a request to the ThreatAgent API
|
40
|
+
#
|
41
|
+
# @param [String] action the type of request to send
|
42
|
+
# @param [Hash] params parameters to send along with the action to
|
43
|
+
# api.threatagent.com
|
44
|
+
def request(action, params = {})
|
45
|
+
params.merge!({ key: @key, sup: @sup })
|
46
|
+
action = action.to_s.gsub(/-|_/, '/')
|
47
|
+
encoded_params = URI.encode_www_form(params.keys.zip(params.values))
|
48
|
+
uri = URI("https://threatagent.com/api/v1/#{action}?#{encoded_params}")
|
49
|
+
resp = Net::HTTP.get_response(uri)
|
50
|
+
json = resp.body
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'threat_agent'
|
3
|
+
|
4
|
+
module ThreatAgent
|
5
|
+
module Tasks
|
6
|
+
# A namespace for Pwnxy Thor tasks
|
7
|
+
#
|
8
|
+
# @author Erran Carey <me@errancarey.com>
|
9
|
+
class Pwnxy < Thor
|
10
|
+
desc 'pwnxy info', 'List information on Pwnxy instances'
|
11
|
+
def info
|
12
|
+
info = $threat_agent_client.request(:pwnxy_info)
|
13
|
+
# TODO: Add a UI class/method.
|
14
|
+
$stdout.puts info
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'pwnxy logs [INSTANCE] [OPTIONS]', 'Show logs for a Pwnxy instance'
|
18
|
+
# TODO: Add logs(identifier = :last), add support in the TA API
|
19
|
+
# Support last/first in the TA API. Currently 0 returns first. Use
|
20
|
+
# -1 for last?
|
21
|
+
# TODO: Add support for dropping all logs?
|
22
|
+
def logs(identifier = 0)
|
23
|
+
log = $threat_agent_client.request(:pwnxy_logs, { p: identifier })
|
24
|
+
# TODO: Add a UI class/method.
|
25
|
+
$stdout.puts log
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'threat_agent/tasks/breachbot'
|
2
|
+
require 'threat_agent/tasks/drone'
|
3
|
+
require 'threat_agent/tasks/exfiltrate'
|
4
|
+
require 'threat_agent/tasks/passision'
|
5
|
+
require 'threat_agent/tasks/phishable'
|
6
|
+
require 'threat_agent/tasks/pwnxy'
|
7
|
+
|
8
|
+
module ThreatAgent
|
9
|
+
# A namespace for ThreatAgent Thor tasks, used in the threatagent executable
|
10
|
+
#
|
11
|
+
# @author Erran Carey <me@errancarey.com>
|
12
|
+
module Tasks
|
13
|
+
end
|
14
|
+
end
|
data/lib/threat_agent.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO: Implement tests
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$:.unshift(lib) unless $:.include?(lib)
|
4
|
+
require 'threat_agent/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'threat_agent'
|
8
|
+
spec.version = ThreatAgent::VERSION
|
9
|
+
spec.authors = ['Erran Carey']
|
10
|
+
spec.email = ['me@errancarey.com']
|
11
|
+
spec.description = %q{A gem to interface with the Threat Agent API}
|
12
|
+
spec.summary = %q{Interact with apps from the Threat Agent website}
|
13
|
+
spec.homepage = 'http://developer.threatagent.com'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'colorize'
|
22
|
+
spec.add_dependency 'redcarpet'
|
23
|
+
spec.add_dependency 'thor'
|
24
|
+
spec.add_dependency 'yard'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: threat_agent
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.beta.1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Erran Carey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: colorize
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: redcarpet
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.3'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.3'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: A gem to interface with the Threat Agent API
|
127
|
+
email:
|
128
|
+
- me@errancarey.com
|
129
|
+
executables:
|
130
|
+
- threatagent
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- .travis.yml
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE
|
138
|
+
- README.md
|
139
|
+
- Thorfile
|
140
|
+
- bin/threatagent
|
141
|
+
- lib/threat_agent.rb
|
142
|
+
- lib/threat_agent/api_client.rb
|
143
|
+
- lib/threat_agent/tasks.rb
|
144
|
+
- lib/threat_agent/tasks/breachbot.rb
|
145
|
+
- lib/threat_agent/tasks/drone.rb
|
146
|
+
- lib/threat_agent/tasks/exfiltrate.rb
|
147
|
+
- lib/threat_agent/tasks/passision.rb
|
148
|
+
- lib/threat_agent/tasks/phishable.rb
|
149
|
+
- lib/threat_agent/tasks/pwnxy.rb
|
150
|
+
- lib/threat_agent/version.rb
|
151
|
+
- spec/default_spec.rb
|
152
|
+
- threat_agent.gemspec
|
153
|
+
homepage: http://developer.threatagent.com
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
hash: -3825142359742865107
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>'
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 1.3.1
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 1.8.25
|
178
|
+
signing_key:
|
179
|
+
specification_version: 3
|
180
|
+
summary: Interact with apps from the Threat Agent website
|
181
|
+
test_files:
|
182
|
+
- spec/default_spec.rb
|
183
|
+
has_rdoc:
|