from xortools import single_byte_xor
in_buf = open('test.txt', 'rb').read()
out_buf = open('test-xor.txt', 'wb')
out_buf.write(single_byte_xor(in_buf, 0xBC))
out_buf.close()
from xortools import four_byte_xor
in_buf = open('test.txt', 'rb').read()
out_buf = open('test-xor.txt', 'wb')
out_buf.write(four_byte_xor(in_buf, 0x12345678))
out_buf.close()
# ./XORSearch.exe key.zip.enc key.txt
Found XOR AB position 001E: key.txt.A.
Found XOR AB position 0075: key.txtPK..
#
Usage: XORSearch [-siuh] [-l length] [-n length] [-f search-file] file string
XORSearch V1.6, search for a XOR, ROL or ROT encoded string in a file
Use -s to save the XOR, ROL or ROT encoded file containing the string
Use -l length to limit the number of printed characters (50 by default)
Use -i to ignore the case when searching
Use -u to search for Unicode strings (limited support)
Use -f to provide a file with search strings
Use -n length to print the length neighbouring charaters (before & after the found keyword)
Use -h to search for hex strings
Options -l and -n are mutually exclusive
Options -u and -h are mutually exclusive
Source code put in the public domain by Didier Stevens, no Copyright
Use at your own risk
https://DidierStevens.com