Last active
June 30, 2017 11:50
-
-
Save Svenito/742ac0a8d3367ca1607c45e9582b6af5 to your computer and use it in GitHub Desktop.
simple xored string search using r2pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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