ronin 1.0.0.rc1 → 1.0.0.rc2

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 (76) hide show
  1. data/ChangeLog.md +24 -26
  2. data/Gemfile +24 -12
  3. data/README.md +39 -22
  4. data/Rakefile +2 -4
  5. data/gemspec.yml +27 -30
  6. data/lib/ronin/address.rb +3 -6
  7. data/lib/ronin/cached_file.rb +4 -3
  8. data/lib/ronin/campaign.rb +2 -1
  9. data/lib/ronin/credential.rb +3 -2
  10. data/lib/ronin/database/database.rb +3 -0
  11. data/lib/ronin/database/migrations/create_addresses_table.rb +1 -3
  12. data/lib/ronin/database/migrations/create_open_ports_table.rb +0 -3
  13. data/lib/ronin/database/migrations/create_organizations_table.rb +1 -6
  14. data/lib/ronin/database/migrations/create_urls_table.rb +1 -4
  15. data/lib/ronin/database/migrations.rb +0 -2
  16. data/lib/ronin/email_address.rb +5 -3
  17. data/lib/ronin/environment.rb +1 -1
  18. data/lib/ronin/host_name.rb +4 -3
  19. data/lib/ronin/host_name_ip_address.rb +3 -2
  20. data/lib/ronin/ip_address.rb +5 -4
  21. data/lib/ronin/ip_address_mac_address.rb +3 -2
  22. data/lib/ronin/mac_address.rb +3 -1
  23. data/lib/ronin/model/has_authors/class_methods.rb +2 -2
  24. data/lib/ronin/model/has_authors/has_authors.rb +1 -1
  25. data/lib/ronin/model/has_license/class_methods.rb +22 -5
  26. data/lib/ronin/{database/migrations/create_tags_table.rb → model/has_unique_name/class_methods.rb} +20 -15
  27. data/lib/ronin/model/has_unique_name/has_unique_name.rb +72 -0
  28. data/lib/ronin/model/has_unique_name.rb +2 -51
  29. data/lib/ronin/model/model.rb +1 -1
  30. data/lib/ronin/open_port.rb +5 -8
  31. data/lib/ronin/organization.rb +2 -5
  32. data/lib/ronin/os.rb +3 -2
  33. data/lib/ronin/os_guess.rb +3 -2
  34. data/lib/ronin/password.rb +2 -1
  35. data/lib/ronin/port.rb +2 -1
  36. data/lib/ronin/repository.rb +2 -1
  37. data/lib/ronin/service.rb +2 -1
  38. data/lib/ronin/service_credential.rb +2 -1
  39. data/lib/ronin/software.rb +2 -1
  40. data/lib/ronin/spec/database.rb +4 -0
  41. data/lib/ronin/target.rb +3 -2
  42. data/lib/ronin/tcp_port.rb +4 -2
  43. data/lib/ronin/ui/cli/cli.rb +2 -3
  44. data/lib/ronin/ui/cli/command.rb +48 -16
  45. data/lib/ronin/ui.rb +0 -1
  46. data/lib/ronin/url.rb +9 -10
  47. data/lib/ronin/url_scheme.rb +15 -1
  48. data/lib/ronin/version.rb +1 -1
  49. data/lib/ronin/web_credential.rb +3 -2
  50. data/ronin.gemspec +2 -2
  51. data/spec/model/cacheable_spec.rb +9 -6
  52. data/spec/model/has_authors_spec.rb +60 -0
  53. data/spec/model/has_description_spec.rb +8 -6
  54. data/spec/model/has_license_spec.rb +31 -12
  55. data/spec/model/has_name_spec.rb +12 -10
  56. data/spec/model/has_title_spec.rb +8 -6
  57. data/spec/model/has_version_spec.rb +58 -0
  58. data/spec/model/model_spec.rb +1 -3
  59. data/spec/model/models/authored_model.rb +11 -0
  60. data/spec/model/models/described_model.rb +0 -1
  61. data/spec/model/models/licensed_model.rb +0 -1
  62. data/spec/model/models/named_model.rb +0 -1
  63. data/spec/model/models/titled_model.rb +0 -1
  64. data/spec/model/models/versioned_model.rb +11 -0
  65. data/spec/model/spec_helper.rb +2 -2
  66. data/spec/ui/cli/classes/test_command.rb +7 -1
  67. data/spec/ui/cli/command_spec.rb +6 -0
  68. metadata +94 -267
  69. data/lib/ronin/database/migrations/create_taggings_table.rb +0 -45
  70. data/lib/ronin/ui/hexdump/extensions/file.rb +0 -39
  71. data/lib/ronin/ui/hexdump/extensions/kernel.rb +0 -31
  72. data/lib/ronin/ui/hexdump/extensions.rb +0 -21
  73. data/lib/ronin/ui/hexdump/hexdump.rb +0 -92
  74. data/lib/ronin/ui/hexdump.rb +0 -21
  75. data/spec/model/models/lazy_model.rb +0 -9
  76. data/spec/support/inflector_spec.rb +0 -20
