ronin-support 0.4.0.rc1 → 0.4.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.yardopts +1 -0
  2. data/ChangeLog.md +10 -0
  3. data/Gemfile +1 -1
  4. data/README.md +1 -1
  5. data/Rakefile +8 -0
  6. data/gemspec.yml +2 -1
  7. data/lib/ronin/extensions.rb +1 -1
  8. data/lib/ronin/extensions/enumerable.rb +1 -1
  9. data/lib/ronin/extensions/file.rb +1 -1
  10. data/lib/ronin/extensions/ip_addr.rb +1 -1
  11. data/lib/ronin/extensions/kernel.rb +1 -1
  12. data/lib/ronin/extensions/meta.rb +1 -1
  13. data/lib/ronin/extensions/regexp.rb +1 -1
  14. data/lib/ronin/extensions/resolv.rb +1 -1
  15. data/lib/ronin/extensions/string.rb +1 -1
  16. data/lib/ronin/formatting.rb +1 -1
  17. data/lib/ronin/formatting/binary.rb +1 -1
  18. data/lib/ronin/formatting/digest.rb +1 -1
  19. data/lib/ronin/formatting/extensions.rb +1 -1
  20. data/lib/ronin/formatting/extensions/binary.rb +1 -1
  21. data/lib/ronin/formatting/extensions/binary/file.rb +1 -1
  22. data/lib/ronin/formatting/extensions/binary/integer.rb +1 -1
  23. data/lib/ronin/formatting/extensions/binary/string.rb +1 -1
  24. data/lib/ronin/formatting/extensions/digest.rb +1 -1
  25. data/lib/ronin/formatting/extensions/digest/file.rb +1 -1
  26. data/lib/ronin/formatting/extensions/digest/string.rb +1 -1
  27. data/lib/ronin/formatting/extensions/html.rb +1 -1
  28. data/lib/ronin/formatting/extensions/html/integer.rb +1 -1
  29. data/lib/ronin/formatting/extensions/html/string.rb +1 -1
  30. data/lib/ronin/formatting/extensions/http.rb +1 -1
  31. data/lib/ronin/formatting/extensions/http/integer.rb +1 -1
  32. data/lib/ronin/formatting/extensions/http/string.rb +1 -1
  33. data/lib/ronin/formatting/extensions/sql.rb +1 -1
  34. data/lib/ronin/formatting/extensions/sql/string.rb +1 -1
  35. data/lib/ronin/formatting/extensions/text.rb +1 -1
  36. data/lib/ronin/formatting/extensions/text/array.rb +1 -1
  37. data/lib/ronin/formatting/extensions/text/string.rb +1 -1
  38. data/lib/ronin/formatting/html.rb +1 -1
  39. data/lib/ronin/formatting/http.rb +1 -1
  40. data/lib/ronin/formatting/sql.rb +1 -1
  41. data/lib/ronin/formatting/text.rb +1 -1
  42. data/lib/ronin/fuzzing.rb +1 -1
  43. data/lib/ronin/fuzzing/extensions.rb +1 -1
  44. data/lib/ronin/fuzzing/extensions/string.rb +1 -1
  45. data/lib/ronin/fuzzing/fuzzing.rb +1 -1
  46. data/lib/ronin/mixin.rb +1 -1
  47. data/lib/ronin/network.rb +1 -1
  48. data/lib/ronin/network/esmtp.rb +1 -1
  49. data/lib/ronin/network/extensions.rb +1 -1
  50. data/lib/ronin/network/extensions/esmtp.rb +1 -1
  51. data/lib/ronin/network/extensions/esmtp/net.rb +1 -1
  52. data/lib/ronin/network/extensions/http.rb +1 -1
  53. data/lib/ronin/network/extensions/http/net.rb +1 -1
  54. data/lib/ronin/network/extensions/http/uri/http.rb +1 -1
  55. data/lib/ronin/network/extensions/imap.rb +1 -1
  56. data/lib/ronin/network/extensions/imap/net.rb +1 -1
  57. data/lib/ronin/network/extensions/pop3.rb +1 -1
  58. data/lib/ronin/network/extensions/pop3/net.rb +1 -1
  59. data/lib/ronin/network/extensions/smtp.rb +1 -1
  60. data/lib/ronin/network/extensions/smtp/net.rb +1 -1
  61. data/lib/ronin/network/extensions/ssl.rb +1 -1
  62. data/lib/ronin/network/extensions/ssl/net.rb +1 -1
  63. data/lib/ronin/network/extensions/tcp.rb +1 -1
  64. data/lib/ronin/network/extensions/tcp/net.rb +1 -1
  65. data/lib/ronin/network/extensions/telnet.rb +1 -1
  66. data/lib/ronin/network/extensions/telnet/net.rb +1 -1
  67. data/lib/ronin/network/extensions/udp.rb +1 -1
  68. data/lib/ronin/network/extensions/udp/net.rb +1 -1
  69. data/lib/ronin/network/http.rb +1 -1
  70. data/lib/ronin/network/http/exceptions.rb +1 -1
  71. data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
  72. data/lib/ronin/network/http/http.rb +103 -72
  73. data/lib/ronin/network/http/proxy.rb +1 -1
  74. data/lib/ronin/network/imap.rb +1 -1
  75. data/lib/ronin/network/mixins.rb +1 -1
  76. data/lib/ronin/network/mixins/esmtp.rb +1 -1
  77. data/lib/ronin/network/mixins/http.rb +3 -3
  78. data/lib/ronin/network/mixins/imap.rb +1 -1
  79. data/lib/ronin/network/mixins/mixin.rb +1 -1
  80. data/lib/ronin/network/mixins/pop3.rb +1 -1
  81. data/lib/ronin/network/mixins/smtp.rb +1 -1
  82. data/lib/ronin/network/mixins/ssl.rb +144 -0
  83. data/lib/ronin/network/mixins/tcp.rb +6 -5
  84. data/lib/ronin/network/mixins/telnet.rb +1 -1
  85. data/lib/ronin/network/mixins/udp.rb +29 -3
  86. data/lib/ronin/network/network.rb +1 -1
  87. data/lib/ronin/network/pop3.rb +1 -1
  88. data/lib/ronin/network/smtp.rb +1 -1
  89. data/lib/ronin/network/smtp/email.rb +1 -1
  90. data/lib/ronin/network/smtp/smtp.rb +1 -1
  91. data/lib/ronin/network/ssl.rb +3 -6
  92. data/lib/ronin/network/tcp.rb +27 -28
  93. data/lib/ronin/network/telnet.rb +1 -1
  94. data/lib/ronin/network/udp.rb +56 -19
  95. data/lib/ronin/path.rb +1 -1
  96. data/lib/ronin/spec/ui/output.rb +1 -1
  97. data/lib/ronin/support.rb +1 -1
  98. data/lib/ronin/support/inflector.rb +1 -1
  99. data/lib/ronin/support/support.rb +1 -1
  100. data/lib/ronin/support/version.rb +2 -2
  101. data/lib/ronin/templates.rb +1 -1
  102. data/lib/ronin/templates/erb.rb +1 -1
  103. data/lib/ronin/templates/template.rb +1 -1
  104. data/lib/ronin/ui/output.rb +1 -1
  105. data/lib/ronin/ui/output/helpers.rb +1 -1
  106. data/lib/ronin/ui/output/output.rb +1 -1
  107. data/lib/ronin/ui/output/terminal.rb +1 -1
  108. data/lib/ronin/ui/output/terminal/color.rb +1 -1
  109. data/lib/ronin/ui/output/terminal/raw.rb +1 -1
  110. data/lib/ronin/ui/shell.rb +67 -7
  111. data/lib/ronin/wordlist.rb +51 -1
  112. data/spec/extensions/ip_addr_spec.rb +1 -1
  113. data/spec/network/http/http_spec.rb +193 -0
  114. data/spec/network/tcp_spec.rb +244 -0
  115. data/spec/network/udp_spec.rb +245 -0
  116. data/spec/spec_helper.rb +5 -0
  117. data/spec/ui/shell_spec.rb +7 -3
  118. data/spec/wordlist_spec.rb +25 -0
  119. metadata +35 -19
@@ -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 Support.
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 Support.
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 Support.
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 Support.
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 Support.
5
5
  #
@@ -122,9 +122,9 @@ module Ronin
122
122
  print_info "Starting HTTP Session with #{host_port}"
123
123
 
124
124
  if block.arity == 2
125
- block.call(sess,expanded_options)
125
+ block.call(http,expanded_options)
126
126
  else
127
- block.call(sess)
127
+ block.call(http)
128
128
  end
129
129
 
130
130
  print_info "Closing HTTP Session with #{host_port}"
@@ -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 Support.
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 Support.
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 Support.
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 Support.
5
5
  #
@@ -0,0 +1,144 @@
1
+ #
2
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ #
4
+ # This file is part of Ronin Support.
5
+ #
6
+ # Ronin Support is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published
8
+ # by the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Ronin Support 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 Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License
17
+ # along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ require 'ronin/network/mixins/mixin'
21
+ require 'ronin/network/ssl'
22
+
23
+ module Ronin
24
+ module Network
25
+ module Mixins
26
+ #
27
+ # Adds SSL convenience methods and connection parameters to a class.
28
+ #
29
+ # Defines the following parameters:
30
+ #
31
+ # * `host` (`String`) - SSL host.
32
+ # * `port` (`Integer`) - SSL port.
33
+ # * `local_host` (`String`) - SSL local host.
34
+ # * `local_port` (`Integer`) - SSL local port.
35
+ #
36
+ # @since 0.4.0
37
+ #
38
+ module SSL
39
+ include Mixin, Network::SSL
40
+
41
+ # SSL host
42
+ parameter :host, :type => String,
43
+ :description => 'SSL host'
44
+
45
+ # SSL port
46
+ parameter :port, :type => Integer,
47
+ :description => 'SSL port'
48
+
49
+ # SSL local host
50
+ parameter :local_host, :type => String,
51
+ :description => 'SSL local host'
52
+
53
+ # SSL local port
54
+ parameter :local_port, :type => Integer,
55
+ :description => 'SSL local port'
56
+
57
+ protected
58
+
59
+ #
60
+ # Establishes a SSL connection.
61
+ #
62
+ # @option options [Symbol] :verify
63
+ # Specifies whether to verify the SSL certificate.
64
+ # May be one of the following:
65
+ #
66
+ # * `:none`
67
+ # * `:peer`
68
+ # * `:client_once`
69
+ # * `:fail_if_no_peer_cert`
70
+ #
71
+ # @option options [String] :cert
72
+ # The path to the SSL certificate.
73
+ #
74
+ # @option options [String] :key
75
+ # The path to the SSL key.
76
+ #
77
+ # @yield [ssl_socket]
78
+ # The given block will be passed the new SSL Socket.
79
+ #
80
+ # @yieldparam [OpenSSL::SSL::SSLSocket] ssl_socket
81
+ # The new SSL Socket.
82
+ #
83
+ # @return [OpenSSL::SSL::SSLSocket]
84
+ # the new SSL Socket.
85
+ #
86
+ # @example
87
+ # socket = ssl_connect
88
+ #
89
+ # @api public
90
+ #
91
+ def ssl_connect(host,port,options={},&block)
92
+ options = options.merge(
93
+ :local_host => self.local_host,
94
+ :local_port => self.local_port
95
+ )
96
+
97
+ super(self.host,self.port,options,&block)
98
+ end
99
+
100
+ #
101
+ # Creates a new temporary SSL connection.
102
+ #
103
+ # @param [Hash] options
104
+ # Additional options.
105
+ #
106
+ # @option options [String] :local_host
107
+ # The local host to bind to.
108
+ #
109
+ # @option options [Integer] :local_port
110
+ # The local port to bind to.
111
+ #
112
+ # @option options [Symbol] :verify
113
+ # Specifies whether to verify the SSL certificate.
114
+ #
115
+ # @option options [String] :cert
116
+ # The path to the SSL certificate.
117
+ #
118
+ # @option options [String] :key
119
+ # The path to the SSL key.
120
+ #
121
+ # @yield [ssl_socket]
122
+ # The given block will be passed the temporary SSL Socket.
123
+ #
124
+ # @yieldparam [OpenSSL::SSL::SSLSocket] ssl_socket
125
+ # The temporary SSL Socket.
126
+ #
127
+ # @return [nil]
128
+ #
129
+ # @example
130
+ # ssl_session do |socket|
131
+ # socket.write("GET /\n\n")
132
+ #
133
+ # socket.each_line { |line| puts line }
134
+ # end
135
+ #
136
+ # @api public
137
+ #
138
+ def ssl_session(options={},&block)
139
+ super(self.host,self.port,options,&block)
140
+ end
141
+ end
142
+ end
143
+ end
144
+ 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 Support.
5
5
  #
