Skip to content
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

Feature request: termux transcript #2184

Closed
Gameye98 opened this issue Jul 21, 2021 · 7 comments
Closed

Feature request: termux transcript #2184

Gameye98 opened this issue Jul 21, 2021 · 7 comments

Comments

@Gameye98
Copy link

Gameye98 commented Jul 21, 2021

Could you please add new feature such as command that share transcript or print transcript to stdout, its gonna help a lot to implement on automate script...

@Gameye98 Gameye98 changed the title Feature request: termux transcript Could you please add new feature such as command that share transcript or print transcript to stdout, its gonna help a lot to implement on automate script... Feature request: termux transcript Jul 21, 2021
@agnostic-apollo
Copy link
Member

Provide details of how you are running the script.

And share where? You mean open share menu or to specific app.

You can already do that with android am command.

To open share menu, run am start --user 0 -a "android.intent.action.SEND" --es "android.intent.extra.TEXT" "some text" -t "text/plain".

To send to specific app, run something like am start --user 0 -n com.rhmsoft.edit.pro/com.rhmsoft.edit.activity.MainActivity -a "android.intent.action.SEND" --es "android.intent.extra.TEXT" "some text" -t "text/plain"

And transcript is already printed to stdout for foreground commands. Don't know what you mean by that.

@Gameye98
Copy link
Author

Gameye98 commented Jul 21, 2021

Screenshot_20210721_153812
Screenshot_20210721_153819

From termux share transcript

root@localhost:~# uname -a
Linux localhost 4.19.127-ga6328e9da-dirty #1 SMP PREEMPT Sat Jun 19 21:06:15 CST 2021 aarch64 Android
root@localhost:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
u0_a175  31314  0.9  0.1 2134080 5232 pts/27   S<s   1970   0:00 /data/data/com.termux/files/usr/bin/bash -l
u0_a175  31392  1.0  0.1 2132148 3532 pts/27   R<+   1970   0:00 ps aux
root@localhost:~#

Its gonna be a lot of help if we could get some command part of the termux-api, like termux-transcript with argument -share or -stdout

-share: has the same function termux share transcript from more action dialog
-stdout: print transcript to stdout (i know transcript is already printed out but its still useful to get an input stream of transcript by pipeline or system() function call from scripting/programming language, like an example subprocess from python).
I mean if we could get transcript easily from command, we could get output from other tool or process running by...

@Gameye98
Copy link
Author

and other useful method/argument to output transcript as a file

-output=file.txt

Hope its get added on the new updated version of termux

@agnostic-apollo
Copy link
Member

share: has the same function termux share transcript from more action dialog

Support with intent to TermuxService should be possible to add. But would require logic of which foreground session's transcript to share. The desired one may not be current one. Probably the first named session that matches can be used to share for the right one.

printed out but its still useful to get an input stream of transcript

You can use tee command to redirect output of a command to both stdout and to a file. Then you can read the file in other processes.

You may also wanna look at the first addition under Added for v0.115 Changelog for saving output of RUN_COMMMAND commands to files via 2aafcf8. Check RUN_COMMAND wiki here, although not updated yet.

@Gameye98
Copy link
Author

But using tee working with interpreter application type like metasploit is not gonna applicable, still transcript is better.

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Jul 21, 2021

Then just start a new session with RUN_COMMAND intent with EXTRA_RESULT_DIRECTORY set and when you exit the session, transcript will automatically be saved to a file and you can read it in other sessions/tasks. If you want to print the transcript to stdout for the current state of a specific session while its still running in synchronous manner, then possibly something like termux-api will be better instead of just saving it to a file since in that case you will have to manually wait for the file to be created after intent is sent to TermuxService. If someone wants to implement the feature, let me know, it can be discussed further.

@trygveaa
Copy link
Contributor

Instead of having a Termux specific method for this, have you tried using the script command? If you run this before the commands you want to save a transcript from, it will save a complete transcript in a file for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants