XOR Files With Python


This is a simple script, written in Python, that perform a logical exclusion, XOR, on two files and saves the result in the destination file. It is one of the most simple and effective tool in my forensics-toolbox. I used this tool several times for example to recover data from a broken RAID 5 or deobfuscate an obfuscated binary or image. The usage is very simple and intuitive.
You can find the full code and examples in the repository.

Have fun!


Click here for the Powershell Version.


5 thoughts on “XOR Files With Python

  1. neo

    Traceback (most recent call last):
    File “xor-files.py”, line 22, in
    xord_byte_array[i] = file1_b[i] ^ file2_b[i]
    IndexError: bytearray index out of range

Leave a Reply

Your email address will not be published. Required fields are marked *