@@ -83,10 +83,11 @@ module Ronin
83
83
  # tcp_connect # => TCPSocket
84
84
  #
85
85
  # @example
86
- # tcp_connect do |sock|
87
- # sock.write("GET /\n\n")
88
- # puts sock.readlines
89
- # sock.close
86
+ # tcp_connect do |socket|
87
+ # socket.write("GET /\n\n")
88
+ #
89
+ # puts socket.readlines
90
+ # socket.close
90
91
  # end
91
92
  #
92
93
  # @api public
@@ -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 Support.
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 Support.
5
5
  #
@@ -84,8 +84,8 @@ module Ronin
84
84
  # # => UDPSocket
85
85
  #
86
86
  # @example
87
- # udp_connect do |sock|
88
- # puts sock.readlines
87
+ # udp_connect do |socket|
88
+ # puts socket.readlines
89
89
  # end
90
90
  #
91
91
  # @api public
@@ -149,6 +149,32 @@ module Ronin
149
149
  return nil
150
150
  end
151
151
 
152
+ #
153
+ # Connects to the host and port specified by the `host` and `port`
154
+ # parameters, sends the given data and then disconnects.
155
+ #
156
+ # @return [true]
157
+ # The data was successfully sent.
158
+ #
159
+ # @example
160
+ # buffer = "GET /" + ('A' * 4096) + "\n\r"
161
+ # Net.udp_send(buffer)
162
+ # # => true
163
+ #
164
+ # @api public
165
+ #
166
+ # @since 0.4.0
167
+ #
168
+ def udp_send(data)
169
+ print_info "Connecting to #{host_port} ..."
170
+ print_debug "Sending data: #{data.inspect}"
171
+
172
+ super(data,self.host,self.port,self.local_host,self.local_port)
173
+
174
+ print_info "Disconnected from #{host_port}"
175
+ return true
176
+ end
177
+
152
178
  #
