In Kali, I'm trying to build a python library for automating some pen testing tasks by opening shells so that users can interact with things like created tunnels, ssh sessions, etc.
I started trying something like:
from subprocess import Popen,PIPE
p1 = Popen(['x-terminal-emulator'], stdin=PIPE)
p1.communicate('echo "hello world"')
and also trying sending stdin input, this creates the terminal but doesn't send the hello world command.
How can I do basic tasks with this newly created terminal window in Kali?
- Send input to the terminal
- Read output
- Position the terminal window
I'm not asking for the code, just a pointer on where to get started would be great.