python-nmap的使用
import nmap nm = nmap.PortScanner() nm.scan(hosts="192.168.1.1/24", arguments="-n -sP -PE") nm.all_hosts() import telnetlib tm = telnetlib.Telnet(host="192.168.1.30", port=‘22‘, timeout=4) tm.read_until("\n", timeout=5)
python中的ssh登录模块
import pexpect pexpect.run("ls /tmp", withexitstatus=1) chk = pexpect.spawn("ls -l /tmp/") chk = pexpect.spawn("ls", [‘-l‘, ‘/tmp/‘]) ssh_k = pexpect.spawn(‘ssh -p22‘) ssh_k.expect("password:") ssh_k.expect("[p,P]assword:") #匹配多种结果 ssh_k.expect([pexpect.TIMEOUT, pexpect.EOF, "password"])
相关推荐
wh0 2020-07-27
huangzonggui 2020-06-08
清水寺小僧 2020-05-15
LychieFan 2020-04-14
风语者 2020-01-17
jszy 2019-12-29
furongwei 2019-12-23
sunln00 2019-12-20
sunln00 2019-12-18
YFCEMBEDD 2019-11-09
zhqagp 2015-07-11
kyssfanhui 2019-11-08
付春杰Blog 2019-10-30
过儿古墓 2011-01-05
TuxedoLinux 2009-04-29
kvikon 2019-08-15
生活随笔 2018-07-27
TangCuYu 2019-04-02