ronin 1.0.0 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/.yardopts +0 -1
  2. data/ChangeLog.md +67 -3
  3. data/Gemfile +20 -12
  4. data/README.md +3 -5
  5. data/gemspec.yml +5 -5
  6. data/lib/ronin/address.rb +8 -3
  7. data/lib/ronin/arch.rb +39 -14
  8. data/lib/ronin/author.rb +2 -0
  9. data/lib/ronin/auto_load.rb +67 -0
  10. data/lib/ronin/campaign.rb +15 -2
  11. data/lib/ronin/class_methods.rb +7 -1
  12. data/lib/ronin/config.rb +5 -0
  13. data/lib/ronin/credential.rb +14 -3
  14. data/lib/ronin/database/database.rb +38 -12
  15. data/lib/ronin/database/migrations.rb +3 -1
  16. data/lib/ronin/database/migrations/add_created_at_column_to_targets_table.rb +48 -0
  17. data/lib/ronin/database/migrations/add_updated_at_column_to_campaigns_table.rb +47 -0
  18. data/lib/ronin/database/migrations/create_licenses_table.rb +1 -1
  19. data/lib/ronin/database/migrations/create_passwords_table.rb +1 -1
  20. data/lib/ronin/database/migrations/{create_cached_files_table.rb → create_script_paths_table.rb} +4 -4
  21. data/lib/ronin/database/migrations/migration.rb +3 -6
  22. data/lib/ronin/database/migrations/migrations.rb +3 -3
  23. data/lib/ronin/email_address.rb +20 -3
  24. data/lib/ronin/environment.rb +0 -3
  25. data/lib/ronin/host_name.rb +20 -6
  26. data/lib/ronin/host_name_ip_address.rb +2 -3
  27. data/lib/ronin/installation.rb +92 -23
  28. data/lib/ronin/ip_address.rb +31 -8
  29. data/lib/ronin/ip_address_mac_address.rb +2 -3
  30. data/lib/ronin/license.rb +1 -1
  31. data/lib/ronin/mac_address.rb +6 -4
  32. data/lib/ronin/model/class_methods.rb +4 -0
  33. data/lib/ronin/model/has_authors/class_methods.rb +4 -0
  34. data/lib/ronin/model/has_authors/has_authors.rb +4 -0
  35. data/lib/ronin/model/has_description/class_methods.rb +2 -0
  36. data/lib/ronin/model/has_description/has_description.rb +2 -0
  37. data/lib/ronin/model/has_license/class_methods.rb +2 -0
  38. data/lib/ronin/model/has_license/has_license.rb +4 -0
  39. data/lib/ronin/model/has_name/class_methods.rb +2 -0
  40. data/lib/ronin/model/has_name/has_name.rb +4 -0
  41. data/lib/ronin/model/has_title/class_methods.rb +2 -0
  42. data/lib/ronin/model/has_title/has_title.rb +2 -0
  43. data/lib/ronin/model/has_unique_name/class_methods.rb +2 -0
  44. data/lib/ronin/model/has_unique_name/has_unique_name.rb +7 -1
  45. data/lib/ronin/model/has_version/class_methods.rb +4 -0
  46. data/lib/ronin/model/has_version/has_version.rb +2 -0
  47. data/lib/ronin/model/model.rb +2 -0
  48. data/lib/ronin/model/types.rb +1 -7
  49. data/lib/ronin/model/types/description.rb +2 -0
  50. data/lib/ronin/network/mixins/esmtp.rb +40 -25
  51. data/lib/ronin/network/mixins/http.rb +336 -73
  52. data/lib/ronin/network/mixins/imap.rb +38 -25
  53. data/lib/ronin/network/mixins/pop3.rb +34 -21
  54. data/lib/ronin/network/mixins/smtp.rb +40 -25
  55. data/lib/ronin/network/mixins/tcp.rb +66 -41
  56. data/lib/ronin/network/mixins/telnet.rb +43 -30
  57. data/lib/ronin/network/mixins/udp.rb +59 -40
  58. data/lib/ronin/open_port.rb +12 -5
  59. data/lib/ronin/organization.rb +1 -2
  60. data/lib/ronin/os.rb +10 -3
  61. data/lib/ronin/os_guess.rb +2 -3
  62. data/lib/ronin/password.rb +11 -3
  63. data/lib/ronin/port.rb +7 -2
  64. data/lib/ronin/{engine/exceptions/deploy_failed.rb → repositories.rb} +4 -6
  65. data/lib/ronin/repository.rb +110 -37
  66. data/lib/ronin/ronin.rb +4 -3
  67. data/lib/ronin/{engine.rb → script.rb} +2 -1
  68. data/lib/ronin/{engine → script}/buildable.rb +43 -29
  69. data/lib/ronin/script/class_methods.rb +84 -0
  70. data/lib/ronin/{engine → script}/deployable.rb +61 -40
  71. data/lib/ronin/{engine → script}/exceptions.rb +4 -3
  72. data/lib/ronin/script/exceptions/deploy_failed.rb +27 -0
  73. data/lib/ronin/{engine/exceptions/not_built.rb → script/exceptions/exception.rb} +2 -2
  74. data/lib/ronin/{engine/exceptions/verification_failed.rb → script/exceptions/not_built.rb} +4 -2
  75. data/lib/ronin/script/exceptions/test_failed.rb +27 -0
  76. data/lib/ronin/script/instance_methods.rb +217 -0
  77. data/lib/ronin/script/path.rb +277 -0
  78. data/lib/ronin/{engine/engine.rb → script/script.rb} +52 -15
  79. data/lib/ronin/{engine/verifiable.rb → script/testable.rb} +97 -68
  80. data/lib/ronin/service.rb +1 -2
  81. data/lib/ronin/service_credential.rb +1 -2
  82. data/lib/ronin/software.rb +3 -2
  83. data/lib/ronin/spec/database.rb +0 -4
  84. data/lib/ronin/target.rb +11 -3
  85. data/lib/ronin/tcp_port.rb +3 -2
  86. data/lib/ronin/udp_port.rb +2 -0
  87. data/lib/ronin/ui/cli/cli.rb +6 -0
  88. data/lib/ronin/ui/cli/command.rb +48 -12
  89. data/lib/ronin/ui/cli/commands/campaigns.rb +3 -3
  90. data/lib/ronin/ui/cli/commands/console.rb +2 -1
  91. data/lib/ronin/ui/cli/commands/creds.rb +3 -3
  92. data/lib/ronin/ui/cli/commands/database.rb +1 -17
  93. data/lib/ronin/ui/cli/commands/emails.rb +3 -3
  94. data/lib/ronin/ui/cli/commands/hosts.rb +3 -7
  95. data/lib/ronin/ui/cli/commands/ips.rb +3 -7
  96. data/lib/ronin/ui/cli/commands/repos.rb +5 -17
  97. data/lib/ronin/ui/cli/commands/urls.rb +3 -3
  98. data/lib/ronin/ui/cli/model_command.rb +82 -97
  99. data/lib/ronin/ui/cli/resources_command.rb +89 -0
  100. data/lib/ronin/ui/cli/script_command.rb +115 -0
  101. data/lib/ronin/ui/console.rb +17 -3
  102. data/lib/ronin/ui/output/helpers.rb +18 -0
  103. data/lib/ronin/ui/output/output.rb +20 -1
  104. data/lib/ronin/ui/output/terminal/color.rb +10 -0
  105. data/lib/ronin/ui/output/terminal/raw.rb +10 -0
  106. data/lib/ronin/ui/shell.rb +2 -0
  107. data/lib/ronin/url.rb +47 -12
  108. data/lib/ronin/url_query_param.rb +4 -0
  109. data/lib/ronin/url_scheme.rb +3 -3
  110. data/lib/ronin/user_name.rb +2 -0
  111. data/lib/ronin/version.rb +1 -1
  112. data/lib/ronin/web_credential.rb +6 -3
  113. data/spec/arch_spec.rb +3 -3
  114. data/spec/classes/my_script.rb +21 -0
  115. data/spec/helpers/repos/{test1 → installed}/ronin.yml +1 -1
  116. data/spec/helpers/repos/{hello/cache → installed/scripts}/.keep +0 -0
  117. data/spec/helpers/repos/local/lib/init.rb +1 -0
  118. data/spec/helpers/repos/{hello → local}/lib/stuff/another_test.rb +0 -0
  119. data/spec/helpers/repos/{hello → local}/lib/stuff/test.rb +0 -0
  120. data/spec/helpers/repos/{random → local}/ronin.yml +1 -1
  121. data/spec/helpers/repos/{random/cache → local/scripts}/.keep +0 -0
  122. data/spec/helpers/repos/{hello → remote}/ronin.yml +1 -1
  123. data/spec/helpers/repos/remote/scripts/.keep +0 -0
  124. data/spec/helpers/repos/{test2 → scripts}/ronin.yml +0 -0
  125. data/spec/helpers/repos/scripts/scripts/cached/cached.rb +10 -0
  126. data/spec/helpers/repos/scripts/scripts/cached/missing.rb +10 -0
  127. data/spec/helpers/repos/scripts/scripts/cached/modified.rb +10 -0
  128. data/spec/helpers/repos/scripts/scripts/cached/unmodified.rb +10 -0
  129. data/spec/helpers/repos/scripts/scripts/failures/exceptions.rb +11 -0
  130. data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/load_errors.rb +3 -1
  131. data/spec/helpers/repos/{test2/cache/cacheable_model → scripts/scripts/failures}/name_errors.rb +1 -0
  132. data/spec/helpers/repos/scripts/scripts/failures/no_method_errors.rb +10 -0
  133. data/spec/helpers/repos/scripts/scripts/failures/syntax_errors.rb +11 -0
  134. data/spec/helpers/repos/scripts/scripts/failures/validation_errors.rb +11 -0
  135. data/spec/helpers/repos/scripts/scripts/my_scripts/test.rb +16 -0
  136. data/spec/model/spec_helper.rb +0 -2
  137. data/spec/repository_spec.rb +61 -81
  138. data/spec/ronin_spec.rb +2 -2
  139. data/spec/{engine → script}/buildable_spec.rb +9 -9
  140. data/spec/script/classes/buildable_class.rb +15 -0
  141. data/spec/script/classes/deployable_class.rb +13 -0
  142. data/spec/{engine/classes/engine_class.rb → script/classes/script_class.rb} +3 -3
  143. data/spec/{engine/classes/verifiable_class.rb → script/classes/testable_class.rb} +5 -5
  144. data/spec/{engine → script}/deployable_spec.rb +10 -10
  145. data/spec/{cached_file_spec.rb → script/path_spec.rb} +33 -72
  146. data/spec/script/script_spec.rb +130 -0
  147. data/spec/script/testable_spec.rb +117 -0
  148. data/spec/spec_helper.rb +15 -13
  149. metadata +114 -139
  150. data/lib/ronin/cached_file.rb +0 -247
  151. data/lib/ronin/engine/class_methods.rb +0 -135
  152. data/lib/ronin/engine/instance_methods.rb +0 -97
  153. data/lib/ronin/model/cacheable.rb +0 -21
  154. data/lib/ronin/model/cacheable/cacheable.rb +0 -273
  155. data/lib/ronin/model/cacheable/class_methods.rb +0 -60
  156. data/lib/ronin/ui/cli/engine_command.rb +0 -106
  157. data/spec/engine/classes/buildable_class.rb +0 -15
  158. data/spec/engine/classes/deployable_class.rb +0 -13
  159. data/spec/engine/engine_spec.rb +0 -55
  160. data/spec/engine/verifiable_spec.rb +0 -117
  161. data/spec/helpers/repos/hello/lib/init.rb +0 -1
  162. data/spec/helpers/repos/test1/cache/cacheable_model/one.rb +0 -15
  163. data/spec/helpers/repos/test2/cache/cacheable_model/exceptions.rb +0 -7
  164. data/spec/helpers/repos/test2/cache/cacheable_model/no_method_errors.rb +0 -9
  165. data/spec/helpers/repos/test2/cache/cacheable_model/syntax_errors.rb +0 -7
  166. data/spec/helpers/repos/test2/cache/cacheable_model/two.rb +0 -15
  167. data/spec/helpers/repos/test2/cache/cacheable_model/validation_errors.rb +0 -9
  168. data/spec/model/cacheable_spec.rb +0 -96
  169. data/spec/model/models/cacheable_model.rb +0 -13
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/imap'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -27,39 +29,46 @@ module Ronin
27
29
  #
