put the consent cookie in the headers

This commit is contained in:
owein D 2021-04-27 13:56:53 +02:00
parent be5634b031
commit 5c1549b891
2 changed files with 5 additions and 1 deletions

View File

@ -134,6 +134,9 @@ BING_REGEX = r'<h2><a href="([^"]+)" h='
# Dummy user agent for search (if default one returns different results)
DUMMY_SEARCH_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0"
#to update on terms update
SEARCH_COOKIE = "CONSENT=YES+shp.gws-20210419-0-RC1.nl+FX+740"
# Regular expression used for extracting content from "textual" tags
TEXT_TAG_REGEX = r"(?si)<(abbr|acronym|b|blockquote|br|center|cite|code|dt|em|font|h\d|i|li|p|pre|q|strong|sub|sup|td|th|title|tt|u)(?!\w).*?>(?P<result>[^<]+)"

View File

@ -28,6 +28,7 @@ from lib.core.exception import SqlmapUserQuitException
from lib.core.settings import BING_REGEX
from lib.core.settings import DUCKDUCKGO_REGEX
from lib.core.settings import DEFAULT_USER_AGENT
from lib.core.settings import SEARCH_COOKIE
from lib.core.settings import GOOGLE_REGEX
from lib.core.settings import HTTP_ACCEPT_ENCODING_HEADER_VALUE
from lib.core.settings import UNICODE_ENCODING
@ -52,7 +53,7 @@ def _search(dork):
requestHeaders[HTTP_HEADER.USER_AGENT] = DEFAULT_USER_AGENT
requestHeaders[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE
requestHeaders[HTTP_HEADER.COOKIE] = SEARCH_COOKIE
try:
req = _urllib.request.Request("https://www.google.com/ncr", headers=requestHeaders)
conn = _urllib.request.urlopen(req)