ronin 1.0.0.pre4 → 1.0.0.rc1

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.
Files changed (90) hide show
  1. data/.gemtest +0 -0
  2. data/ChangeLog.md +1 -0
  3. data/Gemfile +3 -1
  4. data/README.md +17 -19
  5. data/Rakefile +1 -0
  6. data/gemspec.yml +2 -1
  7. data/lib/ronin.rb +3 -0
  8. data/lib/ronin/address.rb +7 -3
  9. data/lib/ronin/arch.rb +2 -2
  10. data/lib/ronin/bootstrap.rb +3 -0
  11. data/lib/ronin/cached_file.rb +1 -1
  12. data/lib/ronin/campaign.rb +3 -32
  13. data/lib/ronin/class_methods.rb +17 -0
  14. data/lib/ronin/config.rb +25 -24
  15. data/lib/ronin/credential.rb +3 -0
  16. data/lib/ronin/database/migrations.rb +0 -1
  17. data/lib/ronin/database/migrations/create_credentials_table.rb +1 -2
  18. data/lib/ronin/database/migrations/graph.rb +6 -3
  19. data/lib/ronin/database/migrations/migration.rb +3 -0
  20. data/lib/ronin/database/migrations/migrations.rb +2 -2
  21. data/lib/ronin/email_address.rb +3 -0
  22. data/lib/ronin/engine/buildable.rb +3 -0
  23. data/lib/ronin/engine/class_methods.rb +3 -0
  24. data/lib/ronin/engine/deployable.rb +3 -0
  25. data/lib/ronin/engine/engine.rb +14 -0
  26. data/lib/ronin/engine/instance_methods.rb +3 -0
  27. data/lib/ronin/engine/verifiable.rb +3 -0
  28. data/lib/ronin/environment.rb +6 -0
  29. data/lib/ronin/host_name.rb +3 -0
  30. data/lib/ronin/host_name_ip_address.rb +3 -0
  31. data/lib/ronin/ip_address.rb +3 -0
  32. data/lib/ronin/ip_address_mac_address.rb +3 -0
  33. data/lib/ronin/license.rb +1 -1
  34. data/lib/ronin/mac_address.rb +3 -0
  35. data/lib/ronin/model/cacheable/cacheable.rb +1 -1
  36. data/lib/ronin/model/class_methods.rb +3 -0
  37. data/lib/ronin/model/has_authors/class_methods.rb +4 -0
  38. data/lib/ronin/model/has_authors/has_authors.rb +9 -5
  39. data/lib/ronin/model/has_description/class_methods.rb +4 -0
  40. data/lib/ronin/model/has_description/has_description.rb +6 -0
  41. data/lib/ronin/model/has_license/class_methods.rb +4 -0
  42. data/lib/ronin/model/has_license/has_license.rb +9 -5
  43. data/lib/ronin/model/has_name/class_methods.rb +4 -0
  44. data/lib/ronin/model/has_name/has_name.rb +6 -0
  45. data/lib/ronin/model/has_title/class_methods.rb +4 -0
  46. data/lib/ronin/model/has_title/has_title.rb +6 -0
  47. data/lib/ronin/model/has_unique_name.rb +7 -0
  48. data/lib/ronin/model/has_version/class_methods.rb +4 -0
  49. data/lib/ronin/model/has_version/has_version.rb +6 -0
  50. data/lib/ronin/model/model.rb +7 -0
  51. data/lib/ronin/model/types/description.rb +7 -2
  52. data/lib/ronin/open_port.rb +3 -0
  53. data/lib/ronin/organization.rb +3 -0
  54. data/lib/ronin/os.rb +2 -2
  55. data/lib/ronin/os_guess.rb +3 -0
  56. data/lib/ronin/password.rb +4 -1
  57. data/lib/ronin/port.rb +6 -1
  58. data/lib/ronin/ronin.rb +8 -0
  59. data/lib/ronin/service.rb +3 -0
  60. data/lib/ronin/service_credential.rb +3 -0
  61. data/lib/ronin/target.rb +3 -4
  62. data/lib/ronin/tcp_port.rb +4 -1
  63. data/lib/ronin/udp_port.rb +4 -1
  64. data/lib/ronin/ui/cli/cli.rb +1 -1
  65. data/lib/ronin/ui/cli/command.rb +6 -0
  66. data/lib/ronin/ui/cli/commands/repos.rb +33 -0
  67. data/lib/ronin/ui/cli/engine_command.rb +3 -0
  68. data/lib/ronin/ui/cli/model_command.rb +3 -0
  69. data/lib/ronin/ui/console.rb +5 -1
  70. data/lib/ronin/ui/hexdump/hexdump.rb +3 -0
  71. data/lib/ronin/ui/output/helpers.rb +59 -26
  72. data/lib/ronin/ui/output/output.rb +3 -0
  73. data/lib/ronin/ui/output/terminal/color.rb +32 -20
  74. data/lib/ronin/ui/output/terminal/raw.rb +23 -20
  75. data/lib/ronin/ui/shell.rb +3 -0
  76. data/lib/ronin/url.rb +8 -5
  77. data/lib/ronin/url_query_param.rb +3 -0
  78. data/lib/ronin/url_scheme.rb +3 -0
  79. data/lib/ronin/user_name.rb +4 -1
  80. data/lib/ronin/vendor.rb +1 -1
  81. data/lib/ronin/version.rb +1 -1
  82. data/lib/ronin/web_credential.rb +4 -1
  83. data/ronin.gemspec +7 -2
  84. data/spec/campaign_spec.rb +0 -25
  85. data/spec/url_spec.rb +5 -2
  86. metadata +48 -36
  87. data/lib/ronin/database/migrations/create_remote_files_table.rb +0 -52
  88. data/lib/ronin/proxy.rb +0 -178
  89. data/lib/ronin/proxy_credential.rb +0 -29
  90. data/lib/ronin/remote_file.rb +0 -152