28
30
  # Adds IMAP convenience methods and connection parameters to a class.
29
31
  #
32
+ # Defines the following parameters:
33
+ #
34
+ # * `host` (`String`) - IMAP host.
35
+ # * `port` (`Integer`) - IMAP port.
36
+ # * `imap_auth` (`String`) - IMAP authentication method.
37
+ # * `imap_user` (`String`) - IMAP user to login as.
38
+ # * `imap_password` (`String`) - IMAP password to login with.
39
+ #
30
40
  module IMAP
31
- include Parameters
41
+ include Mixin
42
+
43
+ mixin UI::Output::Helpers, Parameters
32
44
 
33
- # IMAP host
34
- parameter :host,
35
- :type => String,
36
- :description => 'IMAP host'
45
+ mixin do
46
+ # IMAP host
47
+ parameter :host, :type => String,
48
+ :description => 'IMAP host'
37
49
 
38
- # IMAP port
39
- parameter :port,
40
- :type => Integer,
41
- :description => 'IMAP port'
50
+ # IMAP port
51
+ parameter :port, :type => Integer,
52
+ :description => 'IMAP port'
42
53
 
43
- # IMAP auth
44
- parameter :imap_auth,
45
- :type => String,
46
- :description => 'IMAP authentication method'
54
+ # IMAP auth
55
+ parameter :imap_auth, :type => String,
56
+ :description => 'IMAP authentication method'
47
57
 