@@ -35,7 +35,7 @@ module Ronin
35
35
  # The resources written by the author.
36
36
  #
37
37
  def written_by(name)
38
- all(:authors => {:name.like => "%#{name}%"})
38
+ all('authors.name.like' => "%#{name}%")
39
39
  end
40
40
 
41
41
  #
@@ -48,7 +48,7 @@ module Ronin
48
48
  # The resources associated with the organization.
49
49
  #
50
50
  def written_for(name)
51
- all(:authors => {:organization.like => "%#{name}%"})
51
+ all('authors.organization.like' => "%#{name}%")
52
52
  end
53
53
  end
54
54
  end
@@ -58,7 +58,7 @@ module Ronin
58
58
  # :email => 'anon@example.com',
59
59
  # :organization => 'Anonymous LLC'
60
60
  #
61
- def author(attributes={})
61
+ def author(attributes)
62
62
  self.authors.new(attributes)
63
63
  end
64
64
  end
@@ -28,20 +28,37 @@ module Ronin
28
28
  #
29
29
  # Finds all models associated with a given license.
30
30
  #
31
- # @param [Symbol, String] name
32
- # The name of the license which models are associated with.
31
+ # @param [License, Symbol, String] license
32
+ # The license which models are associated with.
33
33
  #
34
34
  # @return [Array<Model>]
35
35
  # The models associated with a given license.
36
36
  #
37
- # @example
37
+ # @example Query using a predefined {License} resource.
38
+ # LicensedModel.licensed_under(License.mit)
39
+ # # => [#<Ronin::LicensedModel: ...>, ...]
40
+ #
41
+ # @example Query using the name of a predefined {License}.
38
42
  # LicensedModel.licensed_under(:cc_by_nc)
39
43
  # # => [#<Ronin::LicensedModel: ...>, ...]
40
44
  #
45
+ # @example Query using the name of a {License}.
46
+ # LicensedModel.licensed_under('GPL-2')
47
+ # # => [#<Ronin::LicensedModel: ...>, ...]
48
+ #
41
49
  # @since 1.0.0
42
50
  #
43
- def licensed_under(name)
44
- all(:license => {:name => name.to_s})
51
+ def licensed_under(license)
52
+ license = case license
53
+ when License
54
+ license
55
+ when Symbol
56
+ License.predefined_resource(license)
57
+ else
58
+ {:name => license.to_s}
59
+ end
60
+
61
+ all(:license => license)
45
62
  end
46
63
  end
47
64
  end
@@ -17,23 +17,28 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/database/migrations/migrations'
21
-
22
20
  module Ronin
23
- module Database
24
- module Migrations
25
- migration(:create_tags_table) do
26
- up do
27
- create_table :tags do
28
- column :id, Integer, :serial => true
29
- column :name, String, :not_null => true
21
+ module Model
22
+ module HasUniqueName
23
+ module ClassMethods
24
+ #
25
+ # Searches for models with the unique name.
26
+ #
27
+ # @param [String, Symbol, Integer] key
28
+ # The unique name or index to search for.
29
+ #
30
+ # @return [Model, nil]
31
+ # The matching model.
32
+ #
33
+ # @since 1.0.0
34
+ #
35
+ def [](key)
36
+ case key
37
+ when String, Symbol
38
+ first(:name => key.to_s)
39
+ else
40
+ super(key)
30
41
  end
