diff --git a/README.md b/README.md index 2f400db..e20c21f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Opaque Predicate Patcher (v1.1.5) +# Opaque Predicate Patcher (v1.1.6) Author: **Vector 35 Inc** _Automatically patch opaque predicates_ diff --git a/__init__.py b/__init__.py index 5772a33..48e2b59 100644 --- a/__init__.py +++ b/__init__.py @@ -40,10 +40,10 @@ def patch_opaque_inner(bv, status=None): condition_value = i.condition.possible_values # If the condition never changes then its safe to patch the branch if condition_value.type == RegisterValueType.ConstantValue: - if condition_value.value == 0 and bv.is_never_branch_patch_available(i.address): - patch_locations.append((i.address, True)) - elif bv.is_always_branch_patch_available(i.address): - patch_locations.append((i.address, False)) + if condition_value.value == 0 and bv.is_never_branch_patch_available(i.address, i.il_basic_block.arch): + patch_locations.append((i.address, True, i.il_basic_block.arch)) + elif bv.is_always_branch_patch_available(i.address, i.il_basic_block.arch): + patch_locations.append((i.address, False, i.il_basic_block.arch)) return patch_locations @@ -55,13 +55,13 @@ def patch_opaque(bv, status=None): patch_locations = patch_opaque_inner(bv, status) if len(patch_locations) == 0 or analysis_pass == 10 or (status is not None and status.cancelled): break - for address, always in patch_locations: + for address, always, arch in patch_locations: if always: log_info("Patching instruction {} to never branch.".format(hex(address))) - bv.never_branch(address) + bv.never_branch(address, arch) else: log_info("Patching instruction {} to always branch.".format(hex(address))) - bv.always_branch(address) + bv.always_branch(address, arch) bv.update_analysis_and_wait() diff --git a/plugin.json b/plugin.json index f1773be..cd150b9 100644 --- a/plugin.json +++ b/plugin.json @@ -5,7 +5,6 @@ "helper" ], "api": [ - "python2", "python3" ], "description": "Automatically patch opaque predicates", @@ -25,7 +24,7 @@ "Darwin": "" }, "dependencies": {}, - "version": "1.1.5", + "version": "1.1.6", "author": "Vector 35 Inc", "minimumbinaryninjaversion": 0 } \ No newline at end of file