From 2f7b2c60514766f097f5ed6244b105f5c68d9241 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 20:32:08 -0400 Subject: [PATCH 1/8] Update __init__.py Not done - Micah --- __init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/__init__.py b/__init__.py index e69de29..41f914e 100644 --- a/__init__.py +++ b/__init__.py @@ -0,0 +1,6 @@ +class MBADeobfuscationInBackground(BackgroundTaskThread): + def __init__(self): + print("what do i do in this constructor") + + def run(self): + From 7d0642ec9ed8c3eb08d1070a003332961601fdd2 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 20:54:48 -0400 Subject: [PATCH 2/8] Update __init__.py I think I did the step 2 --- __init__.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 41f914e..e3a3238 100644 --- a/__init__.py +++ b/__init__.py @@ -1,6 +1,22 @@ +import sys +from binaryninja.log import log_info +from binaryninja.binaryview import BinaryViewType +from binaryninja.plugin import PluginCommand +from binaryninja.plugin import BackgroundTaskThread +from binaryninja.enums import (MediumLevelILOperation, RegisterValueType) + class MBADeobfuscationInBackground(BackgroundTaskThread): - def __init__(self): - print("what do i do in this constructor") + def __init__(self, bv, msg): + BackgroundTaskThread.__init__(self, msg, True) + self.bv = bv def run(self): - + for instr in self.bv.mlil_instructions: + if instr.operation == MediumLevelILOperation.MLIL_IF: + log_info(instr) + + +def mba_deobfuscation_in_background(self): + # step 3 - how? + # instance = + print( From 5ef86b40cb69915e23890a2e41ab392c58ecd115 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 20:55:04 -0400 Subject: [PATCH 3/8] Update __init__.py --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index e3a3238..5cf10a2 100644 --- a/__init__.py +++ b/__init__.py @@ -19,4 +19,4 @@ def run(self): def mba_deobfuscation_in_background(self): # step 3 - how? # instance = - print( + print("what now") From b3e0103b68523ab2c8e6eba7acddd1fd5a516f57 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 21:59:28 -0400 Subject: [PATCH 4/8] Update __init__.py I think I finished step 4 --- __init__.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/__init__.py b/__init__.py index 5cf10a2..08b825e 100644 --- a/__init__.py +++ b/__init__.py @@ -1,22 +1,23 @@ -import sys -from binaryninja.log import log_info +=from binaryninja.log import log_info from binaryninja.binaryview import BinaryViewType from binaryninja.plugin import PluginCommand from binaryninja.plugin import BackgroundTaskThread -from binaryninja.enums import (MediumLevelILOperation, RegisterValueType) +from binaryninja.enums import MediumLevelILOperation + class MBADeobfuscationInBackground(BackgroundTaskThread): - def __init__(self, bv, msg): - BackgroundTaskThread.__init__(self, msg, True) - self.bv = bv + def __init__(self, bv, msg): + BackgroundTaskThread.__init__(self, msg, True) + self.bv = bv + + def run(self): + for instr in self.bv.mlil_instructions: + if instr.operation == MediumLevelILOperation.MLIL_IF: + log_info(instr) - def run(self): - for instr in self.bv.mlil_instructions: - if instr.operation == MediumLevelILOperation.MLIL_IF: - log_info(instr) +def mba_deobfuscation_in_background(bv): + background_task = MBADeobfuscationInBackground(bv, "Starting MBA Deobfuscation") + background_task.start() -def mba_deobfuscation_in_background(self): - # step 3 - how? - # instance = - print("what now") +PluginCommand.register("MBA Deobfuscation", "Simplifying booleans" , mba_deobfuscation_in_background) From 40440d2220d35eecbba8470742a9a4efd6c94625 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 22:03:54 -0400 Subject: [PATCH 5/8] Update __init__.py fixed typo --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 08b825e..348e813 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,4 @@ -=from binaryninja.log import log_info +from binaryninja.log import log_info from binaryninja.binaryview import BinaryViewType from binaryninja.plugin import PluginCommand from binaryninja.plugin import BackgroundTaskThread From 5329562983267468dc5a28ad955ee73a5291e8b7 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Tue, 9 Jul 2024 22:11:19 -0400 Subject: [PATCH 6/8] Replaced __init__.py with formatted version --- __init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 348e813..527ec82 100644 --- a/__init__.py +++ b/__init__.py @@ -11,7 +11,7 @@ def __init__(self, bv, msg): self.bv = bv def run(self): - for instr in self.bv.mlil_instructions: + for instr in self.bv.mlil_instructions: if instr.operation == MediumLevelILOperation.MLIL_IF: log_info(instr) @@ -20,4 +20,7 @@ def mba_deobfuscation_in_background(bv): background_task = MBADeobfuscationInBackground(bv, "Starting MBA Deobfuscation") background_task.start() -PluginCommand.register("MBA Deobfuscation", "Simplifying booleans" , mba_deobfuscation_in_background) + +PluginCommand.register( + "MBA Deobfuscation", "Simplifying booleans", mba_deobfuscation_in_background +) From e6a2e78b6fe492f3ba5b2d4fdf37b7dbf25ba4d5 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Thu, 11 Jul 2024 13:17:32 -0400 Subject: [PATCH 7/8] Update __init__.py Added requested issue changes --- __init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index 527ec82..83aa09f 100644 --- a/__init__.py +++ b/__init__.py @@ -6,18 +6,23 @@ class MBADeobfuscationInBackground(BackgroundTaskThread): - def __init__(self, bv, msg): + '''Assigns a thread to MBA deobfuscation''' + + def __init__(self, bv : BinaryViewType, msg : str): + '''Initiates the MBADeobfuscationInBackground object and defines bv attribute''' BackgroundTaskThread.__init__(self, msg, True) self.bv = bv def run(self): + '''Logs all program if statements to BinaryNinja log''' for instr in self.bv.mlil_instructions: if instr.operation == MediumLevelILOperation.MLIL_IF: log_info(instr) -def mba_deobfuscation_in_background(bv): - background_task = MBADeobfuscationInBackground(bv, "Starting MBA Deobfuscation") +def mba_deobfuscation_in_background(bv : BinaryViewType): + '''Creates a background task and starts MBA deobfuscation''' + background_task : MBADeobfuscationInBackground = MBADeobfuscationInBackground(bv, "Starting MBA Deobfuscation") background_task.start() From 4759412fcb6ce76a566c918b1dd351877a4c6711 Mon Sep 17 00:00:00 2001 From: micah-0w0 Date: Thu, 11 Jul 2024 13:26:05 -0400 Subject: [PATCH 8/8] Updated __init__.py requested changes --- __init__.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index 83aa09f..50db525 100644 --- a/__init__.py +++ b/__init__.py @@ -6,23 +6,25 @@ class MBADeobfuscationInBackground(BackgroundTaskThread): - '''Assigns a thread to MBA deobfuscation''' - - def __init__(self, bv : BinaryViewType, msg : str): - '''Initiates the MBADeobfuscationInBackground object and defines bv attribute''' + """Assigns a thread to MBA deobfuscation""" + + def __init__(self, bv: BinaryViewType, msg: str): + """Initiates the MBADeobfuscationInBackground object and defines bv attribute""" BackgroundTaskThread.__init__(self, msg, True) self.bv = bv def run(self): - '''Logs all program if statements to BinaryNinja log''' + """Logs all program if statements to BinaryNinja log""" for instr in self.bv.mlil_instructions: if instr.operation == MediumLevelILOperation.MLIL_IF: log_info(instr) -def mba_deobfuscation_in_background(bv : BinaryViewType): - '''Creates a background task and starts MBA deobfuscation''' - background_task : MBADeobfuscationInBackground = MBADeobfuscationInBackground(bv, "Starting MBA Deobfuscation") +def mba_deobfuscation_in_background(bv: BinaryViewType): + """Creates a background task and starts MBA deobfuscation""" + background_task: MBADeobfuscationInBackground = MBADeobfuscationInBackground( + bv, "Starting MBA Deobfuscation" + ) background_task.start()