48
- # IMAP user to login as
49
- parameter :imap_user,
50
- :type => String,
51
- :description => 'IMAP user to login as'
58
+ # IMAP user to login as
59
+ parameter :imap_user, :type => String,
60
+ :description => 'IMAP user to login as'
52
61
 
53
- # IMAP password to login with
54
- parameter :imap_password,
55
- :type => String,
56
- :description => 'IMAP password to login with'
62
+ # IMAP password to login with
63
+ parameter :imap_password, :type => String,
64
+ :description => 'IMAP password to login with'
65
+ end
57
66
 
58
67
  protected
59
68
 
60
69
  #
61
- # Creates a connection to the IMAP server. The {#host}, {#port},
62
- # {#imap_auth}, {#imap_user} and {#imap_password} parameters
70
+ # Creates a connection to the IMAP server. The `host`, `port`,
71
+ # `imap_auth`, `imap_user` and `imap_password` parameters
63
72
  # will also be used to make the connection.
64
73
  #
65
74
  # @param [Hash] options
@@ -86,6 +95,8 @@ module Ronin
86
95
  # Indicates wether or not to use SSL when connecting to the
87
96
  # server.
88
97
  #
98
+ # @api public
99
+ #
89
100
  def imap_connect(options={},&block)
90
101
  options[:port] ||= self.port
