Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5063fc

Browse files
committed
Implementation for #3859
1 parent 093b36f commit b5063fc

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

lib/core/option.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,9 @@ def _setHTTPExtraHeaders():
13021302

13031303
if header and value:
13041304
conf.httpHeaders.append((header, value))
1305+
elif headerValue.startswith('@'):
1306+
checkFile(headerValue[1:])
1307+
kb.headersFile = headerValue[1:]
13051308
else:
13061309
errMsg = "invalid header value: %s. Valid header format is 'name:value'" % repr(headerValue).lstrip('u')
13071310
raise SqlmapSyntaxException(errMsg)
@@ -1905,6 +1908,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
19051908
kb.forceWhere = None
19061909
kb.futileUnion = None
19071910
kb.heavilyDynamic = False
1911+
kb.headersFile = None
19081912
kb.headersFp = {}
19091913
kb.heuristicDbms = None
19101914
kb.heuristicExtendedDbms = None

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.8.0"
21+
VERSION = "1.3.8.1"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/connect.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class WebSocketException(Exception):
4242
from lib.core.common import getSafeExString
4343
from lib.core.common import isMultiThreadMode
4444
from lib.core.common import logHTTPTraffic
45+
from lib.core.common import openFile
4546
from lib.core.common import popValue
4647
from lib.core.common import pushValue
4748
from lib.core.common import randomizeParameterValue
@@ -60,6 +61,7 @@ class WebSocketException(Exception):
6061
from lib.core.compat import patchHeaders
6162
from lib.core.compat import xrange
6263
from lib.core.convert import getBytes
64+
from lib.core.convert import getText
6365
from lib.core.convert import getUnicode
6466
from lib.core.data import conf
6567
from lib.core.data import kb
@@ -426,6 +428,14 @@ def getPage(**kwargs):
426428
if auxHeaders:
427429
headers = forgeHeaders(auxHeaders, headers)
428430

431+
if kb.headersFile:
432+
content = openFile(kb.headersFile, "rb").read()
433+
for line in content.split("\n"):
434+
line = getText(line.strip())
435+
if ':' in line:
436+
header, value = line.split(':', 1)
437+
headers[header] = value
438+
429439
for key, value in list(headers.items()):
430440
del headers[key]
431441
if isinstance(value, six.string_types):

0 commit comments

Comments
 (0)