ronin 1.4.0.rc1 → 1.4.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/ChangeLog.md +21 -0
  2. data/Gemfile +4 -0
  3. data/README.md +1 -1
  4. data/bin/ronin-ips +1 -1
  5. data/bin/ronin-urls +1 -1
  6. data/bin/ronin-wordlist +25 -0
  7. data/gemspec.yml +2 -2
  8. data/lib/bond/completions/ronin.rb +1 -1
  9. data/lib/ronin.rb +1 -1
  10. data/lib/ronin/address.rb +1 -1
  11. data/lib/ronin/arch.rb +1 -1
  12. data/lib/ronin/author.rb +1 -1
  13. data/lib/ronin/auto_load.rb +1 -1
  14. data/lib/ronin/bootstrap.rb +1 -1
  15. data/lib/ronin/campaign.rb +1 -1
  16. data/lib/ronin/config.rb +1 -1
  17. data/lib/ronin/credential.rb +1 -1
  18. data/lib/ronin/database.rb +1 -1
  19. data/lib/ronin/database/database.rb +1 -1
  20. data/lib/ronin/database/exceptions.rb +1 -1
  21. data/lib/ronin/database/exceptions/invalid_config.rb +1 -1
  22. data/lib/ronin/database/exceptions/unknown_repository.rb +1 -1
  23. data/lib/ronin/database/migrations.rb +1 -1
  24. data/lib/ronin/database/migrations/1.0.0.rb +1 -1
  25. data/lib/ronin/database/migrations/1.1.0.rb +1 -1
  26. data/lib/ronin/database/migrations/exceptions.rb +1 -1
  27. data/lib/ronin/database/migrations/exceptions/duplicate_migration.rb +1 -1
  28. data/lib/ronin/database/migrations/exceptions/unknown_migration.rb +1 -1
  29. data/lib/ronin/database/migrations/graph.rb +1 -1
  30. data/lib/ronin/database/migrations/migration.rb +1 -1
  31. data/lib/ronin/database/migrations/migrations.rb +1 -1
  32. data/lib/ronin/email_address.rb +1 -1
  33. data/lib/ronin/environment.rb +1 -1
  34. data/lib/ronin/exceptions.rb +1 -1
  35. data/lib/ronin/exceptions/duplicate_repository.rb +1 -1
  36. data/lib/ronin/exceptions/repository_not_found.rb +1 -1
  37. data/lib/ronin/host_name.rb +1 -1
  38. data/lib/ronin/host_name_ip_address.rb +1 -1
  39. data/lib/ronin/installation.rb +1 -1
  40. data/lib/ronin/ip_address.rb +1 -1
  41. data/lib/ronin/ip_address_mac_address.rb +1 -1
  42. data/lib/ronin/license.rb +1 -1
  43. data/lib/ronin/mac_address.rb +1 -1
  44. data/lib/ronin/model.rb +1 -1
  45. data/lib/ronin/model/has_authors.rb +1 -1
  46. data/lib/ronin/model/has_description.rb +1 -1
  47. data/lib/ronin/model/has_license.rb +1 -1
  48. data/lib/ronin/model/has_name.rb +1 -1
  49. data/lib/ronin/model/has_title.rb +1 -1
  50. data/lib/ronin/model/has_unique_name.rb +1 -1
  51. data/lib/ronin/model/has_version.rb +1 -1
  52. data/lib/ronin/model/importable.rb +1 -1
  53. data/lib/ronin/model/model.rb +1 -1
  54. data/lib/ronin/model/types.rb +1 -1
  55. data/lib/ronin/model/types/description.rb +1 -1
  56. data/lib/ronin/open_port.rb +1 -1
  57. data/lib/ronin/organization.rb +1 -1
  58. data/lib/ronin/os.rb +1 -1
  59. data/lib/ronin/os_guess.rb +1 -1
  60. data/lib/ronin/password.rb +1 -1
  61. data/lib/ronin/port.rb +1 -1
  62. data/lib/ronin/repositories.rb +1 -1
  63. data/lib/ronin/repository.rb +3 -3
  64. data/lib/ronin/ronin.rb +1 -1
  65. data/lib/ronin/script.rb +1 -1
  66. data/lib/ronin/script/buildable.rb +1 -1
  67. data/lib/ronin/script/deployable.rb +1 -1
  68. data/lib/ronin/script/exceptions.rb +1 -1
  69. data/lib/ronin/script/exceptions/build_failed.rb +1 -1
  70. data/lib/ronin/script/exceptions/deploy_failed.rb +1 -1
  71. data/lib/ronin/script/exceptions/exception.rb +1 -1
  72. data/lib/ronin/script/exceptions/not_built.rb +1 -1
  73. data/lib/ronin/script/exceptions/test_failed.rb +1 -1
  74. data/lib/ronin/script/path.rb +1 -1
  75. data/lib/ronin/script/script.rb +1 -1
  76. data/lib/ronin/script/testable.rb +1 -1
  77. data/lib/ronin/service.rb +1 -1
  78. data/lib/ronin/service_credential.rb +1 -1
  79. data/lib/ronin/software.rb +1 -1
  80. data/lib/ronin/spec/database.rb +1 -1
  81. data/lib/ronin/target.rb +1 -1
  82. data/lib/ronin/tcp_port.rb +1 -1
  83. data/lib/ronin/udp_port.rb +1 -1
  84. data/lib/ronin/ui.rb +1 -1
  85. data/lib/ronin/ui/cli.rb +1 -1
  86. data/lib/ronin/ui/cli/class_command.rb +1 -1
  87. data/lib/ronin/ui/cli/cli.rb +1 -1
  88. data/lib/ronin/ui/cli/command.rb +47 -7
  89. data/lib/ronin/ui/cli/commands.rb +1 -1
  90. data/lib/ronin/ui/cli/commands/campaigns.rb +30 -3
  91. data/lib/ronin/ui/cli/commands/console.rb +18 -2
  92. data/lib/ronin/ui/cli/commands/creds.rb +24 -2
  93. data/lib/ronin/ui/cli/commands/database.rb +26 -3
  94. data/lib/ronin/ui/cli/commands/emails.rb +25 -2
  95. data/lib/ronin/ui/cli/commands/exec.rb +6 -2
  96. data/lib/ronin/ui/cli/commands/help.rb +20 -3
  97. data/lib/ronin/ui/cli/commands/hosts.rb +27 -2
  98. data/lib/ronin/ui/cli/commands/install.rb +23 -4
  99. data/lib/ronin/ui/cli/commands/ips.rb +29 -3
  100. data/lib/ronin/ui/cli/commands/repos.rb +23 -2
  101. data/lib/ronin/ui/cli/commands/uninstall.rb +17 -2
  102. data/lib/ronin/ui/cli/commands/update.rb +17 -2
  103. data/lib/ronin/ui/cli/commands/urls.rb +32 -3
  104. data/lib/ronin/ui/cli/commands/wordlist.rb +168 -0
  105. data/lib/ronin/ui/cli/exceptions.rb +1 -1
  106. data/lib/ronin/ui/cli/exceptions/unknown_command.rb +1 -1
  107. data/lib/ronin/ui/cli/model_command.rb +1 -1
  108. data/lib/ronin/ui/cli/printing.rb +1 -1
  109. data/lib/ronin/ui/cli/resources_command.rb +1 -1
  110. data/lib/ronin/ui/cli/script_command.rb +1 -1
  111. data/lib/ronin/ui/console.rb +1 -1
  112. data/lib/ronin/ui/console/commands.rb +1 -1
  113. data/lib/ronin/ui/console/console.rb +1 -1
  114. data/lib/ronin/ui/console/context.rb +17 -6
  115. data/lib/ronin/url.rb +15 -1
  116. data/lib/ronin/url_query_param.rb +1 -1
  117. data/lib/ronin/url_query_param_name.rb +1 -1
  118. data/lib/ronin/url_scheme.rb +1 -1
  119. data/lib/ronin/user_name.rb +1 -1
  120. data/lib/ronin/vendor.rb +1 -1
  121. data/lib/ronin/version.rb +2 -2
  122. data/lib/ronin/web_credential.rb +1 -1
  123. data/spec/installation_spec.rb +1 -0
  124. data/spec/repository_spec.rb +1 -1
  125. data/spec/url_spec.rb +16 -0
  126. metadata +61 -58
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -26,7 +26,22 @@ module Ronin
26
26
  module CLI
