-
Notifications
You must be signed in to change notification settings - Fork 564
Experimental integration of CLI support #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This commit is squashed from the repo https://github.com/AnatolyJacobs/LSPosed_CLI. Further work are required to improve / polish it. Refer to https://github.com/mywalkb/LSPosed_mod/wiki/CLI for current CLI interface. Co-authored-by: Anatoly Jacobs <[email protected]> Co-authored-by: mywalk <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
This commit refactors the experimental CLI to establish a robust and secure foundation for command-line interaction. The previous session-based model was unintuitive, unsuitable for scripting, and has been entirely replaced. The new design introduces a persistent, file-based PIN and restricts execution to the root user, laying the groundwork for all future CLI development. Key Changes: - **Persistent PIN Authentication:** - The CLI is now protected by a randomly generated PIN that is stored in LSPosed's configuration, surviving reboots. - The complex session timeout and notification-based PIN system has been completely removed. - **Script-Friendly Credentials:** - Authentication is now standard and predictable, using the `--pin` command-line argument or the `LSPOSED_CLI_PIN` environment variable for convenience in scripts. - **User-Friendly Helper Command:** - A `login` command has been added. It verifies the user's PIN and provides a convenient `export` command to set the environment variable for the current shell session.
A file-based PIN can be easily abused by root users. In the future, we plan to allow shell users to run the CLI tool directly.
LSPosed Command Line Interface (CLI)The LSPosed Command Line Interface (CLI) is a powerful, professional tool designed for developers, power users, and automation experts. It provides direct shell access to manage the LSPosed framework, making it ideal for scripting, bulk operations, and advanced management tasks. The CLI binary is located at PrerequisitesBefore using the CLI, please ensure the following conditions are met. 1. Root AccessThe CLI communicates with the privileged LSPosed daemon and requires root access to function. Commands must be run as the superuser, typically via 2. Enabling the CLI FeatureFor security, the CLI is disabled by default. You must enable it first from the LSPosed Manager application:
First Steps: Authentication and Session SetupThe best way to begin is by using the Step 1: Get Your PIN Step 2: Create a Shell Alias (Highly Recommended) # In your ADB shell:
alias lsposed-cli='su -c /data/adb/lspd/bin/cli'Now you can simply use Step 3: Log In and Set Your Session Variable lsposed-cli --pin <your-pin-from-the-app> loginThe command will verify your PIN and give you an Example Output: Step 4: Run the Export Command Authentication ModelThe CLI is protected by a secure PIN to prevent unauthorized access. Key Characteristics of the PIN:
Debug BuildsFor developer convenience, debug builds of LSPosed have the CLI enabled by default and do not require PIN authentication. Global OptionsThese options are available for most commands. JSON Output for Scripting (
|
It seems that the module application itself is no longer (by default) in its scope list.
|
Hi, is there any plan to ship this? |
|
For debug build of this feature, there is no need to input authorization code (for the sake of dev convenience). As for the release build, I plan to allow users invoke the commandline with merely shell access permission. |
This commit is initially squashed from the repo https://github.com/AnatolyJacobs/LSPosed_CLI.
Further work are required to improve / polish it.
Refer to https://github.com/mywalkb/LSPosed_mod/wiki/CLI for current CLI interface.