Skip to content

Commit

Permalink
Implementation for sqlmapproject#3859
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Aug 2, 2019
1 parent 093b36f commit b5063fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/core/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,9 @@ def _setHTTPExtraHeaders():

if header and value:
conf.httpHeaders.append((header, value))
elif headerValue.startswith('@'):
checkFile(headerValue[1:])
kb.headersFile = headerValue[1:]
else:
errMsg = "invalid header value: %s. Valid header format is 'name:value'" % repr(headerValue).lstrip('u')
raise SqlmapSyntaxException(errMsg)
Expand Down Expand Up @@ -1905,6 +1908,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.forceWhere = None
kb.futileUnion = None
kb.heavilyDynamic = False
kb.headersFile = None
kb.headersFp = {}
kb.heuristicDbms = None
kb.heuristicExtendedDbms = None
Expand Down
2 changes: 1 addition & 1 deletion lib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from thirdparty.six import unichr as _unichr

# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.8.0"
VERSION = "1.3.8.1"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
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)
Expand Down
10 changes: 10 additions & 0 deletions lib/request/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class WebSocketException(Exception):
from lib.core.common import getSafeExString
from lib.core.common import isMultiThreadMode
from lib.core.common import logHTTPTraffic
from lib.core.common import openFile
from lib.core.common import popValue
from lib.core.common import pushValue
from lib.core.common import randomizeParameterValue
Expand All @@ -60,6 +61,7 @@ class WebSocketException(Exception):
from lib.core.compat import patchHeaders
from lib.core.compat import xrange
from lib.core.convert import getBytes
from lib.core.convert import getText
from lib.core.convert import getUnicode
from lib.core.data import conf
from lib.core.data import kb
Expand Down Expand Up @@ -426,6 +428,14 @@ def getPage(**kwargs):
if auxHeaders:
headers = forgeHeaders(auxHeaders, headers)

if kb.headersFile:
content = openFile(kb.headersFile, "rb").read()
for line in content.split("\n"):
line = getText(line.strip())
if ':' in line:
header, value = line.split(':', 1)
headers[header] = value

for key, value in list(headers.items()):
del headers[key]
if isinstance(value, six.string_types):
Expand Down

0 comments on commit b5063fc

Please sign in to comment.