31
-
32
- create_index :tags, :name, :unique => true
33
- end
34
-
35
- down do
36
- drop_table :tags
37
42
  end
38
43
  end
39
44
  end
@@ -0,0 +1,72 @@
1
+ #
2
+ # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ #
4
+ # This file is part of Ronin.
5
+ #
6
+ # Ronin is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Ronin is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ require 'ronin/model/has_unique_name/class_methods'
21
+ require 'ronin/model/has_name/class_methods'
22
+
23
+ module Ronin
24
+ module Model
25
+ #
26
+ # Adds a unique `name` property to a model.
27
+ #
28
+ module HasUniqueName
29
+ #
30
+ # Adds the unique `name` property and {HasName::ClassMethods} to the
31
+ # model.
32
+ #
33
+ # @param [Class] base
34
+ # The model.
35
+ #
36
+ def self.included(base)
37
+ base.send :include, Model
38
+ base.send :extend, HasName::ClassMethods,
39
+ HasUniqueName::ClassMethods
40
+
41
+ base.module_eval do
42
+ # The name of the model
43
+ property :name, String, :required => true, :unique => true
44
+ end
45
+ end
46
+
47
+ #
48
+ # Converts the named resource into a String.
49
+ #
50
+ # @return [String]
51
+ # The name of the resource.
52
+ #
53
+ # @since 1.0.0
54
+ #
55
+ def to_s
56
+ self.name.to_s
57
+ end
58
+
59
+ #
60
+ # Inspects the resource with the unique name.
61
+ #
62
+ # @return [String]
63
+ # The inspected resource.
64
+ #
65
+ # @since 1.0.0
66
+ #
67
+ def inspect
68
+ "#<#{self.class}:#{self.name}>"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -17,54 +17,5 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/model/has_name/class_methods'
21
-
22
- module Ronin
23
- module Model
24
- #
25
- # Adds a unique `name` property to a model.
26
- #
27
- module HasUniqueName
28
- #
29
- # Adds the unique `name` property and {HasName::ClassMethods} to the
30
- # model.
31
- #
32
- # @param [Class] base
33
- # The model.
34
- #
35
- def self.included(base)
36
- base.send :include, Model
37
- base.send :extend, HasName::ClassMethods
38
-
39
- base.module_eval do
40
- # The name of the model
41
- property :name, String, :required => true, :unique => true
42
- end
43
- end
44
-
45
- #
46
- # Converts the named resource into a String.
47
- #
48
- # @return [String]
49
- # The name of the resource.
50
- #
51
- # @since 1.0.0
52
- #
53
- def to_s
54
- self.name.to_s
55
- end
56
-
57
- #
58
- # Inspects the resource with the unique name.
59
- #
60
- # @return [String]
61
- # The inspected resource.
62
- #
63
- # @since 1.0.0
64
- #
65
- def inspect
66
- "#<#{self.class}:#{self.name}>"
67
- end
68
- end
69
- end
70
- end
20
+ require 'ronin/model/has_unique_name/class_methods'
21
+ require 'ronin/model/has_unique_name/has_unique_name'
@@ -44,7 +44,7 @@ module Ronin
44
44
  # The class that will be setup as a DataMapper model.
45
45
  #
46
46
  def self.included(base)
47
- unless base.ancestors.include?(DataMapper::Resource)
47
+ unless base < DataMapper::Resource
48
48
  base.send :include, DataMapper::Resource
49
49
  end
50
50
 
@@ -17,16 +17,16 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/service_credential'
21
- require 'ronin/port'
22
- require 'ronin/service'
23
- require 'ronin/ip_address'
24
20
  require 'ronin/model'
25
21
 
26
22
  require 'dm-timestamps'
27
- require 'dm-tags'
28
23
 
29
24
  module Ronin
25
+ autoload :ServiceCredential, 'ronin/service_credential'
26
+ autoload :Port, 'ronin/port'
27
+ autoload :Service, 'ronin/service'
28
+ autoload :IPAddress, 'ronin/ip_address'
29
+
30
30
  #
31
31
  # Represents a open port at a specified IP address.
32
32
  #
