Skip to content

Commit 71974a8

Browse files
committed
to_addr_hex_dump is never used and is too similar to to_hex_dump
Not so much value in to_addr_hex_dump, as Meatballs1 suggested, we should remove this.
1 parent 3982d77 commit 71974a8

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

lib/rex/text.rb

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -793,49 +793,6 @@ def self.to_hex_dump(str, width=16, base=nil)
793793
buf << "\n"
794794
end
795795

796-
#
797-
# Converts a string a nicely formatted and addressed ex dump
798-
#
799-
def self.to_addr_hex_dump(str, start_addr=0, width=16)
800-
buf = ''
801-
idx = 0
802-
cnt = 0
803-
snl = false
804-
lst = 0
805-
addr = start_addr
806-
807-
while (idx < str.length)
808-
809-
buf << "%08x" % addr
810-
buf << " " * 4
811-
chunk = str[idx, width]
812-
line = chunk.unpack("H*")[0].scan(/../).join(" ")
813-
buf << line
814-
815-
if (lst == 0)
816-
lst = line.length
817-
buf << " " * 4
818-
else
819-
buf << " " * ((lst - line.length) + 4).abs
820-
end
821-
822-
chunk.unpack("C*").each do |c|
823-
if (c > 0x1f and c < 0x7f)
824-
buf << c.chr
825-
else
826-
buf << "."
827-
end
828-
end
829-
830-
buf << "\n"
831-
832-
idx += width
833-
addr += width
834-
end
835-
836-
buf << "\n"
837-
end
838-
839796
#
840797
# Converts a hex string to a raw string
841798
#

0 commit comments

Comments
 (0)