rex-text 0.2.50 → 0.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26e1e4f195a13ca2269745675f94c71bd02c1de0b4e3f39c4b92fb67495b0cf7
4
- data.tar.gz: c1c23a29f68de3b6079ea88e0744bbaf5c9ca438b5f1e8154b72eadf330ccac7
3
+ metadata.gz: e9814b1ad404f9ec4aec0102caf30af10fa00639bcbc6d67d3c3947ffd848229
4
+ data.tar.gz: 44ee07b97ef06aac2bc3e17ba27e6cbb2e61e7b93628e4b942196c693ac39fd2
5
5
  SHA512:
6
- metadata.gz: e3b09f9314ca321522b7a599231274e4685255f85457eb9b7466047941db5e22c8907d2d607c3b7d40e26b1d381423841291e269423545da2ea2345b734f0b82
7
- data.tar.gz: ab1b340d0812134021d7776016e3cfb51358c2ecbe85b57e5f2943b07ec61608cae635ae6525390e16d6b7003d96638d859fc452572d7047700c0b3c1378afce
6
+ metadata.gz: a734eebc8ab62ca00c662b815e3ba9d2ef189f35a4b02513fe2adb0ef4d01f9142b3f4c97d08fc60274e5ee1ea3c8817e6cc9ca191deacd0030f79323b1c0357
7
+ data.tar.gz: e17248ae8403a4f4c39c8a56e3f7b3173a111d2b121d5fe350da672cb4e5d91264ee2ed7f2831bde9c8fcdc50bf9a2fdad070a810ac9a6dcec8f5837d00722cd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -37,6 +37,7 @@ jobs:
37
37
  - '3.0'
38
38
  - '3.1'
39
39
  - '3.2'
40
+ - '3.3.0-preview1'
40
41
  os:
41
42
  - ubuntu-20.04
42
43
  - ubuntu-latest
@@ -28,15 +28,15 @@ module Rex
28
28
  # Creates a comma separated list of dwords
29
29
  #
30
30
  def self.to_dword(str, wrap = DefaultWrap)
31
- code = str
31
+ code = str.dup.force_encoding('ASCII-8BIT')
32
32
  alignnr = str.length % 4
33
33
  if (alignnr > 0)
34
34
  code << "\x00" * (4 - alignnr)
35
35
  end
36
36
  codevalues = Array.new
37
- code.split("").each_slice(4) do |chars4|
37
+ code.chars.each_slice(4) do |chars4|
38
38
  chars4 = chars4.join("")
39
- dwordvalue = chars4.unpack('*V')
39
+ dwordvalue = chars4.unpack('V')
40
40
  codevalues.push(dwordvalue[0])
41
41
  end
42
42
  buff = ""
data/lib/rex/text/hex.rb CHANGED
@@ -22,7 +22,7 @@ module Rex
22
22
  # the regex the first time it is used and never check again. Since we
23
23
  # want to know how many to capture on every instance, we do it this
24
24
  # way.
25
- return str.unpack('H*')[0].gsub(Regexp.new(".{#{count * 2}}", nil, 'n')) { |s| prefix + s }
25
+ return str.unpack('H*')[0].gsub(Regexp.new(".{#{count * 2}}", Regexp::NOENCODING)) { |s| prefix + s }
26
26
  end
27
27
 
28
28
  #
@@ -40,7 +40,7 @@ module Rex
40
40
  # their escaped hex representation
41
41
  def self.to_hex_ascii(str, prefix = "\\x", count = 1, suffix=nil)
42
42
  raise ::RuntimeError, "unable to chunk into #{count} byte chunks" if ((str.length % count) > 0)
43
- return str.unpack('H*')[0].gsub(Regexp.new(".{#{count * 2}}", nil, 'n')) { |s|
43
+ return str.unpack('H*')[0].gsub(Regexp.new(".{#{count * 2}}", Regexp::NOENCODING)) { |s|
44
44
  (0x20..0x7e) === s.to_i(16) ? s.to_i(16).chr : prefix + s + suffix.to_s
45
45
  }
46
46
  end
data/lib/rex/text/lang.rb CHANGED
@@ -45,6 +45,29 @@ module Rex
45
45
  return "/*\n" + wordwrap(str, 0, wrap, '', '') + "*/\n"
46
46
  end
47
47
 
48
+ #
49
+ # Converts to a masm style array of bytes
50
+ #
51
+ def self.to_masm(str, wrap = DefaultWrap, name = "")
52
+ raise ArgumentError.new('str can not be empty') if str.empty?
53
+ a = to_hex(str)
54
+ a.gsub!(/\\x/, '')
55
+ a.gsub!(/(.{2})/, '\1h,')
56
+ a.gsub!(/(.{32})/, '\1\n')
57
+ a.gsub!('\n', "\n")
58
+ a.gsub!(/^(.*),$/, 'DB \1')
59
+ a.gsub!(/([a-f].h)/, '0\1')
60
+ a.sub!(/^/, 'shellcode ')
61
+ return a
62
+ end
63
+
64
+ #
65
+ # Creates a masm style comment
66
+ #
67
+ def self.to_masm_comment(str, wrap = DefaultWrap)
68
+ return wordwrap(str, 0, wrap, '', '; ')
69
+ end
70
+
48
71
  #
49
72
  # Converts to a nim style array of bytes
50
73
  #
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Text
3
- VERSION = "0.2.50"
3
+ VERSION = "0.2.52"
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- >�6�u�dE����4��\Q[�~�j�P����;��D
2
- I��!����X��`�:�X6Q|�|��C{x��5�c��+>��D
1
+ } ��R�.*/
2
+ �O�+���lt/�\:S������c��ҩl�\�ԫ�j�r��}p�#��-�w��J��s�\�ט��8�y ��nHR!
3
+ CEZ;�NuC�����m�Ą0�fͿ����R��=W�οa2r|��\�v׃l�s
4
+ �Q�&�=��^y��sS�ȴ�b�o��e��4�~�ۢuxe6�W�����nw
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.50
4
+ version: 0.2.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2023-03-07 00:00:00.000000000 Z
96
+ date: 2023-06-14 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.3.26
188
+ rubygems_version: 3.1.4
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Provides Text Manipulation Methods for Exploitation
metadata.gz.sig CHANGED
Binary file