Skip to main content

Python CLI for the Nook Android instrumentation server

Project description

Nook Python Host Package

host/nook-py provides the Python host SDK and CLI for Nook.

It exposes:

  • nook-cli
  • nook-gadget

Install

Install from source:

pip install .

Verify:

nook-cli --help
nook-gadget --help

Prerequisite

nook-cli has two runtime paths:

  • default server mode: requires a running rooted nook-server
  • explicit gadget mode: use --gadget to attach to a gadgetized APK in listen mode

The Python package does not build or launch nook-server automatically. Download the matching nook-server release, then push and start it manually:

adb push .\nook-server /data/local/tmp/nook/nook-server
adb shell "su -c 'chmod 755 /data/local/tmp/nook/nook-server'"
adb shell "su -c '/data/local/tmp/nook/nook-server'"

Common Usage

Server attach:

nook-cli -U com.demo.target -l .\hook.js

Server spawn:

nook-cli -U -f com.demo.target -l .\hook.js

Gadget attach over the gadget listen socket:

nook-cli -U --gadget com.demo.target -l .\hook.js

List processes:

nook-cli ps

List applications:

nook-cli apps

Patch an APK with the gadget:

nook-gadget patchapk --source .\target.apk
nook-cli patchapk .\target.apk

Patch an APK and package a startup script that runs inside the app on launch:

nook-gadget patchapk --source .\target.apk --startup-script .\hook.js
nook-cli patchapk .\target.apk -s .\hook.js

Patch an APK in gadget listen mode and pause app startup until the host attaches:

nook-cli patchapk .\target.apk --on-load wait

Dump in-memory dex artifacts from a running target:

nook-cli dexdump com.demo.target -U

Spawn a target, wait, then scan for dex artifacts:

nook-cli dexdump --spawn com.demo.target -U --deep --sleep 3000

Install a patched APK:

nook-gadget install --apk .\target-nook.apk

Launch the target app:

nook-gadget launch --package com.demo.target --activity .MainActivity --stop-first --clear-logcat --wait 3

Notes

  • Rooted Android device required
  • Current primary target is arm64-v8a
  • --strict-zygote-control remains experimental
  • nook-gadget patchapk and nook-cli patchapk currently expect a full Nook repo checkout because they reuse repo build/signing helpers
  • --gadget is explicit by design; without it, nook-cli -U ... still targets nook-server
  • gadget packaged startup-script mode and host-attached listen mode are both supported
  • See docs/nook-gadget-usage.md for the practical gadget workflow
  • See docs/nook-dexdump-usage.md for the practical dexdump workflow

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nook_cli-0.1.2.tar.gz (61.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nook_cli-0.1.2-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file nook_cli-0.1.2.tar.gz.

File metadata

  • Download URL: nook_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 61.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.5

File hashes

Hashes for nook_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9e68963b709062b4f319bc2742a0149954d0f0f5052e547b1670e8baa1c66b5d
MD5 cefc0390fb8b7af0ad98061c66bafd60
BLAKE2b-256 04373a974e0801675572139bac50ca1835b9b2a3ef79dc8a5760406ce2bdc979

See more details on using hashes here.

File details

Details for the file nook_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nook_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 65.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.5

File hashes

Hashes for nook_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 580e360ec6c09ce28adf2affdd6dd7aa5bc6ffd2230d3a0602673ac3565c6eef
MD5 507b7f0879f5b4f50d78a232eed87edb
BLAKE2b-256 5215567f2df27febcbb98393399f0d38bef6799ccbb838d2ee92151a4ca419cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page