Skip to content

Commit 5274a13

Browse files
author
HD Moore
committed
Handle non-hex input properly
1 parent c682bb6 commit 5274a13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/pattern_offset.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
value = ARGV.shift
2626
len = ARGV.shift || 8192
2727

28-
value = value.hex if (value.length >= 8 and value.hex > 0)
28+
if (value.length >= 8 and value.hex > 0)
29+
value = value.hex
30+
else
31+
value = value[0,4].unpack("V").first
32+
end
33+
2934
buffer = Rex::Text.pattern_create(len.to_i)
3035

3136
offset = Rex::Text.pattern_offset(buffer, value)

0 commit comments

Comments
 (0)