27
27
  module Commands
28
28
  #
29
- # The `ronin-uninstall` command.
29
+ # Uninstalls Ronin {Repository Repositories}.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin uninstall [options] REPO
34
+ #
35
+ # ## Options
36
+ #
37
+ # -v, --[no-]verbose Enable verbose output.
38
+ # -q, --[no-]quiet Disable verbose output.
39
+ # --[no-]silent Silence all output.
40
+ # --[no-]color Enables color output.
41
+ #
42
+ # ## Arguments
43
+ #
44
+ # REPO Repository to uninstall
30
45
  #
31
46
  class Uninstall < Command
32
47
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -26,7 +26,22 @@ module Ronin
26
26
  module CLI
27
27
  module Commands
28
28
  #
29
- # The `ronin-update` command.
29
+ # Updates Ronin {Repository Repositories}.
30
+ #
31
+ # ## Usage
32
+ #
33
+ # ronin update [options] REPO
34
+ #
35
+ # ## Options
36
+ #
37
+ # -v, --[no-]verbose Enable verbose output.
38
+ # -q, --[no-]quiet Disable verbose output.
39
+ # --[no-]silent Silence all output.
40
+ # --[no-]color Enables color output.
41
+ #
42
+ # ## Arguments
43
+ #
44
+ # REPO Repository to update
30
45
  #