91
102
  options[:auth] ||= self.imap_auth
@@ -102,8 +113,8 @@ module Ronin
102
113
  end
103
114
 
104
115
  #
105
- # Starts a session with the IMAP server. The {#host}, {#port},
106
- # {#imap_auth}, {#imap_user} and {#imap_password} parameters
116
+ # Starts a session with the IMAP server. The `host`, `port`,
117
+ # `imap_auth`, `imap_user` and `imap_password` parameters
107
118
  # will also be used to make the connection.
108
119
  #
109
120
  # @yield [session]
@@ -116,6 +127,8 @@ module Ronin
116
127
  #
117
128
  # @see imap_connect
118
129
  #
130
+ # @api public
131
+ #
119
132
  def imap_session(options={})
120
133
  imap_connect(options) do |sess|
121
134
  yield sess if block_given?
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/pop3'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -27,34 +29,41 @@ module Ronin
27
29
  #
28
30
  # Adds POP3 convenience methods and connection parameters to a class.
29
31
  #
32
+ # Defines the following parameters:
33
+ #
34
+ # * `host` (`String`) - POP3 host.
35
+ # * `port` (`Integer`) - POP3 port.
36
+ # * `pop3_user` (`String`) - POP3 user to login as.
37
+ # * `pop3_password` (`String`) - POP3 password to login with.
38
+ #
30
39
  module POP3
31
- include Parameters
40
+ include Mixin
41
+
42
+ mixin UI::Output::Helpers, Parameters
32
43
 
33
- # POP3 host
34
- parameter :host,
35
- :type => String,
36
- :description => 'POP3 host'
44
+ mixin do
45
+ # POP3 host
46
+ parameter :host, :type => String,
47
+ :description => 'POP3 host'
37
48
 
38
- # POP3 port
39
- parameter :port,
40
- :type => Integer,
41
- :description => 'POP3 port'
49
+ # POP3 port
50
+ parameter :port, :type => Integer,
51
+ :description => 'POP3 port'
42
52
 
43
- # POP3 user
44
- parameter :pop3_user,
45
- :type => String,
46
- :description => 'POP3 user to login as'
53
+ # POP3 user
54
+ parameter :pop3_user, :type => String,
55
+ :description => 'POP3 user to login as'
47
56
 
48
- # POP3 password
49
- parameter :pop3_password,
50
- :type => String,
51
- :description => 'POP3 password to login with'
57
+ # POP3 password
58
+ parameter :pop3_password, :type => String,
59
+ :description => 'POP3 password to login with'
60
+ end
52
61
 
53
62
  protected
54
63
 
55
64
  #
56
- # Creates a connection to the POP3 server. The {#host}, {#port},
57
- # {#pop3_user} and {#pop3_password} parameters will also be used
65
+ # Creates a connection to the POP3 server. The `host}, `port`,
66
+ # `pop3_user` and `pop3_password` parameters will also be used
58
67
  # to connect to the server.
59
68
  #
60
69
  # @param [Hash] options
@@ -81,6 +90,8 @@ module Ronin
81
90
  # @return [Net::POP3]
82
91
  # The newly created POP3 session.
83
92
  #
93
+ # @api public
94
+ #
84
95
  def pop3_connect(options={},&block)
85
96
  options[:port] ||= self.port
86
97
  options[:user] ||= self.pop3_user
@@ -96,8 +107,8 @@ module Ronin
96
107
  end
97
108
 
98
109
  #
99
- # Starts a session with the POP3 server. The {#host}, {#port},
100
- # {#pop3_user} and {#pop3_password} parameters will also be used
110
+ # Starts a session with the POP3 server. The `host`, `port`,
111
+ # `pop3_user` and `pop3_password` parameters will also be used
101
112
  # to connect to the server.
102
113
  #
103
114
  # @yield [session]
@@ -110,6 +121,8 @@ module Ronin
110
121
  #
111
122
  # @see pop3_connect
112
123
  #
124
+ # @api public
125
+ #
113
126
  def pop3_session(options={})
114
127
  pop3_connect(options) do |sess|
115
128
  yield sess if block_given?
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/smtp'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -27,46 +29,55 @@ module Ronin
27
29
  #
28
30
  # Adds SMTP convenience methods and connection parameters to a class.
29
31
  #
