Skip to content

Commit

Permalink
Merge branch 'master' into fix-patch-names
Browse files Browse the repository at this point in the history
  • Loading branch information
jeverling committed Sep 27, 2023
2 parents 093705a + 0543f4d commit fe6675e
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 10 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release

on:
push:
branches: [ "master" ]
tags: [ "*" ]

jobs:
create_release:
name: Create Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -U
- name: Preparing the patched apk
run: |
python main.py
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
New release!
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./PatchedWhatsApp.apk
asset_name: PatchedWhatsApp.apk
asset_content_type: application/vnd.android.package-archive
2 changes: 1 addition & 1 deletion tests/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def extractor(apk_path: str, output_path: str, tmp_path_factory):

@pytest.fixture()
def patcher(extractor: Extractor) -> Patcher:
return Patcher(extractor.temp_path, should_enable_ab_tests=True)
return Patcher(extractor.temp_path, should_enable_ab_tests=False)


def test_extract_apk(extractor: Extractor):
Expand Down
2 changes: 1 addition & 1 deletion whatsapp_patcher/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.9"
__version__ = "1.0.11"
6 changes: 2 additions & 4 deletions whatsapp_patcher/patches/ABTestPatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def __init__(self, extracted_path):

def replace_return_values_smali(self, method_body):
new_method_body = method_body
arr = [6, 7]
counter = 0
for match in self.RETURN_RE_SMALI.finditer(method_body):
register_name = match.group().strip().split(" ")[1]
Expand All @@ -32,11 +31,10 @@ def replace_return_values_smali(self, method_body):
for test in self.BAD_TESTS:
replacement += f"""
const {temp_register}, {test}
if-eq p2, {temp_register}, :cond_{arr[counter]} """

if-eq p2, {temp_register}, :cond_{counter} """
replacement += f"""
const {register_name}, 1
:cond_{arr[counter]}
:cond_{counter}
{match.group().strip()}
"""
new_method_body = new_method_body.replace(match.group(), replacement)
Expand Down
7 changes: 4 additions & 3 deletions whatsapp_patcher/patches/SendReceiptPatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def __init__(self, extracted_path):

def class_filter(self, class_data: str) -> bool:
if '"; shouldForceReadSelfReceipt="' in class_data:
return False
return True
return False

def class_modifier(self, class_data) -> str:
send_receipt_constructor_body = self.RECEIPT_METHOD_RE.findall(class_data)[0]
return class_data
"""send_receipt_constructor_body = self.RECEIPT_METHOD_RE.findall(class_data)[0]
return class_data.replace(
send_receipt_constructor_body,
self.RECEIPT_METHOD_REPLACE + send_receipt_constructor_body,
)
)"""
2 changes: 1 addition & 1 deletion whatsapp_patcher/patches/SignatureVerifierPatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class SignatureVerifierPatch(Patch):
SIGNATURE_START = 120
SIGNATURE_END = -446
SIGNATURE_END = -444
SIGN_VERIFICATION_RE = re.compile(
r"\.method public static \w+\(Landroid\/content\/Context;\)\[Landroid\/content\/pm\/Signature;\s*\.locals \w+\s*(.*?)\s*.end method",
re.DOTALL,
Expand Down

0 comments on commit fe6675e

Please sign in to comment.