31
46
  class Update < Command
32
47
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -25,12 +25,41 @@ module Ronin
25
25
  module CLI
26
26
  module Commands
27
27
  #
28
- # The `ronin-urls` command.
28
+ # Manages {URL URLs}.
29
29
  #
30
- class URLs < ResourcesCommand
30
+ # ## Usage
31
+ #
32
+ # ronin urls [options]
33
+ #
34
+ # ## Options
35
+ #
36
+ # -v, --[no-]verbose Enable verbose output.
37
+ # --[no-]quiet Disable verbose output.
38
+ # --[no-]silent Silence all output.
39
+ # --[no-]color Enables color output.
40
+ # -D, --database [URI] The Database URI.
41
+ # --[no-]csv CSV output.
42
+ # --[no-]xml XML output.
43
+ # --[no-]yaml YAML output.
44
+ # --[no-]json JSON output.
45
+ # -i, --import [FILE]
46
+ # --[no-]http
47
+ # --[no-]https
48
+ # -H, --hosts [HOST [...]]
49
+ # -P, --ports [PORT [...]]
50
+ # -d, --directory [SUBDIR]
51
+ # -q [NAME [...]],
52
+ # --with-query-param
53
+ # -Q [VALUE [...]],
54
+ # --with-query-value
55
+ # -l, --[no-]list Default: true
56
+ #
57
+ class Urls < ResourcesCommand
31
58
 
32
59
  model URL
33
60
 
61
+ summary 'Manages URLs'
62
+
34
63
  query_option :http, :type => true
35
64
  query_option :https, :type => true
36
65
 