153
179
  # Creates a new UDPServer object listening on `server_host` and
154
180
  # `server_port` parameters.
@@ -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 Support.
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 Support.
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 Support.
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 Support.
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 Support.
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 Support.
5
5
  #
@@ -173,11 +173,8 @@ module Ronin
173
173
  #
174
174
  # @api public
175
175
  #
176
- def ssl_session(host,port)
177
- ssl_socket = ssl_connect(host,port)
178
-
179
- yield ssl_socket if block_given?
180
-
176
+ def ssl_session(host,port,options={},&block)
177
+ ssl_socket = ssl_connect(host,port,options,&block)
181
178
  ssl_socket.close
182
179
  return nil
183
180
  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 Support.
5
5
  #
@@ -34,7 +34,7 @@ module Ronin
34
34
  # @param [Integer] port
35
35
  # The port to connect to.
36
36
  #
37
- # @param [String] local_host (nil)
37
+ # @param [String] local_host ('0.0.0.0')
38
38
  # The local host to bind to.
39
39
  #
40
40
  # @param [Integer] local_port (nil)
@@ -53,24 +53,23 @@ module Ronin
53
53
  # tcp_connect('www.hackety.org',80) # => TCPSocket
54
54
  #
55
55
  # @example
56
- # tcp_connect('www.wired.com',80) do |sock|
57
- # sock.write("GET /\n\n")
58
- # puts sock.readlines
59
- # sock.close
56
+ # tcp_connect('www.wired.com',80) do |socket|
57
+ # socket.write("GET /\n\n")
58
+ #
59
+ # puts socket.readlines
60
+ # socket.close
60
61
  # end
61
62
  #
62
63
  # @api public
63
64
  #
64
65
  def tcp_connect(host,port,local_host=nil,local_port=nil)
65
- host = host.to_s
66
- local_host = if local_host
67
- local_host.to_s
68
- end
66
+ host = host.to_s
67
+ local_host = (local_host || '0.0.0.0').to_s
69
68
 
70
- sock = TCPSocket.new(host,port,local_host,local_port)
69
+ socket = TCPSocket.new(host,port,local_host,local_port)
71
70
 
72
- yield sock if block_given?
73
- return sock
71
+ yield socket if block_given?
72
+ return socket
74
73
  end
75
74
 
76
75
  #
@@ -101,11 +100,11 @@ module Ronin
101
100
  # @api public
102
101
  #
103
102
  def tcp_connect_and_send(data,host,port,local_host=nil,local_port=nil)
104
- sock = tcp_connect(host,port,local_host,local_port)
105
- sock.write(data)
103
+ socket = tcp_connect(host,port,local_host,local_port)
104
+ socket.write(data)
106
105
 
107
- yield sock if block_given?
108
- return sock
106
+ yield socket if block_given?
107
+ return socket
109
108
  end
110
109
 
111
110
  #
@@ -136,11 +135,11 @@ module Ronin
136
135
  # @api public
137
136
  #
138
137
  def tcp_session(host,port,local_host=nil,local_port=nil)
139
- sock = tcp_connect(host,port,local_host,local_port)
138
+ socket = tcp_connect(host,port,local_host,local_port)
140
139
 
141
- yield sock if block_given?
140
+ yield socket if block_given?
142
141
 
143
- sock.close
142
+ socket.close
144
143
  return nil
145
144
  end
146
145
 
@@ -177,8 +176,8 @@ module Ronin
177
176
  def tcp_banner(host,port,local_host=nil,local_port=nil)
178
177
  banner = nil
179
178
 
180
- tcp_session(host,port,local_host,local_port) do |sock|
181
- banner = sock.readline.strip
179
+ tcp_session(host,port,local_host,local_port) do |socket|
180
+ banner = socket.readline.strip
182
181
  end
183
182
 
184
183
  yield banner if block_given?
@@ -215,8 +214,8 @@ module Ronin
215
214
  # @api public
216
215
  #
217
216
  def tcp_send(data,host,port,local_host=nil,local_port=nil)
218
- tcp_session(host,port,local_host,local_port) do |sock|
219
- sock.write(data)
217
+ tcp_session(host,port,local_host,local_port) do |socket|
218
+ socket.write(data)
220
219
  end
221
220
 
222
221
  return true
@@ -239,8 +238,8 @@ module Ronin
239
238
  #
240
239
  # @api public
241
240
  #
242
- def tcp_server(port,host='0.0.0.0')
243
- host = host.to_s
241
+ def tcp_server(port=nil,host=nil)
242
+ host = (host || '0.0.0.0').to_s
244
243
 
245
244
  server = TCPServer.new(host,port)
246
245
  server.listen(3)
@@ -280,7 +279,7 @@ module Ronin
280
279
  #
281
280
  # @api public
282
281
  #
283
- def tcp_server_session(port,host='0.0.0.0',&block)
282
+ def tcp_server_session(port=nil,host=nil,&block)
284
283
  server = tcp_server(port,host,&block)
285
284
  server.close()
286
285
  return nil
@@ -306,7 +305,7 @@ module Ronin
306
305
  #
307
306
  # @api public
308
307
  #
309
- def tcp_single_server(port,host='0.0.0.0')
308
+ def tcp_single_server(port=nil,host=nil)
310
309
  host = host.to_s
311
310
 
312
311
  server = TCPServer.new(host,port)