Skip to content

Instantly share code, notes, and snippets.

@vdudouyt
Last active March 28, 2016 17:26
Show Gist options
  • Select an option

  • Save vdudouyt/8430113 to your computer and use it in GitHub Desktop.

Select an option

Save vdudouyt/8430113 to your computer and use it in GitHub Desktop.
A GetCString() procedure for IDA Pro
import string, itertools, operator
def GetCString(ea, max_length = 32):
bytes = map(Byte, xrange(ea, ea + max_length + 1))
if 0x00 not in bytes: raise ValueError("String terminator wasn't found")
chars = map(chr, itertools.takewhile(operator.truth, bytes))
return string.join(chars, '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment