Skip to content

Commit f0822d0

Browse files
authored
Add listen option (#19)
* Add listen option * Clear up listen's help text
1 parent 9bfcb26 commit f0822d0

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

android_unpinner/__main__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from . import jdwplib
1414
from .vendor import build_tools
1515
from .vendor import frida_tools
16-
from .vendor import gadget_config_file
16+
from .vendor import gadget_config_file_listen, gadget_config_file_script_directory
1717
from .vendor import gadget_files
1818
from .vendor.platform_tools import adb
1919

@@ -22,6 +22,7 @@
2222
LIBGADGET_CONF = "libgadget.config.so"
2323

2424
force = False
25+
gadget_config_file = gadget_config_file_script_directory
2526

2627

2728
def patch_apk_file(infile: Path, outfile: Path) -> None:
@@ -227,9 +228,25 @@ def _force(ctx, param, val):
227228
)
228229

229230

231+
def _listen(ctx, param, val):
232+
global gadget_config_file
233+
gadget_config_file = gadget_config_file_listen
234+
235+
236+
listen_option = click.option(
237+
"-l",
238+
"--listen",
239+
help="Configure the Frida gadget to expose a server instead of running unpinning scripts.",
240+
is_flag=True,
241+
callback=_listen,
242+
expose_value=False,
243+
)
244+
245+
230246
@cli.command("all")
231247
@verbosity_option
232248
@force_option
249+
@listen_option
233250
@click.argument(
234251
"apk-files",
235252
type=click.Path(path_type=Path, exists=True),
@@ -293,6 +310,7 @@ def patch_apks(apks: list[Path]) -> None:
293310
@cli.command()
294311
@verbosity_option
295312
@force_option
313+
@listen_option
296314
def push_resources() -> None:
297315
"""Copy Frida gadget and scripts to device."""
298316
copy_files()

android_unpinner/vendor/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
"x86": here / f"frida/frida-gadget-{frida_version}-android-x86.so",
1010
"x86_64": here / f"frida/frida-gadget-{frida_version}-android-x86_64.so",
1111
}
12-
gadget_config_file = here / "frida/gadget-config.json"
12+
gadget_config_file_script_directory = here / "frida/gadget-config-script-directory.json"
13+
gadget_config_file_listen = here / "frida/gadget-config-listen.json"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"interaction": {
3+
"type": "listen"
4+
}
5+
}

android_unpinner/vendor/frida/gadget-config.json renamed to android_unpinner/vendor/frida/gadget-config-script-directory.json

File renamed without changes.

0 commit comments

Comments
 (0)