python使用sqlmap API检测SQL注入

0x00前言:
大家都知道sqlmap是非常强大的sql注入工具,最近发现他有个sqlmap API,上网查了一下。发现这是
sqlmap的微端。(可以叫做sqlmap在线检测sql注入= =)
0x001准备:
环境:
Ubuntu 16.04
Python3
Python2
用到的库:requests,parform,os
0x002正文:
首先我们来启动sqlmapapi
sqlmapi -s
出现如下图就成功了:

sqlmapapi介绍:
http://127.0.0.1:8775/task/new 创建一个新的任务 GET请求
http://127.0.0.1:8775/scan/id + 要请求的值 并设置header头为(Content-Type:application/json) post请求 (这里的ID就是刚刚new的时候获取到的)
http://127.0.01:8775/scan/id/status 查看状态 GET请求
http://127.0.0.1:8775/scan/id/data 查看扫描结果 如果扫描结果返回空则代表无sql注入,如果返回不是空则有sql注入 GET请求

http://127.0.0.1:8775/task/delete 删除一个ID GET请求
http://127.0.0.1:8775/scan/kalii 杀死一个进程 GET请求
http://127.0.0.1:8775/scan/logo 查看扫描日志
http://127.0.0.1:8775/scan/stop 停止扫描
代码:
import requests
import json
import platform
import os
logo="#sqlmap api制作" \
"#九世制作"
print(logo)
print('[1]Manually open sqlmapapi')
print('[2]Automatically open sqlmapapi')
while True:
start=input("Please choose:")
if start == "":
print('[*]You choose to open sqlmapapi manually')
break
elif start == "":
print('[*]You choose to automatically open sqlmapapi')
os.system('sqlmapapi.py -s')
break
else:
print('[-]There is no choice')
continue while True:
user=input('Please enter the web site you want to scan:')
if user==None:
print('[-]You have nothing to enter')
continue
else:
break vsersion=platform.uname()
for p in vsersion:
print('[*]Your operating system type is:{}'.format(p)) print(' ') def sqlmap(host):
urlnew="http://127.0.0.1:8775/task/new"
urlscan="http://127.0.0.1:8775/scan/"
headers={"user-agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"}
pd=requests.get(url=urlnew,headers=headers)
print('[*]New task')
jsons=pd.json()
print("[*]id:",jsons['taskid'])
print("[*]success:",jsons["success"])
id=jsons['taskid']
scan=urlscan+id+"/start"
print("[*]scanurl:",scan)
data=json.dumps({"url":"{}".format(host)})
headerss={"Content-Type":"application/json"}
scans=requests.post(url=scan,headers=headerss,data=data)
swq=scans.json()
print('--------SCAN-----------')
print('[*]scanid:',swq["engineid"])
print('[*]scansuccess:',swq["success"])
print('--------STATUS---------')
status="http://127.0.0.1:8775/scan/{}/status".format(id)
print(status)
while True:
staw=requests.get(url=status,headers=headers)
if staw.json()['status'] == 'terminated':
datas=requests.get(url='http://127.0.0.1:8775/scan/{}/data'.format(id))
dat=datas.json()['data']
print('[*]data:',dat)
break
elif staw.json()['status'] == 'running':
continue sqlmap(user.strip())
扫描结果:

插入一曲BGM:
python使用sqlmap API检测SQL注入的更多相关文章
- (五)SQLMap工具检测SQL注入漏洞、获取数据库中的数据
目录结构 一.判断被测url的参数是否存在注入点 二.获取数据库系统的所有数据库名称(暴库) 三.获取Web应用当前所连接的数据库 四.获取Web应用当前所操作的DBMS用户 五.列出数据库中的所有用 ...
- 【Pyhon】利用BurpSuite到SQLMap批量测试SQL注入
前言 通过Python脚本把Burp的HTTP请求提取出来交给SQLMap批量测试,提升找大门户网站SQL注入点的效率. 导出Burp的请求包 配置到Burp的代理后浏览门户站点,Burp会将URL纪 ...
- Python预编译语句防止SQL注入
这个月太忙,最近不太太平,我的愿望是世界和平! ================================== 今天也在找python的预编译,早上写的sql是拼接来构成的.于是找了2篇文章,还 ...
- python之MySQL学习——防止SQL注入
python之MySQL学习——防止SQL注入 学习了:https://www.cnblogs.com/xiaomingzaixian/p/7126840.html https://www.cnblo ...
- sqlmap检测sql注入漏洞
sqlmap是一款非常强大的开源sql自动化注入工具,可以用来检测和利用sql注入漏洞.它由python语言开发而成,因此运行需要安装python环境. 官网:http://sqlmap.org/ 乌 ...
- 手工检测SQL注入漏洞
SQL注入,就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,具体来说,它是利用现有应用程序将(恶意的)SQL命令注入到后台数据库引擎执 ...
- python mysql参数化查询防sql注入
一.写法 cursor.execute('insert into user (name,password) value (?,?)',(name,password)) 或者 cursor.execut ...
- day40:python操作mysql:pymysql模块&SQL注入攻击
目录 part1:用python连接mysql 1.用python连接mysql的基本语法 2.用python 创建&删除表 3.用python操作事务处理 part2:sql注入攻击 1.s ...
- 企业安全_检测SQL注入的一些方式探讨
目录 寻找SQL注入点的 way MySQL Inject 入门案例 自动化审计的尝试之旅 人工审计才能保证精度 寻找SQL注入点的 way 在企业中有如下几种方式可以选择: 自动化 - 白盒基于源码 ...
随机推荐
- TCP TIME WAIT
根据TCP协议定义的3次握手断开连接规定,发起socket主动关闭的一方 socket将进入TIME_WAIT状态,TIME_WAIT状态将持续2个MSL(Max Segment Lifetime) ...
- spring:org.springframework.web.servlet.DispatcherServlet noHandlerFound解决方法
1.搜了许久: <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern& ...
- 新盘进行LVM的划分
echo "- - -" > /sys/class/scsi_host/host2/scan LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由 ...
- Day5_协程函数_面向过程
def func(count): while True: yield count count +=1 #这是一个生成器,需要利用next()来执行. func(10) #yield: #1.把函数的执 ...
- ffmpeg 的 tbr tbc 和 tbn的意义
tbn = the time base in AVStream that has come from the container tbc = the time base in AVCodecConte ...
- SDL相关资料
SDL(Simple DirectMedia Layer)是一个自由的跨平台的多媒体开发包,适用于 游戏.游戏SDK.演示软件.模拟器.MPEG播放器和其他应用软件.目前支持windows,linux ...
- Python Django开发中XSS内容过滤问题的解决
from:http://stackoverflow.com/questions/699468/python-html-sanitizer-scrubber-filter 通过下面这个代码就可以把内容过 ...
- linux下安装vld
将vld-0.10.1下载并传到/home/wangxiaolan/tar 1.进行解压 tar zxvf vld-0.10.tgz 2.进入 cd vld-0.10.1 3.usr/local/ph ...
- C++位运算
移位运算 要点 1 它们都是双目运算符,两个运算分量都是整形,结果也是整形. 2 " < <" 左移:右边空出的位上补0,左边的位将从字头挤掉,其值相当于乘2. ...
- Python 30分钟入门指南
Python 30分钟入门指南 为什么 OIer 要学 Python? Python 语言特性简洁明了,使用 Python 写测试数据生成器和对拍器,比编写 C++ 事半功倍. Python 学习成本 ...