mirror of https://github.com/snare/voltron.git
Fix memory print when escape character encountered
This commit is contained in:
parent
4ee3cbe6f7
commit
889d19a000
|
@ -2,6 +2,7 @@ import voltron
|
|||
import logging
|
||||
import six
|
||||
import struct
|
||||
import binascii
|
||||
|
||||
from voltron.api import *
|
||||
|
||||
|
@ -108,7 +109,9 @@ class APIMemoryRequest(APIRequest):
|
|||
|
||||
res = APIMemoryResponse()
|
||||
res.address = addr
|
||||
res.memory = six.u(memory)
|
||||
#don't use six.u since it processes escape sequences ie... breaks if we have 0x5C 0x37 in memory
|
||||
#res.memory = six.u(memory)
|
||||
res.memory = binascii.hexlify(memory)
|
||||
res.bytes = len(memory)
|
||||
res.deref = deref
|
||||
except TargetBusyException:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import six
|
||||
import binascii
|
||||
import pygments
|
||||
import pygments.formatters
|
||||
from pygments.token import *
|
||||
|
@ -83,6 +84,7 @@ class MemoryView(TerminalView):
|
|||
|
||||
if m_res and m_res.is_success:
|
||||
bytes_per_chunk = self.args.words*target['addr_size'] if self.args.words else self.args.bytes
|
||||
m_res.memory = binascii.unhexlify(m_res.memory)
|
||||
for c in range(0, m_res.bytes, bytes_per_chunk):
|
||||
chunk = m_res.memory[c:c + bytes_per_chunk]
|
||||
yield (Name.Label, self.format_address(m_res.address + c, size=target['addr_size'], pad=False))
|
||||
|
@ -94,8 +96,11 @@ class MemoryView(TerminalView):
|
|||
n = "%02X" % x
|
||||
token = Text if x else Comment
|
||||
if self.args.track and self.last_memory and self.last_address == m_res.address:
|
||||
if x != six.indexbytes(self.last_memory, c + i):
|
||||
token = Error
|
||||
try:
|
||||
if x != six.indexbytes(self.last_memory, c + i):
|
||||
token = Error
|
||||
except:
|
||||
pass
|
||||
byte_array.append((token, n))
|
||||
|
||||
if self.args.words:
|
||||
|
|
Loading…
Reference in New Issue