data/.gemtest ADDED
File without changes
data/ChangeLog.md CHANGED
@@ -22,6 +22,7 @@
22
22
  * Require parameters ~> 0.2.3.
23
23
  * Require data_paths ~> 0.2.1.
24
24
  * Require contextify ~> 0.2.0.
25
+ * Require env ~> 0.1.2.
25
26
  * Require pullr ~> 0.1.2.
26
27
  * Require thor ~> 0.14.3.
27
28
  * Require ripl ~> 0.3.0.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ require 'ore/specification'
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  DATA_MAPPER = 'http://github.com/datamapper'
@@ -12,7 +14,7 @@ gemspec
12
14
  group :development do
13
15
  gem 'rake', '~> 0.8.7'
14
16
 
15
- gem 'ore-core', '~> 0.1.0'
17
+ gem 'ore-core', '~> 0.1.1'
16
18
  gem 'ore-tasks', '~> 0.3.0'
17
19
  gem 'rspec', '~> 2.3.0'
18
20
 
data/README.md CHANGED
@@ -13,26 +13,24 @@ Ronin is a Ruby platform for exploit development and security research.
13
13
  Ronin allows for the rapid development and distribution of code, exploits
14
14
  or payloads over many common Source-Code-Management (SCM) systems.
15
15
 
16
- ### Ruby
16
+ ### Hack with Ruby
17
17
 
18
- Ronin's Ruby environment allows security researchers to leverage Ruby with
19
- ease. The Ruby environment contains a multitude of convenience methods
20
- for working with data in Ruby, a Ruby Object Database, a customized Ruby
21
- Console and an extendable command-line interface.
18
+ Ronin combines the flexibility of Ruby with countless convenience methods
19
+ and libraries, to make Ruby usable for Offensive Security or Research work.
22
20
 
23
- ### Extend
21
+ ### Organize Your Data
24
22
 
