Adding support for Bing (as a fallback)

This commit is contained in:
Miroslav Stampar 2017-10-09 14:25:08 +02:00
parent 8c88a095fb
commit 1f5f2aff0b
3 changed files with 13 additions and 5 deletions

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.1.10.2" VERSION = "1.1.10.3"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@ -100,6 +100,9 @@ GOOGLE_REGEX = r"webcache\.googleusercontent\.com/search\?q=cache:[^:]+:([^+]+)\
# Regular expression used for extracting results from DuckDuckGo search # Regular expression used for extracting results from DuckDuckGo search
DUCKDUCKGO_REGEX = r'"u":"([^"]+)' DUCKDUCKGO_REGEX = r'"u":"([^"]+)'
# Regular expression used for extracting results from Bing search
BING_REGEX = r'<h2><a href="([^"]+)" h='
# Dummy user agent for search (if default one returns different results) # Dummy user agent for search (if default one returns different results)
DUMMY_SEARCH_USER_AGENT = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0" DUMMY_SEARCH_USER_AGENT = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0"

View File

@ -26,6 +26,7 @@ from lib.core.enums import REDIRECTION
from lib.core.exception import SqlmapBaseException from lib.core.exception import SqlmapBaseException
from lib.core.exception import SqlmapConnectionException from lib.core.exception import SqlmapConnectionException
from lib.core.exception import SqlmapUserQuitException from lib.core.exception import SqlmapUserQuitException
from lib.core.settings import BING_REGEX
from lib.core.settings import DUMMY_SEARCH_USER_AGENT from lib.core.settings import DUMMY_SEARCH_USER_AGENT
from lib.core.settings import DUCKDUCKGO_REGEX from lib.core.settings import DUCKDUCKGO_REGEX
from lib.core.settings import GOOGLE_REGEX from lib.core.settings import GOOGLE_REGEX
@ -108,11 +109,15 @@ def _search(dork):
if not retVal: if not retVal:
message = "no usable links found. What do you want to do?" message = "no usable links found. What do you want to do?"
message += "\n[1] (re)try with DuckDuckGo (default)" message += "\n[1] (re)try with DuckDuckGo (default)"
message += "\n[2] quit" message += "\n[2] (re)try with Bing"
message += "\n[3] quit"
choice = readInput(message, default='1') choice = readInput(message, default='1')
if choice == '2': if choice == '3':
raise SqlmapUserQuitException raise SqlmapUserQuitException
elif choice == '2':
url = "https://www.bing.com/search?q=%s&first=%d" % (urlencode(dork, convall=True), (gpage - 1) * 10 + 1)
regex = BING_REGEX
elif choice == '1': elif choice == '1':
url = "https://duckduckgo.com/d.js?" url = "https://duckduckgo.com/d.js?"
url += "q=%s&p=%d&s=100" % (urlencode(dork, convall=True), gpage) url += "q=%s&p=%d&s=100" % (urlencode(dork, convall=True), gpage)

View File

@ -46,7 +46,7 @@ e8e9fd4f224ead0caa1569312b5b2582 lib/core/optiondict.py
d8e9250f3775119df07e9070eddccd16 lib/core/replication.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py
785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py
40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py
6161dfdfa4899bc9fe4b0ca10af24382 lib/core/settings.py a6352bdfb488eb5323ca9debe1dab8c2 lib/core/settings.py
d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py
2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py
effc153067a00bd43461bfc1cdec1122 lib/core/target.py effc153067a00bd43461bfc1cdec1122 lib/core/target.py
@ -111,7 +111,7 @@ e76a08237ee6a4cd6855af79610ea8a5 lib/utils/htmlentities.py
9d8c858417d356e49e1959ba253aede4 lib/utils/pivotdumptable.py 9d8c858417d356e49e1959ba253aede4 lib/utils/pivotdumptable.py
8520a745c9b4db3814fe46f4c34c6fbc lib/utils/progress.py 8520a745c9b4db3814fe46f4c34c6fbc lib/utils/progress.py
2c3638d499f3c01c34187e531f77d004 lib/utils/purge.py 2c3638d499f3c01c34187e531f77d004 lib/utils/purge.py
7610a89573b32291a4bea66d4ee10a5c lib/utils/search.py 3857f14dd3809a5091ea9262135af103 lib/utils/search.py
fe2be081f924abf08767ed89ab12b418 lib/utils/sqlalchemy.py fe2be081f924abf08767ed89ab12b418 lib/utils/sqlalchemy.py
caeea96ec9c9d489f615f282259b32ca lib/utils/timeout.py caeea96ec9c9d489f615f282259b32ca lib/utils/timeout.py
6fa36b9742293756b226cddee11b7d52 lib/utils/versioncheck.py 6fa36b9742293756b226cddee11b7d52 lib/utils/versioncheck.py