ronin-support 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -0
- data/.rubocop.yml +109 -0
- data/ChangeLog.md +33 -1
- data/Gemfile +8 -4
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/examples/ssl_proxy.rb +2 -1
- data/examples/tcp_proxy.rb +6 -4
- data/lib/ronin/support/archive/core_ext/file.rb +43 -0
- data/lib/ronin/support/archive/core_ext.rb +1 -1
- data/lib/ronin/support/archive/tar/writer.rb +2 -2
- data/lib/ronin/support/archive/tar.rb +4 -4
- data/lib/ronin/support/archive/zip/reader.rb +2 -2
- data/lib/ronin/support/binary/array.rb +5 -8
- data/lib/ronin/support/binary/bit_flip.rb +7 -1
- data/lib/ronin/support/binary/buffer.rb +25 -25
- data/lib/ronin/support/binary/byte_slice.rb +17 -17
- data/lib/ronin/support/binary/core_ext.rb +2 -0
- data/lib/ronin/support/binary/cstring.rb +50 -4
- data/lib/ronin/support/binary/ctypes/arch/arm/big_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/arm.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64/big_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/mips/little_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/mips.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64/little_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/x86.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/x86_64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/array_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/big_endian.rb +3 -0
- data/lib/ronin/support/binary/ctypes/enum_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/little_endian.rb +3 -0
- data/lib/ronin/support/binary/ctypes/native.rb +3 -0
- data/lib/ronin/support/binary/ctypes/os/bsd.rb +1 -1
- data/lib/ronin/support/binary/ctypes/scalar_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/struct_type.rb +3 -3
- data/lib/ronin/support/binary/ctypes/type_resolver.rb +7 -8
- data/lib/ronin/support/binary/ctypes/unbounded_array_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/union_type.rb +3 -3
- data/lib/ronin/support/binary/ctypes.rb +3 -3
- data/lib/ronin/support/binary/memory.rb +2 -2
- data/lib/ronin/support/binary/packet.rb +80 -0
- data/lib/ronin/support/binary/stack.rb +6 -7
- data/lib/ronin/support/binary/struct/member.rb +5 -3
- data/lib/ronin/support/binary/struct.rb +81 -79
- data/lib/ronin/support/binary/template.rb +2 -5
- data/lib/ronin/support/binary/unhexdump/parser.rb +11 -11
- data/lib/ronin/support/binary/union.rb +22 -22
- data/lib/ronin/support/binary.rb +1 -0
- data/lib/ronin/support/cli/ansi.rb +0 -1
- data/lib/ronin/support/cli/io_shell/core_ext/io.rb +1 -1
- data/lib/ronin/support/cli/io_shell.rb +4 -4
- data/lib/ronin/support/cli/printing.rb +3 -3
- data/lib/ronin/support/compression/core_ext/file.rb +16 -0
- data/lib/ronin/support/compression/zlib.rb +1 -1
- data/lib/ronin/support/core_ext/enumerable.rb +0 -2
- data/lib/ronin/support/core_ext/file.rb +1 -1
- data/lib/ronin/support/core_ext/kernel.rb +6 -9
- data/lib/ronin/support/core_ext/string.rb +2 -2
- data/lib/ronin/support/crypto/cert.rb +11 -15
- data/lib/ronin/support/crypto/cert_chain.rb +1 -1
- data/lib/ronin/support/crypto/cipher/aes.rb +3 -0
- data/lib/ronin/support/crypto/cipher/aes128.rb +4 -1
- data/lib/ronin/support/crypto/cipher/aes256.rb +4 -1
- data/lib/ronin/support/crypto/cipher.rb +1 -1
- data/lib/ronin/support/crypto/core_ext/file.rb +33 -1
- data/lib/ronin/support/crypto/core_ext/string.rb +34 -2
- data/lib/ronin/support/crypto/key/methods.rb +4 -1
- data/lib/ronin/support/crypto/key.rb +5 -2
- data/lib/ronin/support/crypto/openssl.rb +1 -1
- data/lib/ronin/support/crypto.rb +0 -1
- data/lib/ronin/support/encoding/base16.rb +2 -2
- data/lib/ronin/support/encoding/base32.rb +29 -18
- data/lib/ronin/support/encoding/c/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/c/core_ext/string.rb +1 -1
- data/lib/ronin/support/encoding/c.rb +6 -6
- data/lib/ronin/support/encoding/core_ext/string.rb +2 -2
- data/lib/ronin/support/encoding/hex/core_ext/string.rb +1 -1
- data/lib/ronin/support/encoding/hex.rb +4 -4
- data/lib/ronin/support/encoding/js/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/js.rb +5 -5
- data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +2 -2
- data/lib/ronin/support/encoding/powershell.rb +5 -6
- data/lib/ronin/support/encoding/quoted_printable.rb +3 -1
- data/lib/ronin/support/encoding/ruby.rb +5 -5
- data/lib/ronin/support/encoding/shell/core_ext/integer.rb +2 -2
- data/lib/ronin/support/encoding/shell.rb +3 -3
- data/lib/ronin/support/encoding/sql.rb +1 -1
- data/lib/ronin/support/encoding/uuencoding.rb +3 -1
- data/lib/ronin/support/encoding/xml.rb +3 -3
- data/lib/ronin/support/encoding.rb +95 -0
- data/lib/ronin/support/network/asn/list.rb +6 -1
- data/lib/ronin/support/network/asn/record.rb +3 -0
- data/lib/ronin/support/network/asn/record_set.rb +3 -0
- data/lib/ronin/support/network/asn.rb +167 -6
- data/lib/ronin/support/network/dns/mixin.rb +2 -10
- data/lib/ronin/support/network/dns/resolver.rb +3 -0
- data/lib/ronin/support/network/domain.rb +21 -21
- data/lib/ronin/support/network/email_address.rb +1 -5
- data/lib/ronin/support/network/esmtp/mixin.rb +1 -0
- data/lib/ronin/support/network/ftp/mixin.rb +1 -1
- data/lib/ronin/support/network/host.rb +75 -47
- data/lib/ronin/support/network/http/core_ext/uri/http.rb +8 -0
- data/lib/ronin/support/network/http/core_ext.rb +1 -1
- data/lib/ronin/support/network/http.rb +317 -80
- data/lib/ronin/support/network/ip.rb +49 -23
- data/lib/ronin/support/network/ip_range/cidr.rb +1 -5
- data/lib/ronin/support/network/ip_range/glob.rb +1 -0
- data/lib/ronin/support/network/ip_range/range.rb +1 -1
- data/lib/ronin/support/network/ip_range.rb +5 -7
- data/lib/ronin/support/network/proxy.rb +4 -4
- data/lib/ronin/support/network/public_suffix/list.rb +10 -8
- data/lib/ronin/support/network/public_suffix/suffix_set.rb +3 -0
- data/lib/ronin/support/network/public_suffix.rb +9 -4
- data/lib/ronin/support/network/smtp/email.rb +0 -9
- data/lib/ronin/support/network/smtp/mixin.rb +2 -2
- data/lib/ronin/support/network/ssl/local_cert.rb +1 -3
- data/lib/ronin/support/network/ssl/mixin.rb +13 -13
- data/lib/ronin/support/network/ssl/openssl.rb +1 -1
- data/lib/ronin/support/network/ssl/proxy.rb +14 -16
- data/lib/ronin/support/network/ssl.rb +4 -2
- data/lib/ronin/support/network/tcp/proxy.rb +3 -3
- data/lib/ronin/support/network/tcp.rb +10 -12
- data/lib/ronin/support/network/telnet/mixin.rb +14 -14
- data/lib/ronin/support/network/tld/list.rb +2 -1
- data/lib/ronin/support/network/tld.rb +7 -4
- data/lib/ronin/support/network/tls/proxy.rb +1 -1
- data/lib/ronin/support/network/tls.rb +0 -2
- data/lib/ronin/support/network/udp/proxy.rb +5 -5
- data/lib/ronin/support/network/udp.rb +14 -16
- data/lib/ronin/support/path.rb +4 -4
- data/lib/ronin/support/text/erb/mixin.rb +3 -0
- data/lib/ronin/support/text/homoglyph/core_ext/string.rb +33 -0
- data/lib/ronin/support/text/homoglyph/table.rb +3 -3
- data/lib/ronin/support/text/patterns/credentials.rb +2 -2
- data/lib/ronin/support/text/patterns/crypto.rb +1 -1
- data/lib/ronin/support/text/patterns/file_system.rb +3 -4
- data/lib/ronin/support/text/patterns/network.rb +21 -21
- data/lib/ronin/support/text/patterns/numeric.rb +1 -1
- data/lib/ronin/support/text/patterns/source_code.rb +2 -2
- data/lib/ronin/support/text/random/mixin.rb +17 -17
- data/lib/ronin/support/text/random.rb +25 -25
- data/lib/ronin/support/text/typo/core_ext/string.rb +24 -0
- data/lib/ronin/support/text/typo/generator.rb +2 -2
- data/lib/ronin/support/version.rb +1 -1
- data/ronin-support.gemspec +6 -5
- metadata +3 -2
@@ -16,7 +16,6 @@
|
|
16
16
|
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
19
|
require 'ronin/support/network/tls/proxy'
|
21
20
|
require 'ronin/support/network/ssl'
|
22
21
|
|
@@ -46,7 +45,6 @@ module Ronin
|
|
46
45
|
def self.context(version: 1.2, **kwargs)
|
47
46
|
SSL.context(version: version, **kwargs)
|
48
47
|
end
|
49
|
-
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
@@ -44,7 +44,7 @@ module Ronin
|
|
44
44
|
# puts "#{host}:#{port} <- #{proxy}"
|
45
45
|
# hex.dump(data)
|
46
46
|
# end
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# end
|
49
49
|
#
|
50
50
|
# @since 0.5.0
|
@@ -70,7 +70,7 @@ module Ronin
|
|
70
70
|
def poll
|
71
71
|
sockets = [@socket] + server_connections
|
72
72
|
|
73
|
-
readable,
|
73
|
+
readable, _writtable, errors = IO.select(sockets,nil,sockets)
|
74
74
|
|
75
75
|
(errors & server_connections).each do |server_socket|
|
76
76
|
client_socket = client_connection_for(server_socket)
|
@@ -79,8 +79,8 @@ module Ronin
|
|
79
79
|
end
|
80
80
|
|
81
81
|
(readable & server_connections).each do |server_socket|
|
82
|
-
client_socket
|
83
|
-
data,
|
82
|
+
client_socket = client_connection_for(server_socket)
|
83
|
+
data, _addrinfo = recv(server_socket)
|
84
84
|
|
85
85
|
server_data(client_socket,server_socket,data)
|
86
86
|
end
|
@@ -133,7 +133,7 @@ module Ronin
|
|
133
133
|
def recv(connection)
|
134
134
|
case connection
|
135
135
|
when Array
|
136
|
-
socket,
|
136
|
+
socket, _host_and_port = connection
|
137
137
|
|
138
138
|
socket.recvfrom(@buffer_size)
|
139
139
|
when UDPSocket
|
@@ -67,24 +67,22 @@ module Ronin
|
|
67
67
|
# @since 0.5.0
|
68
68
|
#
|
69
69
|
def self.open?(host,port, timeout: 5, **kwargs)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
socket.syswrite('')
|
70
|
+
Timeout.timeout(timeout) do
|
71
|
+
connect(host,port,**kwargs) do |socket|
|
72
|
+
# send an empty UDP packet, just like nmap
|
73
|
+
socket.syswrite('')
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
75
|
+
# send an empty UDP packet again, to elicit an
|
76
|
+
# Errno::ECONNREFUSED
|
77
|
+
socket.syswrite('')
|
80
78
|
end
|
81
|
-
|
82
|
-
return true
|
83
|
-
rescue Timeout::Error
|
84
|
-
return nil
|
85
|
-
rescue SocketError, SystemCallError
|
86
|
-
return false
|
87
79
|
end
|
80
|
+
|
81
|
+
return true
|
82
|
+
rescue Timeout::Error
|
83
|
+
return nil
|
84
|
+
rescue SocketError, SystemCallError
|
85
|
+
return false
|
88
86
|
end
|
89
87
|
|
90
88
|
#
|
@@ -328,7 +326,7 @@ module Ronin
|
|
328
326
|
#
|
329
327
|
def self.server_session(**kwargs,&block)
|
330
328
|
server = server(**kwargs,&block)
|
331
|
-
server.close
|
329
|
+
server.close
|
332
330
|
return nil
|
333
331
|
end
|
334
332
|
|
data/lib/ronin/support/path.rb
CHANGED
@@ -54,8 +54,8 @@ module Ronin
|
|
54
54
|
# @return [Path]
|
55
55
|
# The root path.
|
56
56
|
#
|
57
|
-
def
|
58
|
-
|
57
|
+
def self.root
|
58
|
+
new('/')
|
59
59
|
end
|
60
60
|
|
61
61
|
#
|
@@ -89,7 +89,7 @@ module Ronin
|
|
89
89
|
separator
|
90
90
|
elsif n > 0
|
91
91
|
path = new('..',separator)
|
92
|
-
path.join(*(['..'] * (n-1)))
|
92
|
+
path.join(*(['..'] * (n - 1)))
|
93
93
|
else
|
94
94
|
raise(ArgumentError,"negative argument")
|
95
95
|
end
|
@@ -115,7 +115,7 @@ module Ronin
|
|
115
115
|
# # => #<Ronin::Support::Path:../../../../../../../etc/passwd>
|
116
116
|
#
|
117
117
|
def join(*names)
|
118
|
-
joined_path = if root? then String.new
|
118
|
+
joined_path = if root? then String.new(encoding: Encoding::UTF_8)
|
119
119
|
else self.to_s
|
120
120
|
end
|
121
121
|
|
@@ -39,6 +39,10 @@ class String
|
|
39
39
|
# @raise [Ronin::Support::Text::Homoglyph::NotViable]
|
40
40
|
# No homoglyph replaceable characters were found in the String.
|
41
41
|
#
|
42
|
+
# @example
|
43
|
+
# "microsoft".homoglyph
|
44
|
+
# # => "microsoft"
|
45
|
+
#
|
42
46
|
# @see Ronin::Support::Text::Homoglyph.substitute
|
43
47
|
#
|
44
48
|
# @api public
|
@@ -68,6 +72,11 @@ class String
|
|
68
72
|
# @return [Enumerator]
|
69
73
|
# If no block is given, an Enumerator object will be returned.
|
70
74
|
#
|
75
|
+
# @example
|
76
|
+
# "microsoft".each_homoglyph do |homoglyph|
|
77
|
+
# # ...
|
78
|
+
# end
|
79
|
+
#
|
71
80
|
# @see Ronin::Support::Text::Homoglyph.each_substitution
|
72
81
|
#
|
73
82
|
# @api public
|
@@ -95,6 +104,30 @@ class String
|
|
95
104
|
# @return [Array<String>]
|
96
105
|
# All variation of the given String.
|
97
106
|
#
|
107
|
+
# @example
|
108
|
+
# "microsoft".homoglyphs
|
109
|
+
# # =>
|
110
|
+
# # ["ⅿicrosoft",
|
111
|
+
# # "microsoft",
|
112
|
+
# # "mіcrosoft",
|
113
|
+
# # "mⅰcrosoft",
|
114
|
+
# # "microsoft",
|
115
|
+
# # "miϲrosoft",
|
116
|
+
# # "miсrosoft",
|
117
|
+
# # "miⅽrosoft",
|
118
|
+
# # "microsoft",
|
119
|
+
# # "microsoft",
|
120
|
+
# # "micrοsoft",
|
121
|
+
# # "microsοft",
|
122
|
+
# # "micrоsoft",
|
123
|
+
# # "microsоft",
|
124
|
+
# # "microsoft",
|
125
|
+
# # "microsoft",
|
126
|
+
# # "microѕoft",
|
127
|
+
# # "microsoft",
|
128
|
+
# # "microsoft",
|
129
|
+
# # "microsoft"]
|
130
|
+
#
|
98
131
|
# @see Ronin::Support::Text::Homoglyph.each_substitution
|
99
132
|
#
|
100
133
|
# @api public
|
@@ -61,7 +61,7 @@ module Ronin
|
|
61
61
|
# @api private
|
62
62
|
#
|
63
63
|
def self.load_file(path)
|
64
|
-
table = new
|
64
|
+
table = new
|
65
65
|
|
66
66
|
File.open(path) do |file|
|
67
67
|
file.each_line(chomp: true) do |line|
|
@@ -211,11 +211,11 @@ module Ronin
|
|
211
211
|
offset = 0
|
212
212
|
|
213
213
|
while (index = string.index(replaceable_char,offset))
|
214
|
-
homoglyph
|
214
|
+
homoglyph = string.dup
|
215
215
|
homoglyph[index] = substitute_char
|
216
216
|
|
217
217
|
yield homoglyph
|
218
|
-
offset = index+1
|
218
|
+
offset = index + 1
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|
@@ -59,10 +59,10 @@ module Ronin
|
|
59
59
|
# @since 1.0.0
|
60
60
|
AWS_ACCESS_KEY_ID = /(?<=[^A-Z0-9]|^)[A-Z0-9]{20}(?=[^A-Z0-9]|$)/
|
61
61
|
|
62
|
-
# Regular expression for finding all AWS secret access key
|
62
|
+
# Regular expression for finding all AWS secret access key
|
63
63
|
#
|
64
64
|
# @since 1.0.0
|
65
|
-
AWS_SECRET_ACCESS_KEY =
|
65
|
+
AWS_SECRET_ACCESS_KEY = %r{(?<=[^A-Za-z0-9/+=]|^)[A-Za-z0-9/+=]{40}(?=[^A-Za-z0-9/+=]|$)}
|
66
66
|
|
67
67
|
# Regular expression for finding all API keys (md5, sha1, sha256,
|
68
68
|
# sha512, AWS access key ID or AWS secret access key).
|
@@ -60,7 +60,7 @@ module Ronin
|
|
60
60
|
# Regular expression for finding all SSH public keys in text.
|
61
61
|
#
|
62
62
|
# @since 1.0.0
|
63
|
-
SSH_PUBLIC_KEY =
|
63
|
+
SSH_PUBLIC_KEY = %r{(?:ssh-(?:rsa|dss|ed25519(?:@openssh.com)?)|ecdsa-sha2-nistp(?:256|384|521)(?:@openssh.com)?) AAAA[A-Za-z0-9+/]+(?:=){0,3} [^@\s]+@[^@\s]+}
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -35,7 +35,7 @@ module Ronin
|
|
35
35
|
# Regular expression to find file names in text
|
36
36
|
#
|
37
37
|
# @since 0.4.0
|
38
|
-
FILE_NAME =
|
38
|
+
FILE_NAME = %r{(?:[^/\\\. ]|\\[/\\ ])+(?:#{FILE_EXT})?}
|
39
39
|
|
40
40
|
# Regular expression to find Directory names in text
|
41
41
|
#
|
@@ -45,12 +45,12 @@ module Ronin
|
|
45
45
|
# Regular expression to find local UNIX Paths in text
|
46
46
|
#
|
47
47
|
# @since 0.4.0
|
48
|
-
RELATIVE_UNIX_PATH =
|
48
|
+
RELATIVE_UNIX_PATH = %r{(?:#{DIR_NAME}/)+#{DIR_NAME}/?}
|
49
49
|
|
50
50
|
# Regular expression to find absolute UNIX Paths in text
|
51
51
|
#
|
52
52
|
# @since 0.4.0
|
53
|
-
ABSOLUTE_UNIX_PATH =
|
53
|
+
ABSOLUTE_UNIX_PATH = %r{(?:/#{FILE_NAME})+/?}
|
54
54
|
|
55
55
|
# Regular expression to find UNIX Paths in text
|
56
56
|
#
|
@@ -86,7 +86,6 @@ module Ronin
|
|
86
86
|
#
|
87
87
|
# @since 0.4.0
|
88
88
|
PATH = /#{UNIX_PATH}|#{WINDOWS_PATH}/
|
89
|
-
|
90
89
|
end
|
91
90
|
end
|
92
91
|
end
|
@@ -40,31 +40,31 @@ module Ronin
|
|
40
40
|
# A regular expression for matching IPv4 Addresses.
|
41
41
|
#
|
42
42
|
# @since 1.0.0
|
43
|
-
IPV4_ADDR =
|
43
|
+
IPV4_ADDR = %r{#{decimal_octet}(?:\.#{decimal_octet}){3}(?:/\d{1,2})?}
|
44
44
|
|
45
45
|
# A regular expression for matching IPv6 Addresses.
|
46
46
|
#
|
47
47
|
# @since 1.0.0
|
48
|
-
IPV6_ADDR =
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
48
|
+
IPV6_ADDR = %r{
|
49
|
+
(?:[0-9a-f]{1,4}:){6}#{IPV4_ADDR}|
|
50
|
+
(?:[0-9a-f]{1,4}:){5}[0-9a-f]{1,4}:#{IPV4_ADDR}|
|
51
|
+
(?:[0-9a-f]{1,4}:){5}:[0-9a-f]{1,4}:#{IPV4_ADDR}|
|
52
|
+
(?:[0-9a-f]{1,4}:){1,1}(?::[0-9a-f]{1,4}){1,4}:#{IPV4_ADDR}|
|
53
|
+
(?:[0-9a-f]{1,4}:){1,2}(?::[0-9a-f]{1,4}){1,3}:#{IPV4_ADDR}|
|
54
|
+
(?:[0-9a-f]{1,4}:){1,3}(?::[0-9a-f]{1,4}){1,2}:#{IPV4_ADDR}|
|
55
|
+
(?:[0-9a-f]{1,4}:){1,4}(?::[0-9a-f]{1,4}){1,1}:#{IPV4_ADDR}|
|
56
|
+
:(?::[0-9a-f]{1,4}){1,5}:#{IPV4_ADDR}|
|
57
|
+
(?:(?:[0-9a-f]{1,4}:){1,5}|:):#{IPV4_ADDR}|
|
58
|
+
(?:[0-9a-f]{1,4}:){1,1}(?::[0-9a-f]{1,4}){1,6}(?:/\d{1,3})?|
|
59
|
+
(?:[0-9a-f]{1,4}:){1,2}(?::[0-9a-f]{1,4}){1,5}(?:/\d{1,3})?|
|
60
|
+
(?:[0-9a-f]{1,4}:){1,3}(?::[0-9a-f]{1,4}){1,4}(?:/\d{1,3})?|
|
61
|
+
(?:[0-9a-f]{1,4}:){1,4}(?::[0-9a-f]{1,4}){1,3}(?:/\d{1,3})?|
|
62
|
+
(?:[0-9a-f]{1,4}:){1,5}(?::[0-9a-f]{1,4}){1,2}(?:/\d{1,3})?|
|
63
|
+
(?:[0-9a-f]{1,4}:){1,6}(?::[0-9a-f]{1,4}){1,1}(?:/\d{1,3})?|
|
64
|
+
[0-9a-f]{1,4}(?::[0-9a-f]{1,4}){7}(?:/\d{1,3})?|
|
65
|
+
:(?::[0-9a-f]{1,4}){1,7}(?:/\d{1,3})?|
|
66
|
+
(?:(?:[0-9a-f]{1,4}:){1,7}|:):(?:/\d{1,3})?
|
67
|
+
}x
|
68
68
|
|
69
69
|
# A regular expression for matching IP Addresses.
|
70
70
|
#
|
@@ -35,7 +35,7 @@ module Ronin
|
|
35
35
|
# Regular expression to find identifier in text
|
36
36
|
#
|
37
37
|
# @since 0.4.0
|
38
|
-
IDENTIFIER = /
|
38
|
+
IDENTIFIER = /_*[a-zA-Z]+[a-zA-Z0-9_-]*/
|
39
39
|
|
40
40
|
# Regular expression to find all variable names in text.
|
41
41
|
#
|
@@ -77,7 +77,7 @@ module Ronin
|
|
77
77
|
# Regular expression to find all Base64 encoded strings in the text.
|
78
78
|
#
|
79
79
|
# @since 1.0.0
|
80
|
-
BASE64 =
|
80
|
+
BASE64 = %r{(?:[A-Za-z0-9+/]{4}\n?)+(?:[A-Za-z0-9+/]{2}==\n?|[A-Za-z0-9+/]{3}=\n?)?|[A-Za-z0-9+/]{2}==\n?|[A-Za-z0-9+/]{3}=\n?}
|
81
81
|
|
82
82
|
# Regular expression to match any single-line or multi-line C-style
|
83
83
|
# comments.
|
@@ -31,7 +31,7 @@ module Ronin
|
|
31
31
|
#
|
32
32
|
# Generates a random String of numeric characters.
|
33
33
|
#
|
34
|
-
# @param [Integer] n
|
34
|
+
# @param [Integer, Range<Integer>] n
|
35
35
|
# The desired length of the String.
|
36
36
|
#
|
37
37
|
# @return [String]
|
@@ -56,7 +56,7 @@ module Ronin
|
|
56
56
|
#
|
57
57
|
# A random octal-digit string.
|
58
58
|
#
|
59
|
-
# @param [Integer] n
|
59
|
+
# @param [Integer, Range<Integer>] n
|
60
60
|
# The desired length of the String.
|
61
61
|
#
|
62
62
|
# @return [String]
|
@@ -79,7 +79,7 @@ module Ronin
|
|
79
79
|
#
|
80
80
|
# The upper-case hexadecimal character set.
|
81
81
|
#
|
82
|
-
# @param [Integer] n
|
82
|
+
# @param [Integer, Range<Integer>] n
|
83
83
|
# The desired length of the String.
|
84
84
|
#
|
85
85
|
# @return [String]
|
@@ -104,7 +104,7 @@ module Ronin
|
|
104
104
|
#
|
105
105
|
# The lower-case hexadecimal character set.
|
106
106
|
#
|
107
|
-
# @param [Integer] n
|
107
|
+
# @param [Integer, Range<Integer>] n
|
108
108
|
# The desired length of the String.
|
109
109
|
#
|
110
110
|
# @return [String]
|
@@ -129,7 +129,7 @@ module Ronin
|
|
129
129
|
#
|
130
130
|
# A random hexadecimal string.
|
131
131
|
#
|
132
|
-
# @param [Integer] n
|
132
|
+
# @param [Integer, Range<Integer>] n
|
133
133
|
# The desired length of the String.
|
134
134
|
#
|
135
135
|
# @return [String]
|
@@ -152,7 +152,7 @@ module Ronin
|
|
152
152
|
#
|
153
153
|
# The upper-case alphabetic character set.
|
154
154
|
#
|
155
|
-
# @param [Integer] n
|
155
|
+
# @param [Integer, Range<Integer>] n
|
156
156
|
# The desired length of the String.
|
157
157
|
#
|
158
158
|
# @return [String]
|
@@ -177,7 +177,7 @@ module Ronin
|
|
177
177
|
#
|
178
178
|
# The lower-case alphabetic character set.
|
179
179
|
#
|
180
|
-
# @param [Integer] n
|
180
|
+
# @param [Integer, Range<Integer>] n
|
181
181
|
# The desired length of the String.
|
182
182
|
#
|
183
183
|
# @return [String]
|
@@ -202,7 +202,7 @@ module Ronin
|
|
202
202
|
#
|
203
203
|
# A random alphabetic string.
|
204
204
|
#
|
205
|
-
# @param [Integer] n
|
205
|
+
# @param [Integer, Range<Integer>] n
|
206
206
|
# The desired length of the String.
|
207
207
|
#
|
208
208
|
# @return [String]
|
@@ -225,7 +225,7 @@ module Ronin
|
|
225
225
|
#
|
226
226
|
# A random alpha-numeric string.
|
227
227
|
#
|
228
|
-
# @param [Integer] n
|
228
|
+
# @param [Integer, Range<Integer>] n
|
229
229
|
# The desired length of the String.
|
230
230
|
#
|
231
231
|
# @return [String]
|
@@ -248,7 +248,7 @@ module Ronin
|
|
248
248
|
#
|
249
249
|
# A random punctuation string.
|
250
250
|
#
|
251
|
-
# @param [Integer] n
|
251
|
+
# @param [Integer, Range<Integer>] n
|
252
252
|
# The desired length of the String.
|
253
253
|
#
|
254
254
|
# @return [String]
|
@@ -271,7 +271,7 @@ module Ronin
|
|
271
271
|
#
|
272
272
|
# A random symbolic string.
|
273
273
|
#
|
274
|
-
# @param [Integer] n
|
274
|
+
# @param [Integer, Range<Integer>] n
|
275
275
|
# The desired length of the String.
|
276
276
|
#
|
277
277
|
# @return [String]
|
@@ -294,7 +294,7 @@ module Ronin
|
|
294
294
|
#
|
295
295
|
# A random whitespace string.
|
296
296
|
#
|
297
|
-
# @param [Integer] n
|
297
|
+
# @param [Integer, Range<Integer>] n
|
298
298
|
# The desired length of the String.
|
299
299
|
#
|
300
300
|
# @return [String]
|
@@ -319,7 +319,7 @@ module Ronin
|
|
319
319
|
#
|
320
320
|
# The set of printable characters, not including spaces.
|
321
321
|
#
|
322
|
-
# @param [Integer] n
|
322
|
+
# @param [Integer, Range<Integer>] n
|
323
323
|
# The desired length of the String.
|
324
324
|
#
|
325
325
|
# @return [String]
|
@@ -342,7 +342,7 @@ module Ronin
|
|
342
342
|
#
|
343
343
|
# The set of printable characters, including spaces.
|
344
344
|
#
|
345
|
-
# @param [Integer] n
|
345
|
+
# @param [Integer, Range<Integer>] n
|
346
346
|
# The desired length of the String.
|
347
347
|
#
|
348
348
|
# @return [String]
|
@@ -365,7 +365,7 @@ module Ronin
|
|
365
365
|
#
|
366
366
|
# A random control-character string.
|
367
367
|
#
|
368
|
-
# @param [Integer] n
|
368
|
+
# @param [Integer, Range<Integer>] n
|
369
369
|
# The desired length of the String.
|
370
370
|
#
|
371
371
|
# @return [String]
|
@@ -388,7 +388,7 @@ module Ronin
|
|
388
388
|
#
|
389
389
|
# The signed ASCII character set.
|
390
390
|
#
|
391
|
-
# @param [Integer] n
|
391
|
+
# @param [Integer, Range<Integer>] n
|
392
392
|
# The desired length of the String.
|
393
393
|
#
|
394
394
|
# @return [String]
|
@@ -411,7 +411,7 @@ module Ronin
|
|
411
411
|
#
|
412
412
|
# A random ASCII string.
|
413
413
|
#
|
414
|
-
# @param [Integer] n
|
414
|
+
# @param [Integer, Range<Integer>] n
|
415
415
|
# The desired length of the String.
|
416
416
|
#
|
417
417
|
# @return [String]
|