Score:0

Sending simulated key presses to a specific process using python script in linux

fo flag

On my Linux system I have opened a Telnet session. On the other tab I am running a Python script and giving commands to the Telnet session using mkfifo file redirection. But I am not able to simulate key presses to the Telnet session through my Python script.

so in one tab i have opened a telnet session using these commands

mkfifo my.fifo
cat >my.fifo &
cat my.fifo | telnet 182.23.45.12 10000 2>&1 | tee log.txt

Now in another tab i am running a python script which is giving commands to this telnet process. That I am doing through printf "command" > my.fifo .

But I need to send a key press event to the telnet process which i am not able to do using this below command

printf "command" > my.fifo

But how can I do ctrl+c using the same way?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.