32
+ # Defines the following parameters:
33
+ #
34
+ # * `host` (`String`) - SMTP host.
35
+ # * `port` (`Integer`) - SMTP port.
36
+ # * `smtp_login` (`String`) - SMTP authentication method.
37
+ # * `smtp_user` (`String`) - SMTP user to login as.
38
+ # * `smtp_password` (`String`) - SMTP password to login with.
39
+ #
30
40
  module SMTP
31
- include Parameters
41
+ include Mixin
32
42
 
33
- # SMTP host
34
- parameter :host,
35
- :type => String,
36
- :description => 'SMTP host'
43
+ mixin UI::Output::Helpers, Parameters
37
44
 
38
- # SMTP port
39
- parameter :port,
40
- :type => Integer,
41
- :description => 'SMTP port'
45
+ mixin do
46
+ # SMTP host
47
+ parameter :host, :type => String,
48
+ :description => 'SMTP host'
42
49
 
43
- # SMTP authentication method
44
- parameter :smtp_login,
45
- :type => String,
46
- :description => 'SMTP authentication method'
50
+ # SMTP port
51
+ parameter :port, :type => Integer,
52
+ :description => 'SMTP port'
47
53
 
48
- # SMTP user to login as
49
- parameter :smtp_user,
50
- :type => String,
51
- :description => 'SMTP user to login as'
54
+ # SMTP authentication method
55
+ parameter :smtp_login, :type => String,
56
+ :description => 'SMTP authentication method'
52
57
 
53
- # SMTP user to login with
54
- parameter :smtp_password,
55
- :type => String,
56
- :description => 'SMTP password to login with'
58
+ # SMTP user to login as
59
+ parameter :smtp_user, :type => String,
60
+ :description => 'SMTP user to login as'
61
+
62
+ # SMTP user to login with
63
+ parameter :smtp_password, :type => String,
64
+ :description => 'SMTP password to login with'
65
+ end
57
66
 
58
67
  protected
59
68
 
60
69
  #
61
70
  # @see Ronin::Network::SMTP.message
62
71
  #
72
+ # @api public
73
+ #
63
74
  def smtp_message(options={},&block)
64
75
  Network::SMTP.message(options,&block)
65
76
  end
66
77
 
67
78
  #
68
- # Creates a connection to the SMTP server. The {#host}, {#port},
69
- # {#smtp_login}, {#smtp_user} and {#smtp_password} parameters
79
+ # Creates a connection to the SMTP server. The `host`, `port`,
80
+ # `smtp_login`, `smtp_user` and `smtp_password` parameters
70
81
  # will also be used to connect to the server.
71
82
  #
72
83
  # @param [Hash] options
@@ -97,6 +108,8 @@ module Ronin
97
108
  # @return [Net::SMTP]
98
109
  # The SMTP session.
99
110
  #
111
+ # @api public
112
+ #
100
113
  def smtp_connect(options={},&block)
101
114
  options[:port] ||= self.port
102
115
  options[:login] ||= self.smtp_login
@@ -113,8 +126,8 @@ module Ronin
113
126
  end
114
127
 
115
128
  #
116
- # Starts a session with the SMTP server. The {#host}, {#port},
117
- # {#smtp_login}, {#smtp_user} and {#smtp_password} parameters
129
+ # Starts a session with the SMTP server. The `host`, `port`,
130
+ # `smtp_login`, `smtp_user` and `smtp_password` parameters
118
131
  # will also be used to connect to the server.
119
132
  #
120
133
  # @yield [session]
@@ -126,6 +139,8 @@ module Ronin
126
139
  #
127
140
  # @see smtp_connect
128
141
  #
142
+ # @api public
143
+ #
129
144
  def smtp_session(options={},&block)
130
145
  smtp_connect(options) do |sess|
131
146
  yield sess if block_given?
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/network/tcp'
21
+ require 'ronin/ui/output/helpers'
22
+ require 'ronin/mixin'
21
23
 
22
24
  require 'parameters'
23
25
 
@@ -27,45 +29,52 @@ module Ronin
27
29
  #
