rex-text 0.2.17 → 0.2.18

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: 54626bd02ea487efb1721fa1434c9f6ef00fa236
4
- data.tar.gz: 152f0ff3a0d18ee8e846463ba63bbe95b39035c4
3
+ metadata.gz: 7a0058375961741cdeccbcc0ec2d3b5276dcf8a9
4
+ data.tar.gz: bd6e3bf7cfda5e24e63198215a2dcf36576d1367
5
5
  SHA512:
6
- metadata.gz: 27eeeaacb1933fe0d15cd79fe71d33d1d21b1c3094308aae594380709092b7c4988ccc1237c726233c5cc36be134d6777b149a9e130f2fd5abddc5826453d06f
7
- data.tar.gz: 25d4d72f523feef87f52a221548692d3e70e2f61d1c5f61080c95970220f6a06a5af921035b5c7db4c68e482e74de5a363fe1eeb50a4bc58a8de35b98571ac76
6
+ metadata.gz: e4c8904bfddedde15f8f4b40c7c630bbce3c44cd7d0de36d116a426f4ff3b7a0fd5c504b92eb98aeacf5c764fd20d22e83ebce9a70d2d09bca8919d73fbcbb3b
7
+ data.tar.gz: 9ede2d8379ee1344e215d3a4f2f5a3970e13b4b185cbf5611afd9887c51b5435c4bca1481c5092586109a804f1b5d63e3cee65bf7d295323fe9ed6180468e856
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -5,6 +5,8 @@ require 'digest/sha1'
5
5
  require 'stringio'
6
6
  require 'cgi'
7
7
  require 'zlib'
8
+ require 'openssl'
9
+ require 'rc4'
8
10
 
9
11
  require 'rex/text/illegal_sequence'
10
12
  require 'rex/text/rand'
@@ -24,6 +26,9 @@ require 'rex/text/block_api'
24
26
  require 'rex/text/ebcdic'
25
27
  require 'rex/text/pattern'
26
28
  require 'rex/text/badchars'
29
+ require 'rex/text/aes256'
30
+ require 'rex/text/xor'
31
+ require 'rex/text/rc4'
27
32
 
28
33
  require 'rex/text/color'
29
34
  require 'rex/text/table'
@@ -0,0 +1,33 @@
1
+ # -*- coding: binary -*-
2
+
3
+ module Rex
4
+ module Text
5
+
6
+ # Returns an encrypted string using AES256-CBC.
7
+ #
8
+ # @param iv [String] Initialization vector.
9
+ # @param key [String] Secret key.
10
+ # @return [String] The encrypted string.
11
+ def self.encrypt_aes256(iv, key, value)
12
+ aes = OpenSSL::Cipher::AES256.new(:CBC)
13
+ aes.encrypt
14
+ aes.iv = iv
15
+ aes.key = key
16
+ aes.update(value) + aes.final
17
+ end
18
+
19
+ # Returns a decrypted string using AES256-CBC.
20
+ #
21
+ # @param iv [String] Initialization vector.
22
+ # @param key [String] Secret key.
23
+ # @return [String] The decrypted string.
24
+ def self.decrypt_aes256(iv, key, value)
25
+ aes = OpenSSL::Cipher::AES256.new(:CBC)
26
+ aes.decrypt
27
+ aes.iv = iv
28
+ aes.key = key
29
+ aes.update(value) + aes.final
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ # -*- coding: binary -*-
2
+
3
+ module Rex
4
+ module Text
5
+
6
+ # Returns a decrypted or encrypted RC4 string.
7
+ #
8
+ # @param key [String] Secret key.
9
+ # @param [String]
10
+ def self.rc4(key, value)
11
+ rc4 = RC4.new(key)
12
+
13
+ # This can also be used to decrypt
14
+ rc4.encrypt(value)
15
+ end
16
+
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Text
3
- VERSION = "0.2.17"
3
+ VERSION = "0.2.18"
4
4
  end
5
5
  end
@@ -0,0 +1,28 @@
1
+ # -*- coding: binary -*-
2
+
3
+ module Rex
4
+ module Text
5
+
6
+ # Returns a XOR'd string.
7
+ #
8
+ # @param key [String] XOR key.
9
+ # @param value [String] The string to XOR.
10
+ # @return [String] An XOR'd string.
11
+ def self.xor(key, value)
12
+ xor_key = key.kind_of?(Integer) || key.nil? ? key.to_i : key.to_i(16)
13
+ unless xor_key.between?(0, 255)
14
+ raise ArgumentError, 'XOR key should be between 0x00 to 0x0f'
15
+ end
16
+
17
+ buf = ''
18
+
19
+ value.each_byte do |byte|
20
+ xor_byte = byte ^ xor_key
21
+ buf << [xor_byte].pack('c')
22
+ end
23
+
24
+ buf
25
+ end
26
+
27
+ end
28
+ end
@@ -23,4 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.12"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+
27
+ spec.add_runtime_dependency 'ruby-rc4'
28
+ spec.add_runtime_dependency 'openssl'
26
29
  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.17
4
+ version: 0.2.18
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-08 00:00:00.000000000 Z
91
+ date: 2018-04-12 00:00:00.000000000 Z
92
92
  dependencies:
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: bundler
@@ -132,6 +132,34 @@ dependencies:
132
132
  - - "~>"
133
133
  - !ruby/object:Gem::Version
134
134
  version: '3.0'
135
+ - !ruby/object:Gem::Dependency
136
+ name: ruby-rc4
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ type: :runtime
143
+ prerelease: false
144
+ version_requirements: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ - !ruby/object:Gem::Dependency
150
+ name: openssl
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ type: :runtime
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
135
163
  description: This Gem contains all of the Ruby Exploitation(Rex) methods for text
136
164
  manipulation and generation
137
165
  email:
@@ -151,6 +179,7 @@ files:
151
179
  - Rakefile
152
180
  - lib/rex/codepage.map
153
181
  - lib/rex/text.rb
182
+ - lib/rex/text/aes256.rb
154
183
  - lib/rex/text/badchars.rb
155
184
  - lib/rex/text/base32.rb
156
185
  - lib/rex/text/base64.rb
@@ -168,10 +197,12 @@ files:
168
197
  - lib/rex/text/pattern.rb
169
198
  - lib/rex/text/rand.rb
170
199
  - lib/rex/text/randomize.rb
200
+ - lib/rex/text/rc4.rb
171
201
  - lib/rex/text/silly.rb
172
202
  - lib/rex/text/table.rb
173
203
  - lib/rex/text/unicode.rb
174
204
  - lib/rex/text/version.rb
205
+ - lib/rex/text/xor.rb
175
206
  - rex-text.gemspec
176
207
  homepage: https://github.com/rapid7/rex-text
177
208
  licenses: []
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- wB�-��L{U/��������O:�x'i8PS��������_�d�$hy���H��! ���7 ���-��o��ƅt��� z]���Ju`z>�u��/CTR�&�f�!Z�+���")��~��V6�q{�t)o������ �5��NH�5�D�f�ZJɵ�� �UVu��݂S�E�0��0��+�����X�J�jںR
1
+ E+�6Ixu6���@�Qu3I\��ryPnyҮ4��S�I���]Ż�MYD|j�ũ���^�bP;'��Lzc��Дh�`ą�G<��wxf�8���z2���ƛ��ĺ��-&wi ������"�j_��f��uz\ɒ�]:v�޻�~�)�#U<��!�t���,�rQ��B��v�ˇa��\a"��8?A�,%�!e�fv���Q8;\ n��u#d��Bn��G&C[q�ga�.Y&3����<�(��