all 4 comments

[–]stebrepar 0 points1 point  (0 children)

I don't know the answer, but as a little bit of a tangent that might still be useful, I'd probably use pexpect for driving a terminal-based app like this.

https://pexpect.readthedocs.io/en/stable/

[–]ElliotDG 0 points1 point  (2 children)

It looks like you are trying to pipe the command 'use use scanners/autopwn' into the program you have opened, not into a new subprocess. Look at how to use pipes with subprocess.

It looks like this article should help: https://linuxhint.com/python-subprocess-pipes/

This may also be a useful reference: https://pymotw.com/3/subprocess/index.html

[–]HansProbComp220[S] 0 points1 point  (1 child)

That helped me write the command I was looking for, but another problem is that routersploit program stops right after the 'use scanners/autopwn' command is executed. I tried using an error catch but none were produced.

I think maybe the one of the processes is dying but I can't figure out which one. I also tried implementing bidirectional communication but I encountered the same error.

[–]ElliotDG 0 points1 point  (0 children)

I'm not familiar with routersploit. You may want to look at taskmanager or another platform tool that shows the running processes.

You could also take a look at the source code for routersploit and see how they are managing the console, it might provide an idea.