Skip to content

Commit 5f0aeda

Browse files
committed
Land rapid7#4835, new hex format for msfvenom
2 parents c3c9b23 + face3a7 commit 5f0aeda

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/msf/base/simple/buffer.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def self.transform(buf, fmt = "ruby", var_name = 'buf')
2525
when 'raw'
2626
when 'num'
2727
buf = Rex::Text.to_num(buf)
28+
when 'hex'
29+
buf = Rex::Text.to_hex(buf, '')
2830
when 'dword', 'dw'
2931
buf = Rex::Text.to_dword(buf)
3032
when 'python', 'py'
@@ -65,7 +67,7 @@ def self.transform(buf, fmt = "ruby", var_name = 'buf')
6567
def self.comment(buf, fmt = "ruby")
6668
case fmt
6769
when 'raw'
68-
when 'num', 'dword', 'dw'
70+
when 'num', 'dword', 'dw', 'hex'
6971
buf = Rex::Text.to_js_comment(buf)
7072
when 'ruby', 'rb', 'python', 'py'
7173
buf = Rex::Text.to_ruby_comment(buf)
@@ -98,6 +100,7 @@ def self.transform_formats
98100
'csharp',
99101
'dw',
100102
'dword',
103+
'hex',
101104
'java',
102105
'js_be',
103106
'js_le',

lib/rex/text.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,4 +1810,3 @@ def self.checksum32_be(str)
18101810

18111811
end
18121812
end
1813-

msfvenom

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ if __FILE__ == $0
331331
output_stream = $stdout
332332
output_stream.binmode
333333
output_stream.write payload
334+
# trailing newline for pretty output
335+
$stderr.puts unless payload =~ /\n$/
334336
end
335337

336338
end

0 commit comments

Comments
 (0)