28
30
  # Adds TCP convenience methods and connection parameters to a class.
29
31
  #
32
+ # Defines the following parameters:
33
+ #
34
+ # * `host` (`String`) - TCP host.
35
+ # * `port` (`Integer`) - TCP port.
36
+ # * `local_host` (`String`) - TCP local host.
37
+ # * `local_port` (`Integer`) - TCP local port.
38
+ # * `server_host` (`String`) - TCP server host.
39
+ # * `server_port` (`Integer`) - TCP server port.
40
+ #
30
41
  module TCP
31
- include Parameters
32
-
33
- # TCP host
34
- parameter :host,
35
- :type => String,
36
- :description => 'TCP host'
37
-
38
- # TCP port
39
- parameter :port,
40
- :type => Integer,
41
- :description => 'TCP port'
42
-
43
- # TCP local host
44
- parameter :local_host,
45
- :type => String,
46
- :description => 'TCP local host'
47
-
48
- # TCP local port
49
- parameter :local_port,
50
- :type => Integer,
51
- :description => 'TCP local port'
52
-
53
- # TCP server host
54
- parameter :server_host,
55
- :type => String,
56
- :description => 'TCP server host'
57
-
58
- # TCP server port
59
- parameter :server_port,
60
- :type => Integer,
61
- :description => 'TCP server port'
42
+ include Mixin
43
+
44
+ mixin UI::Output::Helpers, Parameters
45
+
46
+ mixin do
47
+ # TCP host
48
+ parameter :host, :type => String,
49
+ :description => 'TCP host'
50
+
51
+ # TCP port
52
+ parameter :port, :type => Integer,
53
+ :description => 'TCP port'
54
+
55
+ # TCP local host
56
+ parameter :local_host, :type => String,
57
+ :description => 'TCP local host'
58
+
59
+ # TCP local port
60
+ parameter :local_port, :type => Integer,
61
+ :description => 'TCP local port'
62
+
63
+ # TCP server host
64
+ parameter :server_host, :type => String,
65
+ :description => 'TCP server host'
66
+
67
+ # TCP server port
68
+ parameter :server_port, :type => Integer,
69
+ :description => 'TCP server port'
70
+ end
62
71
 
63
72
  protected
64
73
 
65
74
  #
66
75
  # Opens a TCP connection to the host and port specified by the
67
- # {#host} and {#port} parameters. If the {#local_host} and
68
- # {#local_port} parameters are set, they will be used for
76
+ # `host` and `port` parameters. If the `local_host` and
77
+ # `local_port` parameters are set, they will be used for
69
78
  # the local host and port of the TCP connection.
70
79
  #
71
80
  # @yield [socket]
@@ -87,6 +96,8 @@ module Ronin
87
96
  # sock.close
88
97
  # end
89
98
  #
99
+ # @api public
100
+ #
90
101
  def tcp_connect(&block)
91
102
  print_info "Connecting to #{self.host}:#{self.port} ..."
92
103
 
@@ -94,7 +105,7 @@ module Ronin
94
105
  end
95
106
 
96
107
  #
97
- # Connects to the host and port specified by the {#host} and {#port}
108
+ # Connects to the host and port specified by the `host` and `port`
98
109
  # parameters, then sends the given data.
99
110
  #
100
111
  # @param [String] data
@@ -109,6 +120,8 @@ module Ronin
109
120
  # @return [TCPSocket]
110
121
  # The newly created TCPSocket object.
111
122
  #
123
+ # @api public
124
+ #
112
125
  def tcp_connect_and_send(data,&block)
113
126
  print_info "Connecting to #{self.host}:#{self.port} ..."
114
127
  print_debug "Sending data: #{data.inspect}"
@@ -118,7 +131,7 @@ module Ronin
118
131
 
119
132
  #
120
133
  # Creates a TCP session to the host and port specified by the
121
- # {#host} and {#port} parameters.
134
+ # `host` and `port` parameters.
122
135
  #
