-
Notifications
You must be signed in to change notification settings - Fork 263
CLI
The Command Line Interface require root user and can run with command /data/adb/lspd/bin/cli
Must be enabled from gui manager: Settings -> Enable CLI
For security reason there is the possibility to set a session timeout, the first time a pin code is requested after the timeout a new code is requested. The PIN code is requested for each process. If the device is strong secure, we can set session timeout to Disabled, so no pin code is required.
There are 6 subcommands:
- log => show LSPosed's log
- modules => manage modules enabled, disable and list
- scope => manage scope for a module add, remove and list
- status => show the status of LSPosed
- backup => backup module's settings
- restore => restore module's settings
Examples:
/data/adb/lspd/bin/cli status
API version: 93
Injection Interface: Zygisk
Framework version: 1.8.3(6615)
System version: 11 (API 30)
Device: Xiaomi Redmi Redmi Note 9 Pro
System ABI: arm64-v8a
if the CLI is disabled we got an ERROR
/data/adb/lspd/bin/cli status
ERROR: transact failed
/data/adb/lspd/bin/cli modules ls
dev.ukanth.ufirewall 10284 disable
ls accept 2 parameters for filter the output
/data/adb/lspd/bin/cli modules ls -h
Unknown option: '-h'
Usage: cli modules ls [-d | -e]
-d, --disabled list only disabled modules
-e, --enabled list only enabled modules
/data/adb/lspd/bin/cli modules set
Missing required parameter: '<modules name>'
Usage: cli modules set [-i] (-d | -e) <modules name>...
<modules name>... packages name
-d, --disable disable modules
-e, --enable enable modules
-i, --ignore ignore not installed packages
/data/adb/lspd/bin/cli modules set dev.ukanth.ufirewall -e
Scope list is empty dev.ukanth.ufirewall not enabled
before enable module is better set the scope
/data/adb/lspd/bin/cli scope
Missing required subcommand
Usage: cli scope [-h] [COMMAND]
-h, help, --help display this help message
Commands:
ls
set
/data/adb/lspd/bin/cli scope ls
Missing required parameter: '<module name>'
Usage: cli scope ls <module name>
<module name> module's name
/data/adb/lspd/bin/cli scope ls dev.ukanth.ufirewall
dev.ukanth.ufirewall/0
when there isn't apps we got only the module
/data/adb/lspd/bin/cli scope set dev.ukanth.ufirewall
Missing required parameter: '<scopes>'
Usage: cli scope set [-i] [-a | -d | -s] <module name> <scopes>...
<module name> module's name
<scopes>... package name/uid
-a, --append append packages to scope
-d, --remove remove packages to scope
-i, --ignore ignore not installed packages
-s, --set set a new scope (default)
set replace the scope of modules. append add a list of apps to scope of modules remove delete a list of apps to scope of modules
Append apps to module
/data/adb/lspd/bin/cli scope set -a dev.ukanth.ufirewall org.testapp1/0 org.testapp2/0
Remove apps to module
/data/adb/lspd/bin/cli scope set -d dev.ukanth.ufirewall org.testapp1/0 org.testapp2/0
Replace apps, remove all apps and set only the apps in the argument the parameter -s is optional
/data/adb/lspd/bin/cli scope set -s dev.ukanth.ufirewall org.testapp1/0 org.testapp2/0
The app of module will always be added, no need to add, it can't be removed.
/data/adb/lspd/bin/cli log -h
Usage: cli log [-cfhv]
-c, clear, --clear Clear log
-f, follow, --follow Follow update of log, as tail -f
-h, help, --help display this help message
-v, verbose, --verbose Get verbose log
LSPosed has 2 logs, normal and verbose. Without the parameter -v the operations are executed on normal log, otherwise on verbose log.
Read verbose log and quit
/data/adb/lspd/bin/cli log -v
----part 1 start----
[ 1970-08-20T10:26:09.451 0: 579: 579 F/libc ] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 579 (init), pid 579 (init)
[ 1970-08-20T10:26:09.469 0: 579: 579 F/libc ] crash_dump helper failed to exec
[ 1970-08-20T10:26:11.899 0: 797: 797 I/Magisk ] Magisk 24.3(24300) daemon started
[ 1970-08-20T10:26:11.900 0: 797: 797 I/Magisk ] * Device API level: 30
[ 1970-08-20T10:26:11.909 0: 797: 799 I/Magisk ] ** post-fs-data mode running
[ 1970-08-20T10:26:11.911 0: 797: 799 I/Magisk ] * Mounting mirrors
Read verbose log and follow update exit with CTRL+C
/data/adb/lspd/bin/cli log -v -f
----part 1 start----
[ 1970-08-20T10:26:09.451 0: 579: 579 F/libc ] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 579 (init), pid 579 (init)
[ 1970-08-20T10:26:09.469 0: 579: 579 F/libc ] crash_dump helper failed to exec
[ 1970-08-20T10:26:11.899 0: 797: 797 I/Magisk ] Magisk 24.3(24300) daemon started
[ 1970-08-20T10:26:11.900 0: 797: 797 I/Magisk ] * Device API level: 30
[ 1970-08-20T10:26:11.909 0: 797: 799 I/Magisk ] ** post-fs-data mode running
[ 1970-08-20T10:26:11.911 0: 797: 799 I/Magisk ] * Mounting mirrors
Clear verbose log
/data/adb/lspd/bin/cli log -v -c
Without arguments start a backup of all modules and make a file with name LSPosed_<date and time>.lsp.gz
/data/adb/lspd/bin/cli backup -h
Usage: cli backup [-h] [-f=<file>] [<module name>...]
[<module name>...] module's name default all
-f, --file=<file> output file
-h, help, --help display this help message
Backup all to file
/data/adb/lspd/bin/cli backup -f mybackup.lsp
Backup one or more modules's settings
/data/adb/lspd/bin/cli backup org.testmodule1
/data/adb/lspd/bin/cli backup org.testmodule1 org.testmodule2
Restore require restore file from previous backup (cli or gui)
/data/adb/lspd/bin/cli restore
Missing required option: '--file=<file>'
Usage: cli restore [-h] -f=<file> [<module name>...]
[<module name>...] module's name default all
-f, --file=<file> input file
-h, help, --help display this help message
Restore all modules's settings in file
/data/adb/lspd/bin/cli restore -f mybackup.lsp
Restore one or more modules's settings
/data/adb/lspd/bin/cli restore -f mybackup.lsp org.testmodule1
/data/adb/lspd/bin/cli restore -f mybackup.lsp org.testmodule1 org.testmodule2