ronin-support 0.3.0 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +77 -7
- data/README.md +19 -3
- data/gemspec.yml +2 -2
- data/lib/ronin/extensions/regexp.rb +50 -2
- data/lib/ronin/extensions/string.rb +1 -0
- data/lib/ronin/formatting.rb +1 -0
- data/lib/ronin/formatting/extensions.rb +1 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +56 -5
- data/lib/ronin/formatting/extensions/html/string.rb +6 -7
- data/lib/ronin/formatting/extensions/sql/string.rb +34 -0
- data/lib/ronin/formatting/extensions/text/string.rb +0 -180
- data/lib/ronin/fuzzing.rb +21 -0
- data/lib/ronin/fuzzing/extensions.rb +20 -0
- data/lib/ronin/fuzzing/extensions/string.rb +380 -0
- data/lib/ronin/fuzzing/fuzzing.rb +191 -0
- data/lib/ronin/network/esmtp.rb +94 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +2 -82
- data/lib/ronin/network/extensions/http/net.rb +1 -736
- data/lib/ronin/network/extensions/imap/net.rb +1 -103
- data/lib/ronin/network/extensions/pop3/net.rb +1 -71
- data/lib/ronin/network/extensions/smtp/net.rb +2 -157
- data/lib/ronin/network/extensions/ssl/net.rb +1 -132
- data/lib/ronin/network/extensions/tcp/net.rb +2 -296
- data/lib/ronin/network/extensions/telnet/net.rb +1 -135
- data/lib/ronin/network/extensions/udp/net.rb +2 -214
- data/lib/ronin/network/http/http.rb +750 -5
- data/lib/ronin/network/imap.rb +105 -2
- data/lib/ronin/network/mixins.rb +1 -1
- data/lib/ronin/network/mixins/esmtp.rb +49 -52
- data/lib/ronin/network/mixins/http.rb +49 -53
- data/lib/ronin/network/mixins/imap.rb +47 -44
- data/lib/ronin/network/mixins/mixin.rb +58 -0
- data/lib/ronin/network/mixins/pop3.rb +44 -38
- data/lib/ronin/network/mixins/smtp.rb +49 -51
- data/lib/ronin/network/mixins/tcp.rb +56 -69
- data/lib/ronin/network/mixins/telnet.rb +57 -50
- data/lib/ronin/network/mixins/udp.rb +48 -52
- data/lib/ronin/network/network.rb +1 -0
- data/lib/ronin/network/pop3.rb +72 -2
- data/lib/ronin/network/smtp/email.rb +1 -0
- data/lib/ronin/network/smtp/smtp.rb +159 -3
- data/lib/ronin/network/ssl.rb +131 -2
- data/lib/ronin/network/tcp.rb +306 -1
- data/lib/ronin/network/telnet.rb +136 -2
- data/lib/ronin/network/udp.rb +229 -1
- data/lib/ronin/support.rb +2 -3
- data/lib/ronin/support/support.rb +38 -0
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/templates/erb.rb +2 -1
- data/lib/ronin/ui/output/helpers.rb +35 -1
- data/lib/ronin/ui/shell.rb +12 -2
- data/lib/ronin/wordlist.rb +157 -0
- data/spec/extensions/regexp_spec.rb +38 -0
- data/spec/formatting/html/string_spec.rb +1 -1
- data/spec/formatting/sql/string_spec.rb +23 -3
- data/spec/formatting/text/string_spec.rb +0 -110
- data/spec/fuzzing/string_spec.rb +158 -0
- data/spec/wordlist_spec.rb +65 -0
- metadata +35 -27
@@ -17,11 +17,8 @@
|
|
17
17
|
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
+
require 'ronin/network/mixins/mixin'
|
20
21
|
require 'ronin/network/imap'
|
21
|
-
require 'ronin/ui/output/helpers'
|
22
|
-
require 'ronin/mixin'
|
23
|
-
|
24
|
-
require 'parameters'
|
25
22
|
|
26
23
|
module Ronin
|
27
24
|
module Network
|
@@ -38,31 +35,27 @@ module Ronin
|
|
38
35
|
# * `imap_password` (`String`) - IMAP password to login with.
|
39
36
|
#
|
40
37
|
module IMAP
|
41
|
-
include Mixin
|
42
|
-
|
43
|
-
mixin UI::Output::Helpers, Parameters
|
38
|
+
include Mixin, Network::IMAP
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
:description => 'IMAP host'
|
40
|
+
# IMAP host
|
41
|
+
parameter :host, :type => String,
|
42
|
+
:description => 'IMAP host'
|
49
43
|
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
# IMAP port
|
45
|
+
parameter :port, :type => Integer,
|
46
|
+
:description => 'IMAP port'
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
# IMAP auth
|
49
|
+
parameter :imap_auth, :type => String,
|
50
|
+
:description => 'IMAP authentication method'
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
# IMAP user to login as
|
53
|
+
parameter :imap_user, :type => String,
|
54
|
+
:description => 'IMAP user to login as'
|
61
55
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
56
|
+
# IMAP password to login with
|
57
|
+
parameter :imap_password, :type => String,
|
58
|
+
:description => 'IMAP password to login with'
|
66
59
|
|
67
60
|
protected
|
68
61
|
|
@@ -98,18 +91,9 @@ module Ronin
|
|
98
91
|
# @api public
|
99
92
|
#
|
100
93
|
def imap_connect(options={},&block)
|
101
|
-
|
102
|
-
options[:auth] ||= self.imap_auth
|
103
|
-
options[:user] ||= self.imap_user
|
104
|
-
options[:password] ||= self.imap_password
|
94
|
+
print_info "Connecting to #{host_port} ..."
|
105
95
|
|
106
|
-
|
107
|
-
print_info "Connecting to #{self.host}:#{self.port} ..."
|
108
|
-
else
|
109
|
-
print_info "Connecting to #{self.host} ..."
|
110
|
-
end
|
111
|
-
|
112
|
-
return ::Net.imap_connect(self.host,options,&block)
|
96
|
+
return super(self.host,imap_merge_options(options),&block)
|
113
97
|
end
|
114
98
|
|
115
99
|
#
|
@@ -130,20 +114,39 @@ module Ronin
|
|
130
114
|
# @api public
|
131
115
|
#
|
132
116
|
def imap_session(options={})
|
133
|
-
|
117
|
+
super(imap_merge_options(options)) do |sess|
|
134
118
|
yield sess if block_given?
|
135
119
|
|
136
120
|
print_info "Logging out ..."
|
121
|
+
end
|
137
122
|
|
138
|
-
|
139
|
-
|
123
|
+
print_info "Disconnected from #{host_port}"
|
124
|
+
return il
|
125
|
+
end
|
140
126
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
127
|
+
private
|
128
|
+
|
129
|
+
#
|
130
|
+
# Merges the IMAP parameters into the options for {Network::IMAP}
|
131
|
+
# methods.
|
132
|
+
#
|
133
|
+
# @param [Hash] options
|
134
|
+
# The original options.
|
135
|
+
#
|
136
|
+
# @return [Hash]
|
137
|
+
# The merged options.
|
138
|
+
#
|
139
|
+
# @since 0.4.0
|
140
|
+
#
|
141
|
+
# @api private
|
142
|
+
#
|
143
|
+
def imap_merge_options(options={})
|
144
|
+
options[:port] ||= self.port
|
145
|
+
options[:auth] ||= self.imap_auth
|
146
|
+
options[:user] ||= self.imap_user
|
147
|
+
options[:password] ||= self.imap_password
|
148
|
+
|
149
|
+
return options
|
147
150
|
end
|
148
151
|
end
|
149
152
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2006-2011 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/ui/output/helpers'
|
21
|
+
|
22
|
+
require 'parameters'
|
23
|
+
|
24
|
+
module Ronin
|
25
|
+
module Network
|
26
|
+
module Mixins
|
27
|
+
#
|
28
|
+
# @since 0.4.0
|
29
|
+
#
|
30
|
+
module Mixin
|
31
|
+
include Parameters,
|
32
|
+
UI::Output::Helpers
|
33
|
+
|
34
|
+
parameter :host, :type => String
|
35
|
+
|
36
|
+
parameter :port, :type => Integer
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
#
|
41
|
+
# The host/port parameters.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
# The host/port parameters in String form.
|
45
|
+
#
|
46
|
+
# @api semipublic
|
47
|
+
#
|
48
|
+
def host_port
|
49
|
+
if self.port
|
50
|
+
"#{self.host}:#{self.port}"
|
51
|
+
else
|
52
|
+
"#{self.host}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -17,11 +17,8 @@
|
|
17
17
|
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
+
require 'ronin/network/mixins/mixin'
|
20
21
|
require 'ronin/network/pop3'
|
21
|
-
require 'ronin/ui/output/helpers'
|
22
|
-
require 'ronin/mixin'
|
23
|
-
|
24
|
-
require 'parameters'
|
25
22
|
|
26
23
|
module Ronin
|
27
24
|
module Network
|
@@ -37,27 +34,23 @@ module Ronin
|
|
37
34
|
# * `pop3_password` (`String`) - POP3 password to login with.
|
38
35
|
#
|
39
36
|
module POP3
|
40
|
-
include Mixin
|
41
|
-
|
42
|
-
mixin UI::Output::Helpers, Parameters
|
37
|
+
include Mixin, Network::POP3
|
43
38
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
:description => 'POP3 host'
|
39
|
+
# POP3 host
|
40
|
+
parameter :host, :type => String,
|
41
|
+
:description => 'POP3 host'
|
48
42
|
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
# POP3 port
|
44
|
+
parameter :port, :type => Integer,
|
45
|
+
:description => 'POP3 port'
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
47
|
+
# POP3 user
|
48
|
+
parameter :pop3_user, :type => String,
|
49
|
+
:description => 'POP3 user to login as'
|
56
50
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
51
|
+
# POP3 password
|
52
|
+
parameter :pop3_password, :type => String,
|
53
|
+
:description => 'POP3 password to login with'
|
61
54
|
|
62
55
|
protected
|
63
56
|
|
@@ -93,17 +86,9 @@ module Ronin
|
|
93
86
|
# @api public
|
94
87
|
#
|
95
88
|
def pop3_connect(options={},&block)
|
96
|
-
|
97
|
-
options[:user] ||= self.pop3_user
|
98
|
-
options[:password] ||= self.pop3_password
|
89
|
+
print_info "Connecting to #{host_port} ..."
|
99
90
|
|
100
|
-
|
101
|
-
print_info "Connecting to #{self.host}:#{self.port} ..."
|
102
|
-
else
|
103
|
-
print_info "Connecting to #{self.host} ..."
|
104
|
-
end
|
105
|
-
|
106
|
-
return ::Net.pop3_connect(self.host,options,&block)
|
91
|
+
return super(self.host,pop3_merge_options(options),&block)
|
107
92
|
end
|
108
93
|
|
109
94
|
#
|
@@ -124,16 +109,37 @@ module Ronin
|
|
124
109
|
# @api public
|
125
110
|
#
|
126
111
|
def pop3_session(options={})
|
127
|
-
|
112
|
+
super(options) do |sess|
|
128
113
|
yield sess if block_given?
|
129
|
-
sess.finish
|
130
114
|
|
131
|
-
|
132
|
-
print_info "Disconnecting to #{self.host}:#{self.port}"
|
133
|
-
else
|
134
|
-
print_info "Disconnecting to #{self.host}"
|
135
|
-
end
|
115
|
+
print_info "Logging out ..."
|
136
116
|
end
|
117
|
+
|
118
|
+
print_info "Disconnected to #{host_port}"
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
#
|
124
|
+
# Merges the POP3 parameters into the options for {Network::POP3}
|
125
|
+
# methods.
|
126
|
+
#
|
127
|
+
# @param [Hash] options
|
128
|
+
# The original options.
|
129
|
+
#
|
130
|
+
# @return [Hash]
|
131
|
+
# The merged options.
|
132
|
+
#
|
133
|
+
# @since 0.4.0
|
134
|
+
#
|
135
|
+
# @api private
|
136
|
+
#
|
137
|
+
def pop3_merge_options(options={})
|
138
|
+
options[:port] ||= self.port
|
139
|
+
options[:user] ||= self.pop3_user
|
140
|
+
options[:password] ||= self.pop3_password
|
141
|
+
|
142
|
+
return options
|
137
143
|
end
|
138
144
|
end
|
139
145
|
end
|
@@ -17,11 +17,8 @@
|
|
17
17
|
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
+
require 'ronin/network/mixins/mixin'
|
20
21
|
require 'ronin/network/smtp'
|
21
|
-
require 'ronin/ui/output/helpers'
|
22
|
-
require 'ronin/mixin'
|
23
|
-
|
24
|
-
require 'parameters'
|
25
22
|
|
26
23
|
module Ronin
|
27
24
|
module Network
|
@@ -38,43 +35,30 @@ module Ronin
|
|
38
35
|
# * `smtp_password` (`String`) - SMTP password to login with.
|
39
36
|
#
|
40
37
|
module SMTP
|
41
|
-
include Mixin
|
42
|
-
|
43
|
-
mixin UI::Output::Helpers, Parameters
|
38
|
+
include Mixin, Network::SMTP
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
:description => 'SMTP host'
|
40
|
+
# SMTP host
|
41
|
+
parameter :host, :type => String,
|
42
|
+
:description => 'SMTP host'
|
49
43
|
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
# SMTP port
|
45
|
+
parameter :port, :type => Integer,
|
46
|
+
:description => 'SMTP port'
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
# SMTP authentication method
|
49
|
+
parameter :smtp_login, :type => String,
|
50
|
+
:description => 'SMTP authentication method'
|
57
51
|
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
# SMTP user to login as
|
53
|
+
parameter :smtp_user, :type => String,
|
54
|
+
:description => 'SMTP user to login as'
|
61
55
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
56
|
+
# SMTP user to login with
|
57
|
+
parameter :smtp_password, :type => String,
|
58
|
+
:description => 'SMTP password to login with'
|
66
59
|
|
67
60
|
protected
|
68
61
|
|
69
|
-
#
|
70
|
-
# @see Ronin::Network::SMTP.message
|
71
|
-
#
|
72
|
-
# @api public
|
73
|
-
#
|
74
|
-
def smtp_message(options={},&block)
|
75
|
-
Network::SMTP.message(options,&block)
|
76
|
-
end
|
77
|
-
|
78
62
|
#
|
79
63
|
# Creates a connection to the SMTP server. The `host`, `port`,
|
80
64
|
# `smtp_login`, `smtp_user` and `smtp_password` parameters
|
@@ -111,18 +95,9 @@ module Ronin
|
|
111
95
|
# @api public
|
112
96
|
#
|
113
97
|
def smtp_connect(options={},&block)
|
114
|
-
|
115
|
-
options[:login] ||= self.smtp_login
|
116
|
-
options[:user] ||= self.smtp_user
|
117
|
-
options[:password] ||= self.smtp_password
|
118
|
-
|
119
|
-
if self.port
|
120
|
-
print_info "Connecting to #{self.host}:#{self.port} ..."
|
121
|
-
else
|
122
|
-
print_info "Connecting to #{self.host} ..."
|
123
|
-
end
|
98
|
+
print_info "Connecting to #{host_port} ..."
|
124
99
|
|
125
|
-
return
|
100
|
+
return super(self.host,smtp_merge_options(options),&block)
|
126
101
|
end
|
127
102
|
|
128
103
|
#
|
@@ -142,16 +117,39 @@ module Ronin
|
|
142
117
|
# @api public
|
143
118
|
#
|
144
119
|
def smtp_session(options={},&block)
|
145
|
-
|
120
|
+
super(smtp_merge_options(options)) do |sess|
|
146
121
|
yield sess if block_given?
|
147
|
-
sess.close
|
148
122
|
|
149
|
-
|
150
|
-
print_info "Disconnecting to #{self.host}:#{self.port}"
|
151
|
-
else
|
152
|
-
print_info "Disconnecting to #{self.host}"
|
153
|
-
end
|
123
|
+
print_info "Logging out ..."
|
154
124
|
end
|
125
|
+
|
126
|
+
print_info "Disconnected to #{host_port}"
|
127
|
+
return nil
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
#
|
133
|
+
# Merges the SMTP parameters into the options for {Network::SMTP}
|
134
|
+
# methods.
|
135
|
+
#
|
136
|
+
# @param [Hash] options
|
137
|
+
# The original options.
|
138
|
+
#
|
139
|
+
# @return [Hash]
|
140
|
+
# The merged options.
|
141
|
+
#
|
142
|
+
# @since 0.4.0
|
143
|
+
#
|
144
|
+
# @api private
|
145
|
+
#
|
146
|
+
def smtp_merge_options(options={})
|
147
|
+
options[:port] ||= self.port
|
148
|
+
options[:login] ||= self.smtp_login
|
149
|
+
options[:user] ||= self.smtp_user
|
150
|
+
options[:password] ||= self.smtp_password
|
151
|
+
|
152
|
+
return options
|
155
153
|
end
|
156
154
|
end
|
157
155
|
end
|
@@ -17,11 +17,8 @@
|
|
17
17
|
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
|
+
require 'ronin/network/mixins/mixin'
|
20
21
|
require 'ronin/network/tcp'
|
21
|
-
require 'ronin/ui/output/helpers'
|
22
|
-
require 'ronin/mixin'
|
23
|
-
|
24
|
-
require 'parameters'
|
25
22
|
|
26
23
|
module Ronin
|
27
24
|
module Network
|
@@ -39,35 +36,31 @@ module Ronin
|
|
39
36
|
# * `server_port` (`Integer`) - TCP server port.
|
40
37
|
#
|
41
38
|
module TCP
|
42
|
-
include Mixin
|
43
|
-
|
44
|
-
mixin UI::Output::Helpers, Parameters
|
39
|
+
include Mixin, Network::TCP
|
45
40
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
:description => 'TCP host'
|
41
|
+
# TCP host
|
42
|
+
parameter :host, :type => String,
|
43
|
+
:description => 'TCP host'
|
50
44
|
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
# TCP port
|
46
|
+
parameter :port, :type => Integer,
|
47
|
+
:description => 'TCP port'
|
54
48
|
|
55
|
-
|
56
|
-
|
57
|
-
|
49
|
+
# TCP local host
|
50
|
+
parameter :local_host, :type => String,
|
51
|
+
:description => 'TCP local host'
|
58
52
|
|
59
|
-
|
60
|
-
|
61
|
-
|
53
|
+
# TCP local port
|
54
|
+
parameter :local_port, :type => Integer,
|
55
|
+
:description => 'TCP local port'
|
62
56
|
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
# TCP server host
|
58
|
+
parameter :server_host, :type => String,
|
59
|
+
:description => 'TCP server host'
|
66
60
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
61
|
+
# TCP server port
|
62
|
+
parameter :server_port, :type => Integer,
|
63
|
+
:description => 'TCP server port'
|
71
64
|
|
72
65
|
protected
|
73
66
|
|
@@ -99,9 +92,9 @@ module Ronin
|
|
99
92
|
# @api public
|
100
93
|
#
|
101
94
|
def tcp_connect(&block)
|
102
|
-
print_info "Connecting to #{
|
95
|
+
print_info "Connecting to #{host_port} ..."
|
103
96
|
|
104
|
-
return
|
97
|
+
return super(self.host,self.port,self.local_host,self.local_port,&block)
|
105
98
|
end
|
106
99
|
|
107
100
|
#
|
@@ -123,10 +116,10 @@ module Ronin
|
|
123
116
|
# @api public
|
124
117
|
#
|
125
118
|
def tcp_connect_and_send(data,&block)
|
126
|
-
print_info "Connecting to #{
|
119
|
+
print_info "Connecting to #{host_port} ..."
|
127
120
|
print_debug "Sending data: #{data.inspect}"
|
128
121
|
|
129
|
-
return
|
122
|
+
return super(data,self.host,self.port,self.local_host,self.local_port,&block)
|
130
123
|
end
|
131
124
|
|
132
125
|
#
|
@@ -145,11 +138,11 @@ module Ronin
|
|
145
138
|
# @api public
|
146
139
|
#
|
147
140
|
def tcp_session(&block)
|
148
|
-
print_info "Connecting to #{
|
141
|
+
print_info "Connecting to #{host_port} ..."
|
149
142
|
|
150
143
|
Net.tcp_session(self.host,self.port,self.local_host,self.local_port,&block)
|
151
144
|
|
152
|
-
print_info "Disconnected from #{
|
145
|
+
print_info "Disconnected from #{host_port}"
|
153
146
|
return nil
|
154
147
|
end
|
155
148
|
|
@@ -173,9 +166,9 @@ module Ronin
|
|
173
166
|
# @api public
|
174
167
|
#
|
175
168
|
def tcp_banner(&block)
|
176
|
-
print_debug "Grabbing banner from #{
|
169
|
+
print_debug "Grabbing banner from #{host_port}"
|
177
170
|
|
178
|
-
return
|
171
|
+
return super(self.host,self.port,self.local_host,self.local_port,&block)
|
179
172
|
end
|
180
173
|
|
181
174
|
#
|
@@ -193,12 +186,12 @@ module Ronin
|
|
193
186
|
# @api public
|
194
187
|
#
|
195
188
|
def tcp_send(data)
|
196
|
-
print_info "Connecting to #{
|
189
|
+
print_info "Connecting to #{host_port} ..."
|
197
190
|
print_debug "Sending data: #{data.inspect}"
|
198
191
|
|
199
|
-
|
192
|
+
super(data,self.host,self.port,self.local_host,self.local_port)
|
200
193
|
|
201
|
-
print_info "Disconnected from #{
|
194
|
+
print_info "Disconnected from #{host_port}"
|
202
195
|
return true
|
203
196
|
end
|
204
197
|
|
@@ -221,13 +214,9 @@ module Ronin
|
|
221
214
|
# @api public
|
222
215
|
#
|
223
216
|
def tcp_server(&block)
|
224
|
-
|
225
|
-
print_info "Listening on #{self.server_host}:#{self.server_port} ..."
|
226
|
-
else
|
227
|
-
print_info "Listening on #{self.server_port} ..."
|
228
|
-
end
|
217
|
+
print_info "Listening on #{self.server_host_port} ..."
|
229
218
|
|
230
|
-
return
|
219
|
+
return super(self.server_port,self.server_host,&block)
|
231
220
|
end
|
232
221
|
|
233
222
|
#
|
@@ -257,20 +246,11 @@ module Ronin
|
|
257
246
|
# @api public
|
258
247
|
#
|
259
248
|
def tcp_server_session(&block)
|
260
|
-
|
261
|
-
print_info "Listening on #{self.server_host}:#{self.server_port} ..."
|
262
|
-
else
|
263
|
-
print_info "Listening on #{self.server_port} ..."
|
264
|
-
end
|
249
|
+
print_info "Listening on #{server_host_port} ..."
|
265
250
|
|
266
|
-
|
267
|
-
|
268
|
-
if self.server_host
|
269
|
-
print_info "Closed #{self.server_host}:#{self.server_port}"
|
270
|
-
else
|
271
|
-
print_info "Closed #{self.server_port}"
|
272
|
-
end
|
251
|
+
super(self.server_port,self.server_host,&block)
|
273
252
|
|
253
|
+
print_info "Closed #{server_host_port}"
|
274
254
|
return nil
|
275
255
|
end
|
276
256
|
|
@@ -299,13 +279,9 @@ module Ronin
|
|
299
279
|
# @api public
|
300
280
|
#
|
301
281
|
def tcp_single_server(&block)
|
302
|
-
|
303
|
-
print_info "Listening on #{self.server_host}:#{self.server_port} ..."
|
304
|
-
else
|
305
|
-
print_info "Listening on #{self.server_port} ..."
|
306
|
-
end
|
282
|
+
print_info "Listening on #{server_host_port} ..."
|
307
283
|
|
308
|
-
|
284
|
+
super(self.server_port,self.server_host) do |client|
|
309
285
|
client_addr = client.peeraddr
|
310
286
|
client_host = (client_addr[2] || client_addr[3])
|
311
287
|
client_port = client_addr[1]
|
@@ -314,17 +290,28 @@ module Ronin
|
|
314
290
|
|
315
291
|
yield client if block_given?
|
316
292
|
|
317
|
-
print_info "
|
318
|
-
end
|
319
|
-
|
320
|
-
if self.server_host
|
321
|
-
print_info "Closed #{self.server_host}:#{self.server_port}"
|
322
|
-
else
|
323
|
-
print_info "Closed #{self.server_port}"
|
293
|
+
print_info "Disconnected client #{client_host}:#{client_port}"
|
324
294
|
end
|
325
295
|
|
296
|
+
print_info "Closed #{server_host_port}"
|
326
297
|
return nil
|
327
298
|
end
|
299
|
+
|
300
|
+
private
|
301
|
+
|
302
|
+
#
|
303
|
+
# The server host/port parameters.
|
304
|
+
#
|
305
|
+
# @return [String]
|
306
|
+
# The server host/port parameters in String form.
|
307
|
+
#
|
308
|
+
# @since 0.4.0
|
309
|
+
#
|
310
|
+
# @api private
|
311
|
+
#
|
312
|
+
def server_host_port
|
313
|
+
"#{self.server_host}:#{self.server_port}"
|
314
|
+
end
|
328
315
|
end
|
329
316
|
end
|
330
317
|
end
|