@@ -56,9 +56,6 @@ module Ronin
56
56
  # Define the created_at timestamp
57
57
  timestamps :created_at
58
58
 
59
- # Tags
60
- has_tags_on :tags
61
-
62
59
  #
63
60
  # The IP Address of the open port.
64
61
  #
@@ -17,15 +17,15 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/address'
21
20
  require 'ronin/model'
22
21
  require 'ronin/model/has_unique_name'
23
22
  require 'ronin/model/has_description'
24
23
 
25
24
  require 'dm-timestamps'
26
- require 'dm-tags'
27
25
 
28
26
  module Ronin
27
+ autoload :Address, 'ronin/address'
28
+
29
29
  #
30
30
  # Represents an Organization which owns {Address}es.
31
31
  #
@@ -44,8 +44,5 @@ module Ronin
44
44
  # Tracks when the organization was first created
45
45
  timestamps :created_at
46
46
 
47
- # Tags
48
- has_tags_on :tags
49
-
50
47
  end
51
48
  end
data/lib/ronin/os.rb CHANGED
@@ -19,11 +19,12 @@
19
19
 
20
20
  require 'ronin/model'
21
21
  require 'ronin/model/has_name'
22
- require 'ronin/os_guess'
23
- require 'ronin/ip_address'
24
22
  require 'ronin/extensions/meta'
25
23
 
26
24
  module Ronin
25
+ autoload :OSGuess, 'ronin/os_guess'
26
+ autoload :IPAddress, 'ronin/ip_address'
27
+
27
28
  #
28
29
  # Represents an Operating System and pre-defines other common ones
29
30
  # ({linux}, {freebsd}, {openbsd}, {netbsd}, {osx}, {solaris}, {windows}
@@ -17,13 +17,14 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/ip_address'
21
- require 'ronin/os'
22
20
  require 'ronin/model'
23
21
 
24
22
  require 'dm-timestamps'
25
23
 
26
24
  module Ronin
25
+ autoload :IPAddress, 'ronin/ip_address'
26
+ autoload :OS, 'ronin/os'
27
+
27
28
  #
28
29
  # Represents a guess about what {OS} an {IPAddress} might be running.
29
30
  #
@@ -17,12 +17,13 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/credential'
21
20
  require 'ronin/model'
22
21
 
23
22
  require 'digest'
24
23
 
25
24
  module Ronin
25
+ autoload :Credential, 'ronin/credential'
26
+
26
27
  #
27
28
  # Represents a password that can be stored in the {Database}.
28
29
  #
data/lib/ronin/port.rb CHANGED
@@ -17,10 +17,11 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/open_port'
21
20
  require 'ronin/model'
22
21
 
23
22
  module Ronin
23
+ autoload :OpenPort, 'ronin/open_port'
24
+
24
25
  #
25
26
  # Represents a TCP or UDP port.
26
27
  #
@@ -19,7 +19,6 @@
19
19
 
20
20
  require 'ronin/exceptions/duplicate_repository'
21
21
  require 'ronin/exceptions/repository_not_found'
22
- require 'ronin/cached_file'
23
22
  require 'ronin/model/has_license'
24
23
  require 'ronin/model/has_authors'
25
24
  require 'ronin/model'
@@ -30,6 +29,8 @@ require 'data_paths'
30
29
  require 'yaml'
31
30
 
32
31
  module Ronin
32
+ autoload :CachedFile, 'ronin/cached_file'
33
+
33
34
  class Repository
34
35
 
35
36
  include Model
data/lib/ronin/service.rb CHANGED
@@ -17,11 +17,12 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/open_port'
21
20
  require 'ronin/model'
22
21
  require 'ronin/model/has_unique_name'
23
22
 
24
23
  module Ronin
24
+ autoload :OpenPort, 'ronin/open_port'
25
+
25
26
  #
26
27
  # Represents a TCP/UDP Service that runs on various common ports.
27
28
  #
@@ -18,9 +18,10 @@
18
18
  #
19
19
 
20
20
  require 'ronin/credential'
21
- require 'ronin/open_port'
22
21
 
23
22
  module Ronin
23
+ autoload :OpenPort, 'ronin/open_port'
24
+
24
25
  #