25
- Ronin's more specialized features are provided by additional Ronin
26
- libraries, which users can choose to install. These libraries can allow
27
- one to write and run Exploits and Payloads, scan for PHP vulnerabilities,
28
- perform Google Dorks or run 3rd party scanners.
23
+ Ronin comes with a Database designed for Security data and accessible from
24
+ Ruby using [DataMapper](http://datamapper.org). With Ronin, storing or
25
+ querying IP addresses, Hosts, Ports, URLs, Passwords is as simple as a
26
+ single line of Ruby.
29
27
 
30
- ### Publish
28
+ ### Share Code
31
29
 
32
- Ronin allows users to publish and share code, exploits, payloads or other
33
- data via Ronin Repositories. Repositories are directories of code and data
34
- that can be hosted on any SVN, Hg, Git or Rsync server. Ronin makes it easy
35
- to create, install and update Repositories.
30
+ Ronin allows sharing code with the community, or just your friends, via
31
+ Ronin Repositories. Ronin Repositories are like lazier versions of
32
+ [RubyGems](http://rubygems.org/), that can be hosted with SubVersion,
33
+ Mercurial or Git.
36
34
 
37
35
  ## Features
38
36
 
@@ -42,8 +40,7 @@ to create, install and update Repositories.
42
40
  * [Mercurial (Hg)](http://mercurial.selenic.com/)
43
41
  * [Git](http://git-scm.com/)
44
42
  * Rsync
45
- * Provides Object Database using [DataMapper](http://datamapper.org)
46
- with:
43
+ * Provides a Database using [DataMapper](http://datamapper.org) with:
47
44
  * {Ronin::Author}
48
45
  * {Ronin::License}
49
46
  * {Ronin::Arch}
@@ -79,7 +76,7 @@ to create, install and update Repositories.
79
76
  * Pretty-Print loaded.
80
77
  * `print_info`, `print_error`, `print_warning` and `print_debug`
81
78
  output helper methods with color-output.
82
- * Provides an extendable command-line interface based on
79
+ * Provides an extensible command-line interface based on
83
80
  [Thor](http://github.com/wycats/thor#readme).
84
81
 
85
82
  ## Synopsis
@@ -151,6 +148,7 @@ Remove a Database:
151
148
  * [parameters](http://github.com/postmodern/parameters) ~> 0.2.2
152
149
  * [data_paths](http://github.com/postmodern/data_paths) ~> 0.2.1
153
150
  * [contextify](http://github.com/postmodern/contextify/) ~> 0.1.6
151
+ * [env](http://github.com/postmodern/env) ~> 0.1.2
154
152
  * [pullr](http://github.com/postmodern/pullr/) ~> 0.1.2
155
153
  * [thor](http://github.com/wycats/thor/) ~> 0.14.2
156
154
  * [ronin-support](http://github.com/ronin-ruby/ronin-support/) ~> 0.1.0
@@ -187,7 +185,7 @@ for Ronin that provides various generators.
187
185
  ### Ronin SQL
188
186
 
189
187
  [Ronin SQL](http://github.com/ronin-ruby/ronin-sql#readme) is a Ruby library
190
- for Ronin that provids support for SQL related security tasks, such as
188
+ for Ronin that provides support for SQL related security tasks, such as
191
189
  scanning for and exploiting SQL injections.
192
190
 
193
191
  ### Ronin PHP
data/Rakefile CHANGED
@@ -23,6 +23,7 @@ Ore::Tasks.new
23
23
 
24
24
  require 'rspec/core/rake_task'
25
25
  RSpec::Core::RakeTask.new
26
+ task :test => :spec
26
27
  task :default => :spec
27
28
 
28
29
  require 'dm-visualizer/rake/graphviz_task'
data/gemspec.yml CHANGED
@@ -59,6 +59,7 @@ dependencies:
59
59
  parameters: ~> 0.2.3
60
60
  data_paths: ~> 0.2.1
61
61
  contextify: ~> 0.2.0
62
+ env: ~> 0.1.2
62
63
  pullr: ~> 0.1.2
63
64
  thor: ~> 0.14.3
64
65
  ripl: ~> 0.3.0
@@ -67,7 +68,7 @@ dependencies:
67
68
  ripl-short_errors: ~> 0.1.0
68
69
  ripl-color_result: ~> 0.2.0
69
70
  # Ronin dependencies:
70
- ronin-support: ~> 0.1.0.pre3
71
+ ronin-support: ~> 0.1.0.rc1
71
72
 
72
73
  development_dependencies:
73
74
  bundler: ~> 1.0.0
data/lib/ronin.rb CHANGED
@@ -17,6 +17,9 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
+ #
21
+ # Loads up the full Ronin environment.
22
+ #
20
23
  require 'ronin/bootstrap'
21
24
  require 'ronin/environment'
22
25
  require 'ronin/version'
data/lib/ronin/address.rb CHANGED
@@ -25,6 +25,13 @@ require 'dm-timestamps'
25
25
  require 'dm-tags'
26
26
 
27
27
  module Ronin
28
+ #
29
+ # A base model which represents an Internet Address, such as:
30
+ #
31
+ # * {MACAddress}
32
+ # * {IPAddress}
33
+ # * {HostName}
34
+ #
28
35
  class Address
29
36
 
30
37
  include Model
@@ -45,9 +52,6 @@ module Ronin
45
52
  # The targets associated with the address
46
53
  has 0..n, :targets
47
54
 
48
- # The remote files associated with the address
49
- has 0..n, :remote_files, :through => :targets
50
-
51
55
  # The campaigns targeting the address
52
56
  has 0..n, :campaigns, :through => :targets
53
57
 
data/lib/ronin/arch.rb CHANGED
@@ -66,7 +66,7 @@ module Ronin
66
66
  end
67
67
 
68
68
  #
69
- # Defines a new builtin Arch.
69
+ # Defines a new predefined Arch.
70
70
  #
71
71
  # @param [Symbol, String] name
72
72
  # The name of the architecture.
@@ -80,7 +80,7 @@ module Ronin
80
80
  # @option options [Integer] :address_length
81
81
  # The address-length of the architecture.
82
82
  #
83
- # @example Defining a builtin Arch
83
+ # @example Defining a predefined Arch
84
84
  # Arch.predefine :alpha, :endian => :big, :address_length => 8
85
85
  #
86
86
  # @example Retrieving a predefined Arch
@@ -17,6 +17,9 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
+ #
21
+ # Loads the Ronin configuration and sets up the Database.
22
+ #
20
23
  require 'ronin/config'
21
24
  require 'ronin/database'
22
25
 
@@ -58,7 +58,7 @@ module Ronin
58
58
  # The path to require to access the Class of the cached object.
59
59
  #
60
60
  # @return [String]
61
- # The possible path infered from the class name.
61
+ # The possible path inferred from the class name.
62
62
  #
63
63
  def model_path
64
64
  if self.model_name
@@ -20,12 +20,12 @@
20
20
  require 'ronin/model'
21
21
  require 'ronin/model/has_unique_name'
22
22
  require 'ronin/model/has_description'
23
- require 'ronin/config'
24
23
  require 'ronin/target'
25
24
 
26
- require 'fileutils'
27
-
28
25
  module Ronin
26
+ #
27
+ # Represents a grouping of targeted {Address}es.
28
+ #
29
29
  class Campaign
30
30
 
31
31
  include Model
@@ -111,34 +111,5 @@ module Ronin
111
111
  return Target.first_or_create(:campaign => self, :address => address)
112
112
  end
113
113
 
114
- #
115
- # The file-name to use for the campaign.
116
- #
117
- # @return [String, nil]
118
- # The File System safe name to use for the campaign.
119
- #
120
- # @since 1.0.0
121
- #
122
- def filename
123
- self.name.downcase.gsub(/[^a-z0-9]+/,'_') if self.name
124
- end
125
-
126
- #
127
- # The directory to store files related to the campaign.
128
- #
129
- # @return [String, nil]
130
- # The path to the directory.
131
- #
132
- # @since 1.0.0
133
- #
134
- def directory
135
- if self.name
136
- path = File.join(Config::CAMPAIGNS_DIR,filename)
137
-
138
- FileUtils.mkdir(path) unless File.directory?(path)
139
- return path
140
- end
141
- end
142
-
143
114
  end
144
115
  end
@@ -18,7 +18,24 @@
18
18
  #
19
19
 
20
20
  module Ronin
21
+ #
22
+ # Class methods that are included when {Ronin} is included.
23
+ #
21
24
  module ClassMethods
25
+ #
26
+ # Catches missing constants and searches the {Ronin} namespace.
27
+ #
28
+ # @param [Symbol] name
29
+ # The constant name.
30
+ #
31
+ # @return [Object]
32
+ # The found constant.
33
+ #
34
+ # @raise [NameError]
35
+ # The constant could not be found within {Ronin}.
36
+ #
37
+ # @since 1.0.0
38
+ #
22
39
  def const_missing(name)
23
40
  Ronin.send(:const_missing,name) || super(name)
24
41
  end
data/lib/ronin/config.rb CHANGED
@@ -17,54 +17,58 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
+ require 'env'
20
21
  require 'data_paths'
21
22
  require 'fileutils'
22
23
 
23
24
  module Ronin
25
+ #
26
+ # Configuration information for Ronin.
27
+ #
24
28
  module Config
25
29
  include DataPaths
26
30
 
27
31
  # The users home directory
28
- HOME = File.expand_path(ENV['HOME'] || ENV['HOMEPATH'])
32
+ HOME = Env.home
29
33
 
30
34
  # Ronin home directory
31
- PATH = File.join(HOME,'.ronin')
35
+ PATH = HOME.join('.ronin')
32
36
 
33
37
  # Configuration files directory
34
- CONFIG_DIR = File.join(PATH,'config')
38
+ CONFIG_DIR = PATH.join('config')
35
39
 
36
40
  # Directory which repositories are installed into
37
- REPOS_DIR = File.join(PATH,'repos')
41
+ REPOS_DIR = PATH.join('repos')
38
42
 
39
43
  # Temporary file directory
40
- TMP_DIR = File.join(PATH,'tmp')
44
+ TMP_DIR = PATH.join('tmp')
41
45
 
42
- # Directory for storing files for campaigns
43
- CAMPAIGNS_DIR = File.join(PATH,'campaigns')
44
-
45
- FileUtils.mkdir(PATH) unless File.directory?(PATH)
46
- FileUtils.mkdir(CONFIG_DIR) unless File.directory?(PATH)
47
- FileUtils.mkdir(TMP_DIR) unless File.directory?(TMP_DIR)
48
- FileUtils.mkdir(CAMPAIGNS_DIR) unless File.directory?(CAMPAIGNS_DIR)
46
+ PATH.mkdir unless PATH.directory?
47
+ CONFIG_DIR.mkdir unless PATH.directory?
48
+ TMP_DIR.mkdir unless TMP_DIR.directory?
49
49
 
50
50
  #
51
51
  # Loads the Ronin configuration file.
52
52
  #
53
53
  # @param [Symbol, String, nil] name
54
- # The optional name of the file to load within +CONFIG_DIR+.
54
+ # The optional name of the file to load within {CONFIG_DIR}.
55
55
  #
56
- # @example Load the config file at `~/.ronin/config/ronin.rb`
56
+ # @example Load the config file at `~/.ronin/config.rb`
57
57
  # Config.load
58
58
  # # => true
59
59
  #
60
- # @example Load a specific config file in `~/.ronin/config/`
60
+ # @example Load the config file at `~/.ronin/config/sql.rb`
61
61
  # Config.load :sql
62
62
  # # => true
63
63
  #
64
- def Config.load(name=:ronin)
65
- path = File.expand_path(File.join(CONFIG_DIR,name.to_s))
64
+ def Config.load(name=nil)
65
+ path = if name
66
+ CONFIG_DIR.join("#{name}.rb").expand_path
67
+ else
68
+ PATH.join('config.rb')
69
+ end
66
70
 
67
- require path if File.file?(path)
71
+ require path if path.file?
68
72
  end
69
73
 
70
74
  #
@@ -73,18 +77,15 @@ module Ronin
73
77
  # @param [String] sub_path
74
78
  # The sub-path within {TMP_DIR}.
75
79
  #
76
- # @return [String]
80
+ # @return [Pathname]
77
81
  # The full path within {TMP_DIR}.
78
82
  #
79
83
  def Config.tmp_dir(sub_path=nil)
80
84
  if sub_path
81
85
  sub_path = File.expand_path(File.join('',sub_path))
82
- path = File.join(TMP_DIR,sub_path)
83
-
84
- unless File.exist?(path)
85
- FileUtils.mkdir_p(path)
86
- end
86
+ path = TMP_DIR.join(sub_path)
87
87
 
88
+ path.mkpath unless path.exist?
88
89
  return path
89
90
  end
90
91
 
@@ -22,6 +22,9 @@ require 'ronin/password'
22
22
  require 'ronin/model'
23
23
 
24
24
  module Ronin
25
+ #
26
+ # Represents Credentials used to access services or websites.
27
+ #
25
28
  class Credential
26
29
 
27
30
  include Model
@@ -45,7 +45,6 @@ require 'ronin/database/migrations/create_countries_table'
45
45
  require 'ronin/database/migrations/create_organizations_table'
46
46
  require 'ronin/database/migrations/create_campaigns_table'
47
47
  require 'ronin/database/migrations/create_targets_table'
48
- require 'ronin/database/migrations/create_remote_files_table'
49
48
  require 'ronin/database/migrations/create_cached_files_table'
50
49
  require 'ronin/database/migrations/create_repositories_table'
51
50
 
@@ -46,12 +46,11 @@ module Ronin
46
46
  column :open_port_id, Integer
47
47
  column :email_address_id, Integer
48
48
  column :url_id, Integer
49
- column :proxy_id, Integer
50
49
  end
51
50
 
52
51
  create_index :ronin_credentials,
53
52
  :user_name_id, :password_id,
54
- :open_port_id, :email_address_id, :url_id, :proxy_id,
53
+ :open_port_id, :email_address_id, :url_id,
55
54
  :name => :unique_index_ronin_credentials,
56
55
  :unique => true
57
56
  end
@@ -27,6 +27,9 @@ require 'tsort'
27
27
  module Ronin
28
28
  module Database
29
29
  module Migrations
30
+ #
31
+ # Sorts and runs {Migration}s based on their dependencies.
32
+ #
30
33
  class Graph
31
34
 
32
35
  include Enumerable
@@ -171,7 +174,7 @@ module Ronin
171
174
  end
172
175
 
173
176
  if position > 1
174
- # explicit define a dependencey on the previous migration position
177
+ # explicit define a dependency on the previous migration position
175
178
  options[:needs] = [position - 1]
176
179
  end
177
180
 
@@ -202,7 +205,7 @@ module Ronin
202
205
  # If no block is given, an enumerator object will be returned.
203
206
  #
204
207
  # @raise [UnknownMigration]
205
- # A migration had a dependencey on an unknown migration.
208
+ # A migration had a dependency on an unknown migration.
206
209
  #
207
210
  # @since 1.0.1
208
211
  #
@@ -240,7 +243,7 @@ module Ronin
240
243
  # If no block is given, an enumerator object will be returned.
241
244
  #
242
245
  # @raise [UnknownMigration]
243
- # A migration had a dependencey on an unknown migration.
246
+ # A migration had a dependency on an unknown migration.
244
247
  #
245
248
  # @since 1.0.1
246
249
  #