Skip to content

Instantly share code, notes, and snippets.

@Svenito
Last active June 30, 2017 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Svenito/742ac0a8d3367ca1607c45e9582b6af5 to your computer and use it in GitHub Desktop.
Save Svenito/742ac0a8d3367ca1607c45e9582b6af5 to your computer and use it in GitHub Desktop.
simple xored string search using r2pipe
import r2pipe
import sys
import base64
r2p=r2pipe.open(sys.argv[1], ['-nn'])
string_to_find = sys.argv[2]
def xor_string(string, key):
out = [chr(ord(x) ^ key) for x in string]
return ''.join(out)
for i in xrange(0,256):
needle = xor_string(string_to_find, i)
r2res = r2p.cmdj('izj')
for i in r2res:
r2_string = base64.b64decode(i['string'])
if needle in r2_string:
print "vaddr={} paddr={} section={} string={}".format(i['vaddr'], i['paddr'], i['section'], r2_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment