rex-text 0.2.20 → 0.2.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -6
- data/lib/rex/text/base64.rb +7 -3
- data/lib/rex/text/binary_manipulation.rb +1 -3
- data/lib/rex/text/hash.rb +14 -0
- data/lib/rex/text/randomize.rb +8 -23
- data/lib/rex/text/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1636b1450848233f216d0ebebefb2da5d642ff97
|
4
|
+
data.tar.gz: 99503e08430646adc6d2ba25b3ec66dfbf9701f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1cc678bd8df6bbc0aa3066504dface1ea3b44c9a50189c6df3a596b13f4a68ebc35f69b15fc90e3df009ef82bd59410c0751dd86fab49e35bc29241e5b317d6
|
7
|
+
data.tar.gz: 521b2dc5498cc0183c85b80abea0f070542b438a5d2cf15d04420817ffdd8d120cad65dfb07488555e835ada36972951702bc4063a05299dedae4ebdb7c69a64
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,6 +1 @@
|
|
1
|
-
J
|
2
|
-
�X!��f3@��(��M
|
3
|
-
G�L�u�7�
|
4
|
-
��|�3I�ɗ4����%�E{
|
5
|
-
x���_y�ƴ�@�.�E��o��}r�PA�5I���[��VT0T���N0 H��Y߉�
|
6
|
-
[kx�b�y�i��:���1�Y�\�;��wݓ�P��P���k�rt�O���G�J&X��ǿ&���i[�$���6Ȓ�����+O��P_��Ȣcr�RY\s���L�7����@��5���9�S\����x�K�w���D�
|
1
|
+
RW�ƔX��_��AҠ�ª���aX��^���0.�K��-�XX1e�(O�C�<Ú���&�/CN�|q��"�S�{e����ik���6o��ú��iN��dd�7bv2BK�"5��k9&������;�YcI}���=Ǣӗ�䔋�9�i��J���).<�/�Je�4�k�Yz�[��cD�_���~I�Q��̬��^D��L�d�u_�P�� /�T�J���Y��������}u��f}��������
|
data/lib/rex/text/base64.rb
CHANGED
@@ -10,8 +10,12 @@ module Rex
|
|
10
10
|
#
|
11
11
|
# Base64 encoder
|
12
12
|
#
|
13
|
-
def self.encode_base64(str, delim=
|
14
|
-
|
13
|
+
def self.encode_base64(str, delim=nil)
|
14
|
+
if delim
|
15
|
+
[str.to_s].pack("m").gsub(/\s+/, delim)
|
16
|
+
else
|
17
|
+
[str.to_s].pack("m0")
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
#
|
@@ -24,7 +28,7 @@ module Rex
|
|
24
28
|
#
|
25
29
|
# Base64 encoder (URL-safe RFC6920)
|
26
30
|
#
|
27
|
-
def self.encode_base64url(str, delim=
|
31
|
+
def self.encode_base64url(str, delim=nil)
|
28
32
|
encode_base64(str, delim).
|
29
33
|
tr('+/', '-_').
|
30
34
|
gsub('=', '')
|
@@ -58,9 +58,7 @@ module Rex
|
|
58
58
|
# strict - include *only* words, no boundary characters (like spaces, etc.)
|
59
59
|
#
|
60
60
|
def self.to_words( str, strict = false )
|
61
|
-
|
62
|
-
splits.reject! { |w| !(w =~ /\w/) } if strict
|
63
|
-
splits
|
61
|
+
strict ? str.scan(/\w+/) : str.split(/\b/)
|
64
62
|
end
|
65
63
|
|
66
64
|
#
|
data/lib/rex/text/hash.rb
CHANGED
@@ -33,5 +33,19 @@ module Rex
|
|
33
33
|
def self.sha1(str)
|
34
34
|
Digest::SHA1.hexdigest(str)
|
35
35
|
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Raw SHA2 digest of the supplied string
|
39
|
+
#
|
40
|
+
def self.sha2_raw(str)
|
41
|
+
Digest::SHA2.digest(str)
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# Hexidecimal SHA2 digest of the supplied string
|
46
|
+
#
|
47
|
+
def self.sha2(str)
|
48
|
+
Digest::SHA2.hexdigest(str)
|
49
|
+
end
|
36
50
|
end
|
37
51
|
end
|
data/lib/rex/text/randomize.rb
CHANGED
@@ -35,18 +35,14 @@ module Rex
|
|
35
35
|
# @return [Array<String>]
|
36
36
|
# @see permute_case
|
37
37
|
def self.to_mixed_case_array(str)
|
38
|
-
letters = []
|
39
|
-
str.
|
40
|
-
coords = []
|
41
|
-
(1 << str.size).times { |i| coords << ("%0#{str.size}b" % i) }
|
42
|
-
mixed = []
|
43
|
-
coords.each do |coord|
|
44
|
-
c = coord.scan(/./).map {|x| x.to_i}
|
38
|
+
letters = str.each_char.map { |l| [l.downcase, l.upcase] }
|
39
|
+
(1 << str.size).times.map do |i|
|
45
40
|
this_str = ""
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
("%0#{str.size}b" % i).each_char.map(&:to_i).each_with_index do |d,i|
|
42
|
+
this_str << letters[i][d]
|
43
|
+
end
|
44
|
+
this_str
|
45
|
+
end.uniq
|
50
46
|
end
|
51
47
|
|
52
48
|
#
|
@@ -83,18 +79,7 @@ module Rex
|
|
83
79
|
# @param arr [Array] The array to be shuffled
|
84
80
|
# @return [Array]
|
85
81
|
def self.shuffle_a(arr)
|
86
|
-
|
87
|
-
max = len - 1
|
88
|
-
cyc = [* (0..max) ]
|
89
|
-
for d in cyc
|
90
|
-
e = rand(d+1)
|
91
|
-
next if e == d
|
92
|
-
f = arr[d];
|
93
|
-
g = arr[e];
|
94
|
-
arr[d] = g;
|
95
|
-
arr[e] = f;
|
96
|
-
end
|
97
|
-
return arr
|
82
|
+
arr.shuffle!
|
98
83
|
end
|
99
84
|
|
100
85
|
# Permute the case of a word
|
data/lib/rex/text/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rex-text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David 'thelightcosine' Maloney
|
@@ -88,7 +88,7 @@ cert_chain:
|
|
88
88
|
G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
|
89
89
|
8mVuTXnyJOKRJA==
|
90
90
|
-----END CERTIFICATE-----
|
91
|
-
date: 2018-
|
91
|
+
date: 2018-06-13 00:00:00.000000000 Z
|
92
92
|
dependencies:
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|