simple telnet module
Project description
xtelnet
This is an easy to use telnet module to interact with a remote system smoothly over this protocol!
Install :
pip install xtelnet
or
pip3 install xtelnet
Usage on a script :
import xtelnet
t=xtelnet.session()
ip='192.168.0.32'#just an example
t.login(ip, username='root',password='toor',p=23,timeout=5)
output1=t.execute('echo ala_is_king')
print(output1)
output2=t.execute('cd / && ls')
print(output2)
t.close()
Usage from command line :
python -m xtelnet host [options...]
options:
--host : set a host to connect to (required)
--username : set a username (required if username is needed to access)
--password : set a password (required if password is needed to access)
--port : (23 by default) set port (optional)
--timeout : (5 by default) set timeout (optional)
--add-command : a command to execute after login (optional)
--command-timeout : timeout for command execution (optional)
--set-newline : set a new line indecator("\n" or "\r\n") (optional)
--no-shell : disable shell after authentication (optional)
--help : get this help message (optional)
example:
python -m xtelnet 127.0.0.1 --username root --password root --add-command "echo ala" --add-command "dir"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.