25
26
  # Represents Credentials used to access a TCP/UDP {Service}.
26
27
  #
@@ -18,9 +18,10 @@
18
18
  #
19
19
 
20
20
  require 'ronin/model'
21
- require 'ronin/vendor'
22
21
 
23
22
  module Ronin
23
+ autoload :Vendor, 'ronin/vendor'
24
+
24
25
  #
25
26
  # Represents a Software product.
26
27
  #
@@ -36,6 +36,10 @@ RSpec.configure do |spec|
36
36
  Ronin::Database.setup_log(:stream => STDERR, :level => :debug)
37
37
  end
38
38
 
39
+ # setup the database
39
40
  Ronin::Database.setup
41
+
42
+ # auto-migrate any models defined in the specs
43
+ DataMapper.finalize.auto_migrate!
40
44
  end
41
45
  end
data/lib/ronin/target.rb CHANGED
@@ -17,13 +17,14 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/campaign'
21
- require 'ronin/address'
22
20
  require 'ronin/model'
23
21
 
24
22
  require 'fileutils'
25
23
 
26
24
  module Ronin
25
+ autoload :Campaign, 'ronin/campaign'
26
+ autoload :Address, 'ronin/address'
27
+
27
28
  #
28
29
  # Represents an {Address} targeted by a {Campaign}.
29
30
  #
@@ -18,16 +18,18 @@
18
18
  #
19
19
 
20
20
  require 'ronin/port'
21
- require 'ronin/url'
22
21
 
23
22
  module Ronin
23
+ autoload :URL, 'ronin/url'
24
+
24
25
  #
25
26
  # Represents a TCP {Port}.
26
27
  #
27
28
  class TCPPort < Port
28
29
 
29
30
  # The URLs that use the port
30
- has 0..n, :urls, :model => 'URL'
31
+ has 0..n, :urls, :model => 'URL',
32
+ :child_key => [:port_id]
31
33
 
32
34
  #
33
35
  # Creates a new {TCPPort} resource.
@@ -25,9 +25,8 @@ module Ronin
25
25
  module UI
26
26
  #
27
27
  # The {CLI} provides an extensible Command Line Interface (CLI)
28
- # for Ronin. The {CLI} can load any sub-command using the
29
- # {command} method, from the `ronin/ui/cli/commands`
30
- # directory.
28
+ # for Ronin. The {CLI} can load any command using the {command} method,
29
+ # from the `ronin/ui/cli/commands` directory.
31
30
  #
32
31
  module CLI
33
32
  # Name of the default to run
@@ -29,14 +29,13 @@ module Ronin
29
29
  module CLI
30
30
  #
31
31
  # The {Command} class inherits `Thor::Group` to provide a base-class
32
- # for defining sub-commands for the {CLI}.
32
+ # for defining commands for the {CLI}.
33
33
  #
34
34
  # # Extending
35
35
  #
36
- # To create a new sub-command one can inherit the {Command} class.
37
- # The new sub-command can define multiple `class_options` and
38
- # `arguments` which `Thor::Group` will use to parse command-line
39
- # arguments.
36
+ # To create a new command one can inherit the {Command} class.
37
+ # The new command can define multiple `class_options` and `arguments`
38
+ # which `Thor::Group` will use to parse command-line arguments.
40
39
  #
41
40
  # require 'ronin/ui/cli/command'
42
41
  #
@@ -80,24 +79,36 @@ module Ronin
80
79
  #
81
80
  # # Running
82
81
  #
83
- # To run the sub-command from Ruby, one can call the `start` class
84
- # method with the options and arguments to run the sub-command with.
82
+ # To run the command from Ruby, one can call the {run} class method
83
+ # with the options and arguments to run the command with:
85
84
  #
86
- # MyCommand.start(
85
+ # MyCommand.run(
87
86
  # {:stuff => true, :syntax => 'bla', :includes => ['other']},
88
87
  # ['some/file.txt']
89
88
  # )
90
89
  #
91
- # To ensure that your sub-command is accessible to the `ronin`
92
- # command, make sure that the ruby file the sub-command is defined
93
- # within is in the `ronin/ui/cli/commands` directory of a
94
- # Ronin library. If the sub-command class is named 'MyCommand'
95
- # it's ruby file must also be named 'my_command.rb'.
90
+ # To run the command from Ruby, with raw command-line options, one
91
+ # can call the `start` class method:
96
92
  #
97
- # To run the sub-command using the `ronin` command, simply specify
98
- # it's underscored name:
93
+ # MyCommand.start([
94
+ # '--stuff', 'true', '--syntax', 'bla', '--includes', 'other',
95
+ # 'some/file.txt'
96
+ # ])
99
97
  #
100
- # ronin my_command some/file.txt --stuff --syntax bla --includes one two
98
+ # Note: If `MyCommand.start` is not given any arguments, it will use
99
+ # `ARGV` instead.
100
+ #
101
+ # To ensure that your command is accessible to the `ronin` command,
102
+ # make sure that the ruby file the command is defined within is in
103
+ # the `ronin/ui/cli/commands` directory of a Ronin library.
104
+ # If the command class is named 'MyCommand' it's ruby file must also
105
+ # be named 'my_command.rb'.
106
+ #
107
+ # To run the command using the `ronin` command, simply specify it's
108
+ # underscored name:
109
+ #
110
+ # ronin my_command some/file.txt --stuff --syntax bla \
111
+ # --includes one two
101
112
  #
102
113
  class Command < Thor::Group
103
114
 
@@ -134,6 +145,27 @@ module Ronin
134
145
  self.name.split('::').last.underscore
135
146
  end
136
147
 
148
+ #
149
+ # Runs the command.
150
+ #
151
+ # @param [Hash{String,Symbol => Object}] options
152
+ # Option values for the command.
153
+ #
154
+ # @param [Array<String>] arguments
155
+ # Additional arguments for the command.
156
+ #
157
+ # @return [Command]
158
+ # The executed command.
159
+ #
160
+ # @since 1.0.0
161
+ #
162
+ def self.run(options={},arguments=[])
163
+ command = self.new(arguments,options)
164
+ command.invoke_all()
165
+
166
+ return command
167
+ end
168
+
137
169
  #
138
170
  # Creates a new Command object.
139
171
  #
data/lib/ronin/ui.rb CHANGED
@@ -18,6 +18,5 @@
18
18
  #
19
19
 
20
20
  require 'ronin/ui/output'
21
- require 'ronin/ui/hexdump'
22
21
  require 'ronin/ui/console'
23
22
  require 'ronin/ui/shell'
data/lib/ronin/url.rb CHANGED
@@ -17,19 +17,19 @@
17
17
  # along with Ronin. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
19
 
20
- require 'ronin/url_scheme'
21
- require 'ronin/url_query_param'
22
- require 'ronin/host_name'
23
- require 'ronin/tcp_port'
24
- require 'ronin/web_credential'
25
20
  require 'ronin/model'
26
21
 
27
22
  require 'dm-timestamps'
28
- require 'dm-tags'
29
23
  require 'uri'
30
24
  require 'uri/query_params'
31
25
 
32
26
  module Ronin
27
+ autoload :URLScheme, 'ronin/url_scheme'
28
+ autoload :URLQueryParam, 'ronin/url_query_param'
29
+ autoload :HostName, 'ronin/host_name'
30
+ autoload :TCPPort, 'ronin/tcp_port'
31
+ autoload :WebCredential, 'ronin/web_credential'
32
+
33
33
  #
34
34
  # Represents URLs that can be stored in the {Database}.
35
35
  #
@@ -75,9 +75,6 @@ module Ronin
75
75
  # Defines the created_at timestamp
76
76
  timestamps :created_at
77
77
 
78
- # Tags
79
- has_tags_on :tags
80
-
81
78
  #
82
79
  # Searches for all URLs using HTTP.
83
80
  #
@@ -207,7 +204,9 @@ module Ronin
207
204
  return super(url) if url.kind_of?(Integer)
208
205
 
209
206
  # optionally parse the URL
210
- url = ::URI.parse(url) unless url.kind_of?(::URI)
207
+ unless url.kind_of?(::URI)
208
+ url = ::URI.parse(url.to_s)
209
+ end
211
210
 
212
211
  port = if url.port
213
212
  {:number => url.port}