123
136
  # @yield [socket]
124
137
  # If a block is given, it will be passed the newly created socket.
@@ -129,6 +142,8 @@ module Ronin
129
142
  #
130
143
  # @return [nil]
131
144
  #
145
+ # @api public
146
+ #
132
147
  def tcp_session(&block)
133
148
  print_info "Connecting to #{self.host}:#{self.port} ..."
134
149
 
@@ -139,7 +154,7 @@ module Ronin
139
154
  end
140
155
 
141
156
  #
142
- # Connects to the host and port specified by the {#host} and {#port}
157
+ # Connects to the host and port specified by the `host` and `port`
143
158
  # parameters, reads the banner then closes the connection.
144
159
  #
145
160
  # @yield [banner]
@@ -155,6 +170,8 @@ module Ronin
155
170
  # tcp_banner
156
171
  # # => "220 mx.google.com ESMTP c20sm3096959rvf.1"
157
172
  #
173
+ # @api public
174
+ #
158
175
  def tcp_banner(&block)
159
176
  print_debug "Grabbing banner from #{self.host}:#{self.port}"
160
177
 
@@ -162,7 +179,7 @@ module Ronin
162
179
  end
163
180
 
164
181
  #
165
- # Connects to the host and port specified by the {#host} and {#port}
182
+ # Connects to the host and port specified by the `host` and `port`
166
183
  # parameters, sends the given data and then disconnects.
167
184
  #
168
185
  # @return [true]
@@ -173,6 +190,8 @@ module Ronin
173
190
  # Net.tcp_send(buffer)
174
191
  # # => true
175
192
  #
193
+ # @api public
194
+ #
176
195
  def tcp_send(data)
177
196
  print_info "Connecting to #{self.host}:#{self.port} ..."
178
197
  print_debug "Sending data: #{data.inspect}"
@@ -184,8 +203,8 @@ module Ronin
184
203
  end
185
204
 
186
205
  #
187
- # Creates a new TCPServer object listening on the {#server_host}
188
- # and {#server_port} parameters.
206
+ # Creates a new TCPServer object listening on the `server_host`
207
+ # and `server_port` parameters.
189
208
  #
190
209
  # @yield [server]
191
210
  # The given block will be passed the newly created server.
@@ -199,6 +218,8 @@ module Ronin
199
218
  # @example
200
219
  # tcp_server
201
220
  #
221
+ # @api public
222
+ #
202
223
  def tcp_server(&block)
203
224
  if self.server_host
204
225
  print_info "Listening on #{self.server_host}:#{self.server_port} ..."
@@ -211,7 +232,7 @@ module Ronin
211
232
 
212
233
  #
213
234
  # Creates a new temporary TCPServer object listening on the
214
- # {#server_host} and {#server_port} parameters.
235
+ # `server_host` and `server_port` parameters.
215
236
  #
216
237
  # @yield [server]
217
238
  # The given block will be passed the newly created server.
@@ -233,6 +254,8 @@ module Ronin
233
254
  # client2.close
234
255
  # end
235
256
  #
257
+ # @api public
258
+ #
236
259
  def tcp_server_session(&block)
237
260
  if self.server_host
238
261
  print_info "Listening on #{self.server_host}:#{self.server_port} ..."
@@ -253,7 +276,7 @@ module Ronin
253
276
 
254
277
  #
255
278
  # Creates a new temporary TCPServer object listening on
256
- # {#server_host} and {#server_port} parameters.
279
+ # `server_host` and `server_port` parameters.
257
280
  # The TCPServer will accepting one client, pass the newly connected
258
281
  # client to a given block, disconnects the client and stops
259
282
  # listening.
@@ -273,6 +296,8 @@ module Ronin
273
296
  # client.puts 'lol'
274
297
  # end
275
298
  #
299
+ # @api public
300
+ #
276
301
  def tcp_single_server(&block)
277
302
  if self.server_host
278
303
  print_info "Listening on #{self.server_host}:#{self.server_port} ..."