Lekensteyn / lglaf

LG Download Mode utility and documentation
https://lekensteyn.nl/lglaf/
MIT License
137 stars 74 forks source link

Add rawshell switch => Don't prepend anything to shell command #28

Closed tuxuser closed 6 years ago

tuxuser commented 6 years ago

Rawshell cmdline switch For more locked-down / recent devices the prepending of *b'sh -c eval\t"$"</dev/null\t2>&1 -- ' (Source code) will make every command fail. When providing the switch --rawshell**, the command is sent as-is.

Fixes Pull requests:

24 LG Q6: additionnal limitations from Lg ? (Point 2)

Before:

Type a shell command to execute or "exit" to leave.
# ls /sbin/lafd
Hello, I am LAF. Nice to meet you. #

Now:

Type a shell command to execute or "exit" to leave.
# ls -l /sbin/lafd
-rwxr-x--- root     root       496888 1970-01-01 00:00 lafd
#
aenglebert commented 6 years ago

Works well on LG Q6, I confirm it solves #24 LG Q6: additionnal limitations from Lg ? (Point 2).

Lekensteyn commented 6 years ago

This is really a cat and mouse game with LG, right? :-P

The downside of rawshell is that you do not get any feedback in case of errors (since stderr is not redirected). Instead of adding the --rawshell option, what about using !EXEC ls -l /sbin/lafd\0 as command? Is that an acceptable workaround?

tuxuser commented 6 years ago

If you want to execute several commands it's a little bit annoying, isn't it? Imho its better to expose this functionality for people who need it and maybe print a msg "WARNING: rawshell provides no stderr output" ?!

Lekensteyn commented 6 years ago

If people use --rawshell, they probably know what they are doing and no runtime warning is needed (maybe at DEBUG level)? Alternatively (or in addition?), the --help message could clarify that caveat. What do you think would better?

tuxuser commented 6 years ago

Giving the info to the user via --help is fine and cleaner than printing an additional warning at runtime, yeah

Lekensteyn commented 6 years ago

Thanks!