mirror of
https://github.com/Lekensteyn/lglaf.git
synced 2024-11-14 19:35:41 -05:00
README: update with more usage examples
This commit is contained in:
parent
1eaebefe87
commit
b89f14c01f
1 changed files with 31 additions and 1 deletions
32
README.md
32
README.md
|
@ -5,6 +5,7 @@ allows you to execute arbitrary shell commands on a LG phone as root.
|
||||||
Contents of this repository:
|
Contents of this repository:
|
||||||
|
|
||||||
- [lglaf.py](lglaf.py) - main script for communication (see below).
|
- [lglaf.py](lglaf.py) - main script for communication (see below).
|
||||||
|
- [partitions.py](partitions.py) - manage (list / read / write) partitions.
|
||||||
- [protocol.md](protocol.md) - Protocol documentation.
|
- [protocol.md](protocol.md) - Protocol documentation.
|
||||||
- [lglaf.lua](lglaf.lua) - Wireshark dissector for LG LAF protocol.
|
- [lglaf.lua](lglaf.lua) - Wireshark dissector for LG LAF protocol.
|
||||||
- [scripts/](scripts/) - Miscellaneous scripts.
|
- [scripts/](scripts/) - Miscellaneous scripts.
|
||||||
|
@ -51,7 +52,7 @@ Now you can issue commands using the interactive shell:
|
||||||
Linux version 3.4.0-perf-gf95c7ee (lgmobile@LGEARND12B2) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Aug 18 19:25:04 KST 2015
|
Linux version 3.4.0-perf-gf95c7ee (lgmobile@LGEARND12B2) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Aug 18 19:25:04 KST 2015
|
||||||
# exit
|
# exit
|
||||||
|
|
||||||
When commands are piped to stdin, the prompt is hidden:
|
When commands are piped to stdin (or given via `-c`), the prompt is hidden:
|
||||||
|
|
||||||
(venv)[peter@al lglaf]$ echo mount | python lglaf.py
|
(venv)[peter@al lglaf]$ echo mount | python lglaf.py
|
||||||
rootfs / rootfs rw 0 0
|
rootfs / rootfs rw 0 0
|
||||||
|
@ -65,7 +66,36 @@ When commands are piped to stdin, the prompt is hidden:
|
||||||
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,resuid=1000,errors=continue,data=ordered 0 0
|
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,resuid=1000,errors=continue,data=ordered 0 0
|
||||||
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 ro,seclabel,nosuid,nodev,relatime,data=ordered 0 0
|
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 ro,seclabel,nosuid,nodev,relatime,data=ordered 0 0
|
||||||
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,data=ordered 0 0
|
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,data=ordered 0 0
|
||||||
|
(venv)[peter@al lglaf]$ python lglaf.py -c date
|
||||||
|
Thu Jan 1 01:30:06 GMT 1970
|
||||||
(venv)[peter@al lglaf]$
|
(venv)[peter@al lglaf]$
|
||||||
|
|
||||||
|
## Advanced usage
|
||||||
|
If you know the [protocol](protocol.md), you can send commands directly. Each
|
||||||
|
request has a command, zero to four arguments and possibly a body. The
|
||||||
|
`lglaf.py` tool accepts this command:
|
||||||
|
|
||||||
|
![command] [arguments] [body]
|
||||||
|
|
||||||
|
All of these words accept escape sequences such as `\0` (octal escape), `\x00`
|
||||||
|
(hex), `\n`, `\r` and `\t`. The command must be exactly four bytes, the
|
||||||
|
arguments and body are optional.
|
||||||
|
|
||||||
|
Arguments are comma-separated and must either be four-byte sequences (such as
|
||||||
|
`\0\1\2\3`) or numbers (such as 0x03020100). If no arguments are given, but a
|
||||||
|
body is needed, keep two spaces between the command and argument.
|
||||||
|
|
||||||
|
Reboot device (command CTRL, arg1 RSET, no body):
|
||||||
|
|
||||||
|
$ ./lglaf.py --debug -c '!CTRL RSET'
|
||||||
|
LGLAF.py: DEBUG: Hello done, proceeding with commands
|
||||||
|
LGLAF.py: DEBUG: Header: b'CTRL' b'RSET' b'\0\0\0\0' b'\0\0\0\0' b'\0\0\0\0' b'\0\0\0\0' b'\xc7\xeb\0\0' b'\xbc\xab\xad\xb3'
|
||||||
|
|
||||||
|
Execute a shell command (command EXEC, no args, with body):
|
||||||
|
|
||||||
|
$ ./lglaf.py --debug --skip-hello -c '!EXEC id\0'
|
||||||
|
LGLAF.py: DEBUG: Header: b'EXEC' b'\0\0\0\0' b'\0\0\0\0' b'\0\0\0\0' b'\0\0\0\0' b'/\0\0\0' b'\x8dK\0\0' b'\xba\xa7\xba\xbc'
|
||||||
|
uid=0(root) gid=0(root) context=u:r:toolbox:s0
|
||||||
|
|
||||||
## License
|
## License
|
||||||
See the [LICENSE](LICENSE) file for the license (MIT).
|
See the [LICENSE](LICENSE) file for the license (MIT).
|
||||||
|
|
Loading…
Reference in a new issue