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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c57a3b73a709489a690da8b3a0d371de7a578fd
4
- data.tar.gz: d8a1f0e6265c85f7044308c2d7100dff81ffcc73
3
+ metadata.gz: 1636b1450848233f216d0ebebefb2da5d642ff97
4
+ data.tar.gz: 99503e08430646adc6d2ba25b3ec66dfbf9701f8
5
5
  SHA512:
6
- metadata.gz: 9bbe6444bedc078748233f9652310a181cb19600112d49bf8de5626465040815f9132c5185caeb8639a37f1b38db1835166d35fc2aaac91973169bbb3d421326
7
- data.tar.gz: a206efd80268debaa1ae7997ac9e10b50c1def8b46e93ad94d342b09a02ddffd0044befad3f4a5632d1373f9b353bbbb8544901ab7185bae8ceff0e5737cc068
6
+ metadata.gz: b1cc678bd8df6bbc0aa3066504dface1ea3b44c9a50189c6df3a596b13f4a68ebc35f69b15fc90e3df009ef82bd59410c0751dd86fab49e35bc29241e5b317d6
7
+ data.tar.gz: 521b2dc5498cc0183c85b80abea0f070542b438a5d2cf15d04420817ffdd8d120cad65dfb07488555e835ada36972951702bc4063a05299dedae4ebdb7c69a64
Binary file
data.tar.gz.sig CHANGED
@@ -1,6 +1 @@
1
- J�q
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}��������
@@ -10,8 +10,12 @@ module Rex
10
10
  #
11
11
  # Base64 encoder
12
12
  #
13
- def self.encode_base64(str, delim='')
14
- [str.to_s].pack("m").gsub(/\s+/, delim)
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
- splits = str.split( /\b/ )
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
  #
@@ -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
@@ -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.scan(/./).each { |l| letters << [l.downcase, l.upcase] }
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
- c.each_with_index { |d,i| this_str << letters[i][d] }
47
- mixed << this_str
48
- end
49
- return mixed.uniq
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
- len = arr.length
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
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Text
3
- VERSION = "0.2.20"
3
+ VERSION = "0.2.21"
4
4
  end
5
5
  end
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.20
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-04-18 00:00:00.000000000 Z
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