Skip to content

Commit

Permalink
feat: impl --edit flag to ask for user confirmation and pause recompi…
Browse files Browse the repository at this point in the history
…ling step
  • Loading branch information
eriestrisnadi committed Jan 2, 2025
1 parent b055452 commit a5edd63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/fridafuse/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import argparse
from typing import Sequence

import readchar

from fridafuse.__about__ import __description__, __title__, __version__
from fridafuse.constants import GRAY, GREEN, LATEST_VERSION, RED, STOP

Expand Down Expand Up @@ -32,6 +34,9 @@ def parse_args(args: Sequence[str] | None, **kwargs):
shared_parser.add_argument(
'--skip-sign', help='Skip to create signed APK', default=True, action='store_false', dest='sign'
)
shared_parser.add_argument(
'--edit', help='Edit the APK after decompiling', action='store_true', default=False, dest='edit'
)

# Methods (Subcommands)
subparsers = parser.add_subparsers(title='methods', dest='method', required=True)
Expand Down Expand Up @@ -68,3 +73,9 @@ def parse_args(args: Sequence[str] | None, **kwargs):

def print_logo():
print(logo)


def wait_for_any_input():
pressed = readchar.readkey()
if pressed == readchar.key.CTRL_C:
raise KeyboardInterrupt
5 changes: 5 additions & 0 deletions src/fridafuse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def main(args: Sequence[str] | None = None, **kwargs):
if not patcher.inject_smali(manifest_file):
sys.exit(1)

if args.edit:
logger.info(f'Please edit decompiled APK on the following directory: {decompiled_dir}')
logger.info('After editing, press any key to continue...')
cli.wait_for_any_input()

if decompiled_dir.is_dir():
patched_file = recompile_apk(output_file)

Expand Down

0 comments on commit a5edd63

Please sign in to comment.