ronin-support 0.5.0.rc2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +1 -1
- data/Gemfile +1 -0
- data/README.md +11 -9
- data/gemspec.yml +1 -1
- data/lib/ronin/binary/struct.rb +2 -0
- data/lib/ronin/binary/template.rb +7 -0
- data/lib/ronin/extensions/file.rb +2 -2
- data/lib/ronin/extensions/ip_addr.rb +3 -3
- data/lib/ronin/extensions/string.rb +2 -2
- data/lib/ronin/formatting/extensions/binary/integer.rb +2 -2
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -2
- data/lib/ronin/fuzzing/extensions/string.rb +6 -3
- data/lib/ronin/fuzzing/fuzzer.rb +1 -1
- data/lib/ronin/network.rb +1 -0
- data/lib/ronin/network/extensions.rb +1 -0
- data/lib/ronin/network/http/http.rb +1 -0
- data/lib/ronin/network/mixins/ssl.rb +1 -1
- data/lib/ronin/network/mixins/tcp.rb +1 -1
- data/lib/ronin/network/ssl.rb +6 -1
- data/lib/ronin/network/tcp/proxy.rb +40 -0
- data/lib/ronin/network/udp/proxy.rb +25 -3
- data/lib/ronin/support/support.rb +1 -0
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/ui/output/helpers.rb +26 -8
- data/lib/ronin/ui/output/output.rb +1 -1
- data/lib/ronin/wordlist.rb +2 -2
- data/spec/network/tcp/tcp_spec.rb +12 -9
- metadata +4 -4
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Ronin Support
|
2
2
|
|
3
|
-
* [Source](
|
4
|
-
* [Issues](
|
5
|
-
* [Documentation](http://
|
3
|
+
* [Source](https://github.com/ronin-ruby/ronin-support)
|
4
|
+
* [Issues](https://github.com/ronin-ruby/ronin-support/issues)
|
5
|
+
* [Documentation](http://ronin-ruby.github.com/docs/ronin-support/frames)
|
6
6
|
* [Mailing List](http://groups.google.com/group/ronin-ruby)
|
7
7
|
* [irc.freenode.net #ronin](http://webchat.freenode.net/?channels=ronin&uio=Mj10cnVldd)
|
8
8
|
|
@@ -31,6 +31,7 @@ or payloads over many common Source-Code-Management (SCM) systems.
|
|
31
31
|
* DNS
|
32
32
|
* TCP
|
33
33
|
* UDP
|
34
|
+
* SSL
|
34
35
|
* SMTP / ESMTP
|
35
36
|
* POP3
|
36
37
|
* Imap
|
@@ -43,6 +44,7 @@ or payloads over many common Source-Code-Management (SCM) systems.
|
|
43
44
|
* Handling exceptions.
|
44
45
|
* Provides Modules/Classes for:
|
45
46
|
* Paths
|
47
|
+
* Fuzzing
|
46
48
|
* Wordlists
|
47
49
|
* Erb Templates
|
48
50
|
* UI:
|
@@ -57,17 +59,17 @@ please see [Everyday Ronin](http://ronin-ruby.github.com/guides/everyday_ronin.h
|
|
57
59
|
## Requirements
|
58
60
|
|
59
61
|
* [Ruby](http://www.ruby-lang.org/) >= 1.8.7
|
60
|
-
* [chars](
|
62
|
+
* [chars](https://github.com/postmodern/chars#readme)
|
61
63
|
~> 0.2
|
62
|
-
* [hexdump](
|
64
|
+
* [hexdump](https://github.com/postmodern/hexdump#readme)
|
63
65
|
~> 0.1
|
64
|
-
* [combinatorics](
|
66
|
+
* [combinatorics](https://github.com/postmodern/combinatorics#readme)
|
65
67
|
~> 0.4
|
66
|
-
* [uri-query_params](
|
68
|
+
* [uri-query_params](https://github.com/postmodern/uri-query_params#readme)
|
67
69
|
~> 0.6
|
68
|
-
* [data_paths](
|
70
|
+
* [data_paths](https://github.com/postmodern/data_paths#readme)
|
69
71
|
~> 0.3
|
70
|
-
* [parameters](
|
72
|
+
* [parameters](https://github.com/postmodern/parameters#readme)
|
71
73
|
~> 0.4
|
72
74
|
|
73
75
|
## Install
|
data/gemspec.yml
CHANGED
data/lib/ronin/binary/struct.rb
CHANGED
@@ -44,7 +44,7 @@ class File
|
|
44
44
|
# @api public
|
45
45
|
#
|
46
46
|
def File.each_line(path)
|
47
|
-
return enum_for(
|
47
|
+
return enum_for(__method__,path) unless block_given?
|
48
48
|
|
49
49
|
File.open(path) do |file|
|
50
50
|
file.each_line { |line| yield line.chomp }
|
@@ -79,7 +79,7 @@ class File
|
|
79
79
|
# @api public
|
80
80
|
#
|
81
81
|
def File.each_row(path,separator=/\s+/)
|
82
|
-
return enum_for(
|
82
|
+
return enum_for(__method__,path,separator) unless block_given?
|
83
83
|
|
84
84
|
File.each_line(path) { |line| yield line.split(separator) }
|
85
85
|
end
|
@@ -63,7 +63,7 @@ class IPAddr
|
|
63
63
|
# @api public
|
64
64
|
#
|
65
65
|
def IPAddr.extract(text,version=nil,&block)
|
66
|
-
return enum_for(
|
66
|
+
return enum_for(__method__,text,version).to_a unless block_given?
|
67
67
|
|
68
68
|
regexp = case version
|
69
69
|
when :ipv4, :v4, 4
|
@@ -122,7 +122,7 @@ class IPAddr
|
|
122
122
|
return IPAddr.new(cidr_or_glob).each(&block)
|
123
123
|
end
|
124
124
|
|
125
|
-
return enum_for(
|
125
|
+
return enum_for(__method__,cidr_or_glob) unless block
|
126
126
|
|
127
127
|
if cidr_or_glob.include?('::')
|
128
128
|
separator = '::'
|
@@ -208,7 +208,7 @@ class IPAddr
|
|
208
208
|
# @api public
|
209
209
|
#
|
210
210
|
def each
|
211
|
-
return enum_for(
|
211
|
+
return enum_for(__method__) unless block_given?
|
212
212
|
|
213
213
|
family_mask = MASKS[@family]
|
214
214
|
|
@@ -46,7 +46,7 @@ class String
|
|
46
46
|
# @api public
|
47
47
|
#
|
48
48
|
def each_substring(min=1,&block)
|
49
|
-
return enum_for(
|
49
|
+
return enum_for(__method__,min) unless block
|
50
50
|
|
51
51
|
(0..(length - min)).each do |i|
|
52
52
|
((i + min)..length).each do |j|
|
@@ -92,7 +92,7 @@ class String
|
|
92
92
|
# @api public
|
93
93
|
#
|
94
94
|
def each_unique_substring(min=1,&block)
|
95
|
-
return enum_for(
|
95
|
+
return enum_for(__method__,min) unless block
|
96
96
|
|
97
97
|
unique_strings = {}
|
98
98
|
|
@@ -60,7 +60,7 @@ class Integer
|
|
60
60
|
buffer = []
|
61
61
|
|
62
62
|
case endian
|
63
|
-
when :little
|
63
|
+
when :little
|
64
64
|
mask = 0xff
|
65
65
|
shift = 0
|
66
66
|
|
@@ -70,7 +70,7 @@ class Integer
|
|
70
70
|
mask <<= 8
|
71
71
|
shift += 8
|
72
72
|
end
|
73
|
-
when :big
|
73
|
+
when :big, :net
|
74
74
|
shift = ((length - 1) * 8)
|
75
75
|
mask = (0xff << shift)
|
76
76
|
|
@@ -92,7 +92,7 @@ class String
|
|
92
92
|
#
|
93
93
|
# Repeats the String.
|
94
94
|
#
|
95
|
-
# @param [Enumerable
|
95
|
+
# @param [Enumerable<Integer>, Integer] lengths
|
96
96
|
# The number of times to repeat the String.
|
97
97
|
#
|
98
98
|
# @yield [repeated]
|
@@ -141,7 +141,7 @@ class String
|
|
141
141
|
#
|
142
142
|
# Incrementally fuzzes the String.
|
143
143
|
#
|
144
|
-
# @param [Hash{Regexp,String =>
|
144
|
+
# @param [Hash{Regexp,String,Symbol => Enumerable,Symbol}] substitutions
|
145
145
|
# Patterns and their substitutions.
|
146
146
|
#
|
147
147
|
# @yield [fuzz]
|
@@ -163,6 +163,9 @@ class String
|
|
163
163
|
# p str
|
164
164
|
# end
|
165
165
|
#
|
166
|
+
# @example Replace a {Regexp::UNIX_PATH} with {Ronin::Fuzzing#format_strings}:
|
167
|
+
# "GET /downloads/".fuzz(:unix_path => :format_string)
|
168
|
+
#
|
166
169
|
# @since 0.3.0
|
167
170
|
#
|
168
171
|
# @api public
|
@@ -174,7 +177,7 @@ class String
|
|
174
177
|
#
|
175
178
|
# Permutes over every possible mutation of the String.
|
176
179
|
#
|
177
|
-
# @param [Hash{Regexp,String,Symbol => Symbol
|
180
|
+
# @param [Hash{Regexp,String,Symbol => Enumerable,Symbol}] mutations
|
178
181
|
# The patterns and substitutions to mutate the String with.
|
179
182
|
#
|
180
183
|
# @yield [mutant]
|
data/lib/ronin/fuzzing/fuzzer.rb
CHANGED
data/lib/ronin/network.rb
CHANGED
@@ -20,6 +20,7 @@
|
|
20
20
|
require 'ronin/network/extensions/dns'
|
21
21
|
require 'ronin/network/extensions/tcp'
|
22
22
|
require 'ronin/network/extensions/udp'
|
23
|
+
require 'ronin/network/extensions/ssl'
|
23
24
|
require 'ronin/network/extensions/smtp'
|
24
25
|
require 'ronin/network/extensions/esmtp'
|
25
26
|
require 'ronin/network/extensions/pop3'
|
data/lib/ronin/network/ssl.rb
CHANGED
@@ -22,6 +22,7 @@ require 'ronin/network/tcp'
|
|
22
22
|
begin
|
23
23
|
require 'openssl'
|
24
24
|
rescue ::LoadError
|
25
|
+
$stderr.puts "WARNING: Ruby was not compiled with OpenSSL support"
|
25
26
|
end
|
26
27
|
|
27
28
|
module Ronin
|
@@ -99,6 +100,8 @@ module Ronin
|
|
99
100
|
# @example
|
100
101
|
# socket = ssl_connect('twitter.com',443)
|
101
102
|
#
|
103
|
+
# @see http://rubydoc.info/stdlib/openssl/OpenSSL/SSL/SSLSocket
|
104
|
+
#
|
102
105
|
# @api public
|
103
106
|
#
|
104
107
|
def ssl_connect(host,port,options={})
|
@@ -165,11 +168,13 @@ module Ronin
|
|
165
168
|
#
|
166
169
|
# @example
|
167
170
|
# ssl_session('twitter.com',443) do |sock|
|
168
|
-
# sock.write("GET
|
171
|
+
# sock.write("GET / HTTP/1.1\n\r\n\r")
|
169
172
|
#
|
170
173
|
# sock.each_line { |line| puts line }
|
171
174
|
# end
|
172
175
|
#
|
176
|
+
# @see http://rubydoc.info/stdlib/openssl/OpenSSL/SSL/SSLSocket
|
177
|
+
#
|
173
178
|
# @api public
|
174
179
|
#
|
175
180
|
def ssl_session(host,port,options={},&block)
|
@@ -27,6 +27,46 @@ module Ronin
|
|
27
27
|
#
|
28
28
|
# The TCP Proxy allows for inspecting and manipulating TCP protocols.
|
29
29
|
#
|
30
|
+
# ## Example
|
31
|
+
#
|
32
|
+
# require 'ronin/network/tcp/proxy'
|
33
|
+
# require 'hexdump'
|
34
|
+
#
|
35
|
+
# Ronin::Network::TCP::Proxy.start(:port => 1337, :server => ['www.wired.com', 80]) do |proxy|
|
36
|
+
# address = lambda { |socket|
|
37
|
+
# addrinfo = socket.peeraddr
|
38
|
+
#
|
39
|
+
# "#{addrinfo[3]}:#{addrinfo[1]}"
|
40
|
+
# }
|
41
|
+
# hex = Hexdump::Dumper.new
|
42
|
+
#
|
43
|
+
# proxy.on_client_data do |client,server,data|
|
44
|
+
# puts "#{address[client]} -> #{proxy}"
|
45
|
+
# hex.dump(data)
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# proxy.on_client_connect do |client|
|
49
|
+
# puts "#{address[client]} -> #{proxy} [connected]"
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# proxy.on_client_disconnect do |client,server|
|
53
|
+
# puts "#{address[client]} <- #{proxy} [disconnected]"
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# proxy.on_server_data do |client,server,data|
|
57
|
+
# puts "#{address[client]} <- #{proxy}"
|
58
|
+
# hex.dump(data)
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# proxy.on_server_connect do |client,server|
|
62
|
+
# puts "#{address[client]} <- #{proxy} [connected]"
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# proxy.on_server_disconnect do |client,server|
|
66
|
+
# puts "#{address[client]} <- #{proxy} [disconnected]"
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
#
|
30
70
|
# ## Callbacks
|
31
71
|
#
|
32
72
|
# In addition to the events supported by the {Network::Proxy Proxy}
|
@@ -24,6 +24,28 @@ require 'socket'
|
|
24
24
|
module Ronin
|
25
25
|
module Network
|
26
26
|
module UDP
|
27
|
+
#
|
28
|
+
# The UDP Proxy allows for inspecting and manipulating UDP protocols.
|
29
|
+
#
|
30
|
+
# ## Example
|
31
|
+
#
|
32
|
+
# require 'ronin/network/udp/proxy'
|
33
|
+
# require 'hexdump'
|
34
|
+
#
|
35
|
+
# Ronin::Network::UDP::Proxy.start(:port => 1337, :server => ['4.2.2.1', 53]) do |proxy|
|
36
|
+
# hex = Hexdump::Dumper.new
|
37
|
+
#
|
38
|
+
# proxy.on_client_data do |(client,(host,port)),server,data|
|
39
|
+
# puts "#{host}:#{port} -> #{proxy}"
|
40
|
+
# hex.dump(data)
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# proxy.on_server_data do |(client,(host,port)),server,data|
|
44
|
+
# puts "#{host}:#{port} <- #{proxy}"
|
45
|
+
# hex.dump(data)
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# end
|
27
49
|
#
|
28
50
|
# @since 0.5.0
|
29
51
|
#
|
@@ -51,13 +73,13 @@ module Ronin
|
|
51
73
|
readable, writtable, errors = IO.select(sockets,nil,sockets)
|
52
74
|
|
53
75
|
(errors & server_connections).each do |server_socket|
|
54
|
-
client_socket =
|
76
|
+
client_socket = client_connection_for(server_socket)
|
55
77
|
|
56
78
|
close_connection(client_socket,server_socket)
|
57
79
|
end
|
58
80
|
|
59
81
|
(readable & server_connections).each do |server_socket|
|
60
|
-
client_socket =
|
82
|
+
client_socket = client_connection_for(server_socket)
|
61
83
|
data, addrinfo = recv(server_socket)
|
62
84
|
|
63
85
|
server_data(client_socket,server_socket,data)
|
@@ -115,7 +137,7 @@ module Ronin
|
|
115
137
|
|
116
138
|
socket.recvfrom(@buffer_size)
|
117
139
|
when UDPSocket
|
118
|
-
|
140
|
+
connection.recvfrom(@buffer_size)
|
119
141
|
end
|
120
142
|
end
|
121
143
|
|
@@ -71,7 +71,7 @@ module Ronin
|
|
71
71
|
#
|
72
72
|
# Prints one or more messages.
|
73
73
|
#
|
74
|
-
# @param [Array]
|
74
|
+
# @param [Array] arguments
|
75
75
|
# The messages to print.
|
76
76
|
#
|
77
77
|
# @example
|
@@ -81,11 +81,29 @@ module Ronin
|
|
81
81
|
#
|
82
82
|
# @api public
|
83
83
|
#
|
84
|
-
def puts(*
|
85
|
-
|
86
|
-
messages.each { |message| write("#{message}#{$/}") }
|
87
|
-
else
|
84
|
+
def puts(*arguments)
|
85
|
+
if arguments.empty?
|
88
86
|
write($/)
|
87
|
+
return nil
|
88
|
+
end
|
89
|
+
|
90
|
+
arguments.each do |argument|
|
91
|
+
if argument.kind_of?(Array)
|
92
|
+
argument.each { |element| puts(element) }
|
93
|
+
else
|
94
|
+
str = case argument
|
95
|
+
when nil
|
96
|
+
if RUBY_VERSION > '1.9'
|
97
|
+
''
|
98
|
+
else
|
99
|
+
'nil'
|
100
|
+
end
|
101
|
+
else
|
102
|
+
argument.to_s
|
103
|
+
end
|
104
|
+
|
105
|
+
write("#{str}#{$/}")
|
106
|
+
end
|
89
107
|
end
|
90
108
|
|
91
109
|
return nil
|
@@ -97,7 +115,7 @@ module Ronin
|
|
97
115
|
# @param [String] format
|
98
116
|
# The format string.
|
99
117
|
#
|
100
|
-
# @param [Array]
|
118
|
+
# @param [Array] arguments
|
101
119
|
# The data to format.
|
102
120
|
#
|
103
121
|
# @return [nil]
|
@@ -106,8 +124,8 @@ module Ronin
|
|
106
124
|
#
|
107
125
|
# @api public
|
108
126
|
#
|
109
|
-
def printf(format,*
|
110
|
-
write(format %
|
127
|
+
def printf(format,*arguments)
|
128
|
+
write(format % arguments)
|
111
129
|
return nil
|
112
130
|
end
|
113
131
|
|
data/lib/ronin/wordlist.rb
CHANGED
@@ -195,7 +195,7 @@ module Ronin
|
|
195
195
|
# @api public
|
196
196
|
#
|
197
197
|
def each_word(&block)
|
198
|
-
return enum_for(
|
198
|
+
return enum_for(__method__) unless block
|
199
199
|
|
200
200
|
if @path
|
201
201
|
File.open(@path) do |file|
|
@@ -223,7 +223,7 @@ module Ronin
|
|
223
223
|
# @api public
|
224
224
|
#
|
225
225
|
def each(&block)
|
226
|
-
return enum_for(
|
226
|
+
return enum_for(__method__) unless block
|
227
227
|
|
228
228
|
mutator = unless @mutations.empty?
|
229
229
|
Fuzzing::Mutator.new(@mutations)
|
@@ -77,12 +77,14 @@ describe Network::TCP do
|
|
77
77
|
let(:data) { "HELO ronin\n" }
|
78
78
|
let(:local_port) { 1024 + rand(65535 - 1024) }
|
79
79
|
|
80
|
+
let(:expected_response) { "250 mx.google.com at your service\r\n" }
|
81
|
+
|
80
82
|
it "should connect and then send data" do
|
81
83
|
socket = subject.tcp_connect_and_send(data,host,port)
|
82
84
|
banner = socket.readline
|
83
85
|
response = socket.readline
|
84
86
|
|
85
|
-
response.
|
87
|
+
response.should == expected_response
|
86
88
|
|
87
89
|
socket.close
|
88
90
|
end
|
@@ -104,7 +106,7 @@ describe Network::TCP do
|
|
104
106
|
response = socket.readline
|
105
107
|
end
|
106
108
|
|
107
|
-
response.
|
109
|
+
response.should == expected_response
|
108
110
|
|
109
111
|
socket.close
|
110
112
|
end
|
@@ -136,21 +138,22 @@ describe Network::TCP do
|
|
136
138
|
end
|
137
139
|
|
138
140
|
describe "#tcp_banner" do
|
139
|
-
let(:host)
|
140
|
-
let(:port)
|
141
|
-
|
141
|
+
let(:host) { 'smtp.gmail.com' }
|
142
|
+
let(:port) { 25 }
|
142
143
|
let(:local_port) { 1024 + rand(65535 - 1024) }
|
143
144
|
|
144
|
-
|
145
|
+
let(:expected_banner) { /^220 mx\.google\.com ESMTP/ }
|
146
|
+
|
147
|
+
it "should return the read service banner" do
|
145
148
|
banner = subject.tcp_banner(host,port)
|
146
149
|
|
147
|
-
banner.
|
150
|
+
banner.should =~ expected_banner
|
148
151
|
end
|
149
152
|
|
150
153
|
it "should bind to a local host and port" do
|
151
154
|
banner = subject.tcp_banner(host,port,nil,local_port)
|
152
155
|
|
153
|
-
banner.
|
156
|
+
banner.should =~ expected_banner
|
154
157
|
end
|
155
158
|
|
156
159
|
it "should yield the banner" do
|
@@ -160,7 +163,7 @@ describe Network::TCP do
|
|
160
163
|
banner = yielded_banner
|
161
164
|
end
|
162
165
|
|
163
|
-
banner.
|
166
|
+
banner.should =~ expected_banner
|
164
167
|
end
|
165
168
|
end
|
166
169
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chars
|
@@ -392,7 +392,7 @@ files:
|
|
392
392
|
- spec/ui/output_spec.rb
|
393
393
|
- spec/ui/shell_spec.rb
|
394
394
|
- spec/wordlist_spec.rb
|
395
|
-
homepage: http://github.com/
|
395
|
+
homepage: http://ronin-ruby.github.com/
|
396
396
|
licenses:
|
397
397
|
- LGPL-3
|
398
398
|
post_install_message:
|