ronin-support 1.0.0.beta3 → 1.0.1
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 +12 -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/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 +4 -7
- data/lib/ronin/support/binary/bit_flip.rb +7 -1
- data/lib/ronin/support/binary/buffer.rb +22 -22
- data/lib/ronin/support/binary/byte_slice.rb +17 -17
- data/lib/ronin/support/binary/cstring.rb +7 -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 +1 -1
- 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/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 +1 -1
- 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 +3 -0
- data/lib/ronin/support/binary/stack.rb +3 -4
- 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 +1 -0
- data/lib/ronin/support/binary/unhexdump/parser.rb +11 -11
- data/lib/ronin/support/binary/union.rb +22 -22
- 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/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 -5
- 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 +1 -1
- 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 +1 -1
- data/lib/ronin/support/encoding/base32.rb +28 -17
- data/lib/ronin/support/encoding/c/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/c.rb +4 -4
- data/lib/ronin/support/encoding/hex.rb +2 -2
- data/lib/ronin/support/encoding/js/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/js.rb +4 -4
- data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +2 -2
- data/lib/ronin/support/encoding/powershell.rb +4 -5
- data/lib/ronin/support/encoding/ruby.rb +4 -4
- 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/xml.rb +2 -2
- 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/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.rb +1 -1
- data/lib/ronin/support/network/http.rb +317 -80
- data/lib/ronin/support/network/ip.rb +8 -10
- 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 +1 -3
- 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 +3 -3
- data/lib/ronin/support/text/erb/mixin.rb +3 -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 +10 -10
- 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.rb +2 -2
- 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
@@ -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,7 +40,7 @@ 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
|
#
|
@@ -55,15 +55,15 @@ module Ronin
|
|
55
55
|
/(?:[0-9a-f]{1,4}:){1,4}(?::[0-9a-f]{1,4}){1,1}:#{IPV4_ADDR}/,
|
56
56
|
/:(?::[0-9a-f]{1,4}){1,5}:#{IPV4_ADDR}/,
|
57
57
|
/(?:(?:[0-9a-f]{1,4}:){1,5}|:):#{IPV4_ADDR}/,
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
%r{(?:[0-9a-f]{1,4}:){1,1}(?::[0-9a-f]{1,4}){1,6}(?:/\d{1,3})?},
|
59
|
+
%r{(?:[0-9a-f]{1,4}:){1,2}(?::[0-9a-f]{1,4}){1,5}(?:/\d{1,3})?},
|
60
|
+
%r{(?:[0-9a-f]{1,4}:){1,3}(?::[0-9a-f]{1,4}){1,4}(?:/\d{1,3})?},
|
61
|
+
%r{(?:[0-9a-f]{1,4}:){1,4}(?::[0-9a-f]{1,4}){1,3}(?:/\d{1,3})?},
|
62
|
+
%r{(?:[0-9a-f]{1,4}:){1,5}(?::[0-9a-f]{1,4}){1,2}(?:/\d{1,3})?},
|
63
|
+
%r{(?:[0-9a-f]{1,4}:){1,6}(?::[0-9a-f]{1,4}){1,1}(?:/\d{1,3})?},
|
64
|
+
%r{[0-9a-f]{1,4}(?::[0-9a-f]{1,4}){7}(?:/\d{1,3})?},
|
65
|
+
%r{:(?::[0-9a-f]{1,4}){1,7}(?:/\d{1,3})?},
|
66
|
+
%r{(?:(?:[0-9a-f]{1,4}:){1,7}|:):(?:/\d{1,3})?}
|
67
67
|
)
|
68
68
|
|
69
69
|
# A regular expression for matching IP Addresses.
|
@@ -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.
|
@@ -52,7 +52,7 @@ module Ronin
|
|
52
52
|
def self.swapcase(string)
|
53
53
|
candidates = []
|
54
54
|
|
55
|
-
string.each_char.
|
55
|
+
string.each_char.with_index do |char,index|
|
56
56
|
if char =~ /\p{L}/
|
57
57
|
candidates << index
|
58
58
|
end
|
@@ -61,7 +61,7 @@ module Ronin
|
|
61
61
|
new_string = string.dup
|
62
62
|
|
63
63
|
# ensure that at least one character is swap-cased, but not all
|
64
|
-
num_swaps = rand(candidates.length-1)
|
64
|
+
num_swaps = rand(1..(candidates.length - 1)) || 1
|
65
65
|
|
66
66
|
candidates.sample(num_swaps).each do |index|
|
67
67
|
new_string[index] = new_string[index].swapcase
|
@@ -117,7 +117,7 @@ module Ronin
|
|
117
117
|
# @yield [typo_word]
|
118
118
|
# If a block is given, it will be passed each typo variation of the
|
119
119
|
# original word.
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# @yieldparam [String] typo_word
|
122
122
|
# One of the typoed variations of the original word.
|
123
123
|
#
|
@@ -132,8 +132,8 @@ module Ronin
|
|
132
132
|
|
133
133
|
while (match = word.match(regexp,offset))
|
134
134
|
start, stop = match.offset(0)
|
135
|
+
new_string = word.dup
|
135
136
|
|
136
|
-
new_string = word.dup
|
137
137
|
new_string[start...stop] = replace
|
138
138
|
yield new_string
|
139
139
|
|
data/ronin-support.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
|
@@ -22,16 +22,17 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.homepage = gemspec['homepage']
|
23
23
|
gem.metadata = gemspec['metadata'] if gemspec['metadata']
|
24
24
|
|
25
|
-
glob =
|
25
|
+
glob = ->(patterns) { gem.files & Dir[*patterns] }
|
26
26
|
|
27
|
-
gem.files
|
28
|
-
gem.files
|
27
|
+
gem.files = `git ls-files`.split($/)
|
28
|
+
gem.files = glob[gemspec['files']] if gemspec['files']
|
29
29
|
# exclude test files from the packages gem
|
30
30
|
gem.files -= glob[gemspec['test_files'] || 'spec/{**/}*']
|
31
31
|
|
32
32
|
gem.executables = gemspec.fetch('executables') do
|
33
33
|
glob['bin/*'].map { |path| File.basename(path) }
|
34
34
|
end
|
35
|
+
|
35
36
|
gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
|
36
37
|
|
37
38
|
gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
|
@@ -46,7 +47,7 @@ Gem::Specification.new do |gem|
|
|
46
47
|
gem.required_rubygems_version = gemspec['required_rubygems_version']
|
47
48
|
gem.post_install_message = gemspec['post_install_message']
|
48
49
|
|
49
|
-
split =
|
50
|
+
split = ->(string) { string.split(/,\s*/) }
|
50
51
|
|
51
52
|
if gemspec['dependencies']
|
52
53
|
gemspec['dependencies'].each do |name,versions|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chars
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- ".gitignore"
|
125
125
|
- ".mailmap"
|
126
126
|
- ".rspec"
|
127
|
+
- ".rubocop.yml"
|
127
128
|
- ".ruby-version"
|
128
129
|
- ".yardopts"
|
129
130
|
- COPYING.txt
|