rex-text 0.2.52 → 0.2.54

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
  SHA256:
3
- metadata.gz: e9814b1ad404f9ec4aec0102caf30af10fa00639bcbc6d67d3c3947ffd848229
4
- data.tar.gz: 44ee07b97ef06aac2bc3e17ba27e6cbb2e61e7b93628e4b942196c693ac39fd2
3
+ metadata.gz: c05ee609d7b945466cea4997460b0309d45768ab3d1baa1b7fedaf24fb4e94a0
4
+ data.tar.gz: 9c43e502375129ec13d9f11695ac1fa6409e1aa28abe33289008b46c1d4bd8cb
5
5
  SHA512:
6
- metadata.gz: a734eebc8ab62ca00c662b815e3ba9d2ef189f35a4b02513fe2adb0ef4d01f9142b3f4c97d08fc60274e5ee1ea3c8817e6cc9ca191deacd0030f79323b1c0357
7
- data.tar.gz: e17248ae8403a4f4c39c8a56e3f7b3173a111d2b121d5fe350da672cb4e5d91264ee2ed7f2831bde9c8fcdc50bf9a2fdad070a810ac9a6dcec8f5837d00722cd
6
+ metadata.gz: 061327edbe4d52cd8a374539b8e9bde0cc01c156c95235ab48f528f25c3f806726b194d679e81a52e230bbbd77ceb70ed33f9227356c85fea1c05251a4c3c584
7
+ data.tar.gz: 7a2d1a026f030fa69403dd167378da42cf51629b5b942de03899d3f0dda52ede8f55e5d258fcfc4dd42180dc1d1089fc86c32f3d79265d269a294959eb4b237d
checksums.yaml.gz.sig CHANGED
Binary file
data/cortex.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ info:
3
+ title: Rex Text
4
+ description: Rex library for text generation and manipulation
5
+ x-cortex-git:
6
+ github:
7
+ alias: r7org
8
+ repository: rapid7/rex-text
9
+ x-cortex-tag: rex-text
10
+ x-cortex-type: service
11
+ x-cortex-domain-parents:
12
+ - tag: metasploit
13
+ openapi: 3.0.1
14
+ servers:
15
+ - url: "/"
data/lib/rex/text/hex.rb CHANGED
@@ -171,8 +171,8 @@ module Rex
171
171
  #
172
172
  # General-case method to handle both "\xAA\xBB\xCC" format and 0xAA,0xBB,0xCC format
173
173
  #
174
- def self.hexify_general(str, char_prefix, col = DefaultWrap, line_start = '', line_end = '', buf_start = '', buf_end = '', between='')
175
- encoded_char_length = 2 + char_prefix.length + between.length
174
+ def self.hexify_general(str, char_prefix, col = DefaultWrap, line_start = '', line_end = '', buf_start = '', buf_end = '', between='', char_suffix: '')
175
+ encoded_char_length = 2 + char_prefix.length + char_suffix.length + between.length
176
176
  if col < line_start.length + encoded_char_length + line_end.length
177
177
  # raise an exception
178
178
  raise ArgumentError.new('insufficient column width')
@@ -188,7 +188,7 @@ module Rex
188
188
  ret << "#{line_end}\n#{line_start}"
189
189
  last_line_length = line_start.length
190
190
  end
191
- ret << char_prefix << char.unpack('H*')[0] << between
191
+ ret << char_prefix << char.unpack('H*')[0] << char_suffix << between
192
192
  last_line_length += encoded_char_length
193
193
  end
194
194
  # Remove the last in-between characters, if required
data/lib/rex/text/lang.rb CHANGED
@@ -48,17 +48,17 @@ module Rex
48
48
  #
49
49
  # Converts to a masm style array of bytes
50
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
51
+ def self.to_masm(str, wrap = DefaultWrap, name = "buf")
52
+ result = hexify_general(str, "", wrap, "#{' ' * (name.length + 1)}DB ", '', "#{name} DB ", '', ',', char_suffix: 'h')
53
+ result.gsub!(",\n", "\n")
54
+ result
55
+ end
56
+
57
+ #
58
+ # Creates a masm style comment
59
+ #
60
+ def self.to_masm_comment(str, wrap = DefaultWrap)
61
+ return wordwrap(str, 0, wrap, '', '; ')
62
62
  end
63
63
 
64
64
  #
@@ -72,7 +72,6 @@ module Rex
72
72
  # Converts to a nim style array of bytes
73
73
  #
74
74
  def self.to_nim(str, wrap = DefaultWrap, name = "buf")
75
- raise ArgumentError.new('str can not be empty') if str.empty?
76
75
  return numhexify(str, wrap, '', '', "var #{name}: array[#{str.length}, byte] = [\nbyte ", "]", ',')
77
76
  end
78
77
 
@@ -89,7 +88,7 @@ module Rex
89
88
  def self.to_rust(str, wrap = DefaultWrap, name = "buf")
90
89
  return numhexify(str, wrap, '', '', "let #{name}: [u8; #{str.length}] = [", "];", ',')
91
90
  end
92
-
91
+
93
92
  #
94
93
  # Creates a Rust style comment
95
94
  #
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Text
3
- VERSION = "0.2.52"
3
+ VERSION = "0.2.54"
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
@@ -1,4 +1,2 @@
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
1
+ �))s��q�뿿���+�w�E�B��Q'A����WmP�m�}cZ180׈
2
+ ���0٬\$��Twu���ki#�MGQL���O��wH��ǥq
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.52
4
+ version: 0.2.54
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-06-14 00:00:00.000000000 Z
96
+ date: 2023-10-19 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
@@ -141,6 +141,7 @@ files:
141
141
  - LICENSE
142
142
  - README.md
143
143
  - Rakefile
144
+ - cortex.yaml
144
145
  - lib/rex/codepage.map
145
146
  - lib/rex/text.rb
146
147
  - lib/rex/text/badchars.rb
metadata.gz.sig CHANGED
Binary file