@@ -0,0 +1,168 @@
1
+ #
2
+ # Copyright (c) 2006-2012 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/ui/cli/command'
21
+ require 'ronin/wordlist'
22
+
23
+ module Ronin
24
+ module UI
25
+ module CLI
26
+ module Commands
27
+ #
28
+ # Builds and/or mutates Wordlists.
29
+ #
30
+ # ## Usage
31
+ #
32
+ # ronin wordlist [options] [TEMPLATE]
33
+ #
34
+ # ## Options
35
+ #
36
+ # -v, --[no-]verbose Enable verbose output.
37
+ # -q, --[no-]quiet Disable verbose output.
38
+ # --[no-]silent Silence all output.
39
+ # --[no-]color Enables color output.
40
+ # -i, --input [FILE] Input file.
41
+ # -o, --output [PATH] Output wordlist file.
42
+ # -m, --mutations [STRING:SUB] Default: {}
43
+ #
44
+ # ## Arguments
45
+ #
46
+ # TEMPLATE Options word template
47
+ #
48
+ # @since 1.4.0
49
+ #
50
+ class Wordlist < Command
51
+
52
+ summary 'Builds and/or mutates Wordlists'
53
+
54
+ option :input, :type => String,
55
+ :flag => '-i',
56
+ :usage => 'FILE',
57
+ :description => 'Input file'
58
+
59
+ option :output, :type => String,
60
+ :flag => '-o',
61
+ :usage => 'PATH',
62
+ :description => 'Output wordlist file'
63
+
64
+ option :mutations, :type => Hash[String => Array],
65
+ :default => {},
66
+ :flag => '-m',
67
+ :usage => 'STRING:SUB',
68
+ :descriptions => 'Mutations rules'
69
+
70
+ argument :template, :type => Array,
71
+ :description => 'Options word template'
72
+
73
+ #
74
+ # Executes the wordlist command.
75
+ #
76
+ def execute
77
+ if (input? && template?)
78
+ print_error "Cannot specify --input with the TEMPLATE argument"
79
+ exit -1
80
+ end
81
+
82
+ output_stream do |output|
83
+ wordlist.each { |word| output.puts word }
84
+ end
85
+ end
86
+
87
+ protected
88
+
89
+ #
90
+ # Parses the `TEMPLATE` argument.
91
+ #
92
+ # @return [Array<String, Array<String>, (Symbol, Integer)>]
93
+ # The String building template.
94
+ #
95
+ # @see http://rubydoc.info/gems/ronin-support/String#generate-class_method
96
+ #
97
+ def parse_template
98
+ @template.map do |char_template|
99
+ if char_template.include?(':')
100
+ charset, length = char_template.split(':',2)
101
+
102
+ # convert charset names to Symbols
103
+ charset = if charset.include?(',')
104
+ charset.split(',')
105
+ elsif Chars.const_defined?(charset.upcase)
106
+ charset.to_sym
107
+ else
108
+ charset.to_s
109
+ end
110
+
111
+ # parse the length field
112
+ length = if length.include?('-')
113
+ min, max = length.split('-',2)
114
+
115
+ Range.new(min.to_i,max.to_i)
116
+ elsif length.include?(',')
117
+ length.split(',').map(&:to_i)
118
+ else
119
+ length.to_i
120
+ end
121
+
122
+ [charset, length]
123
+ else
124
+ char_template
125
+ end
126
+ end
127
+ end
128
+
129
+ #
130
+ # Initializes the wordlist based on the command options.
131
+ #
132
+ # @return [Ronin::Wordlist]
133
+ # The new wordlist.
134
+ #
135
+ # @see http://rubydoc.info/gems/ronin-support/Ronin/Wordlist
136
+ #
137
+ def wordlist
138
+ if template?
139
+ Ronin::Wordlist.new(String.generate(*parse_template),@mutations)
140
+ elsif input?
141
+ Ronin::Wordlist.build(File.open(@input),@mutations)
142
+ else
143
+ Ronin::Wordlist.build($stdin,@mutations)
144
+ end
145
+ end
146
+
147
+ #
148
+ # Opens the output stream.
149
+ #
150
+ # @yield [output]
151
+ # The output stream to write words to.
152
+ #
153
+ # @yieldparam [File, IO]
154
+ # The output file or `STDOUT`.
155
+ #
156
+ def output_stream(&block)
157
+ if @output
158
+ File.open(@output,'w',&block)
159
+ else
160
+ yield STDOUT
161
+ end
162
+ end
163
+
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -56,6 +56,15 @@ module Ronin
56
56
  Ronin.send(:const_missing,name)
57
57
  end
58
58
 
59
+ #
60
+ # @note
61
+ # Ruby 1.8.x requires {const_missing} to be defined as an
62
+ # instance-method.
63
+ #
64
+ def const_missing(name)
65
+ Ronin.send(:const_missing,name)
66
+ end
67
+
59
68
  #
60
69
  # Populates the instance variables.
61
70
  #
@@ -79,11 +88,13 @@ module Ronin
79
88
  # @api semipublic
80
89
  #
81
90
  def inspect
82
- body = unless instance_variables.empty?
83
- ': ' << instance_variables.map { |name|
84
- "#{name}=#{instance_variable_get(name).inspect}"
85
- }.join(', ')
86
- end
91
+ unless instance_variables.empty?
92
+ body = ':'
93
+
94
+ instance_variables.each do |name|
95
+ body << " #{name}=#{instance_variable_get(name).inspect}"
96
+ end
97
+ end
87
98
 
88
99
  return "#<Ronin::UI::Console#{body}>"
89
100
  end
data/lib/ronin/url.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -502,6 +502,20 @@ module Ronin
502
502
  self.to_uri.to_s
503
503
  end
504
504
 
505
+ #
506
+ # Inspects the URL.
507
+ #
508
+ # @return [String]
509
+ # The inspected URL.
510
+ #
511
+ # @since 1.4.0
512
+ #
513
+ # @api public
514
+ #
515
+ def inspect
516
+ "#<#{self.class}: #{self}>"
517
+ end
518
+
505
519
  protected
506
520
 
507
521
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
3
  #
4
4
  # This file is part of Ronin.
5
5
  #