Created
April 21, 2021 17:15
-
-
Save psifertex/6f1b0ff23bc4b09c75cd13701a5b8e04 to your computer and use it in GitHub Desktop.
example transform API plugin for Binary Ninja
This file contains hidden or 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
from binaryninja import Transform | |
from binaryninja.enums import TransformType | |
class HASHA(Transform): | |
name = 'HASHA' | |
long_name = 'ALWAYS RETURN A' | |
transform_type = TransformType.HashTransform | |
def perform_decode(self, data, params): | |
return b"AAAAA" | |
def perform_encode(self, data, params): | |
return b"AAAAA" | |
class XORB(Transform): | |
name = 'XORB' | |
long_name = 'XOR Buffer with B' | |
transform_type = TransformType.InvertingTransform | |
group = "XOR" | |
@staticmethod | |
def xorkey(data, key): | |
output = [] | |
for byte in data: | |
output.append(byte ^ key) | |
return bytes(output) | |
def perform_encode(self, data, params): | |
return self.xorkey(data, 0x42) | |
class XORA(Transform): | |
name = 'XORA' | |
long_name = 'XOR Buffer with A' | |
transform_type = TransformType.InvertingTransform | |
group = "XOR" | |
@staticmethod | |
def xorkey(data, key): | |
output = [] | |
for byte in data: | |
output.append(byte ^ key) | |
return bytes(output) | |
def perform_encode(self, data, params): | |
return self.xorkey(data, 0x41) | |
XORA.register() | |
XORB.register() | |
HASHA.register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment