mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
SOAP refactoring
This commit is contained in:
parent
c7ff5dcbeb
commit
a7366bf710
|
@ -98,7 +98,7 @@ class Agent:
|
|||
|
||||
newValue = self.cleanupPayload(newValue, origValue)
|
||||
|
||||
if "POSTxml" in conf.paramDict and place == PLACE.POST:
|
||||
if place == PLACE.SOAP:
|
||||
root = ET.XML(paramString)
|
||||
iterator = root.getiterator(parameter)
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ def paramToDict(place, parameters=None):
|
|||
if conf.parameters.has_key(place) and not parameters:
|
||||
parameters = conf.parameters[place]
|
||||
|
||||
if place != "POSTxml":
|
||||
if place != PLACE.SOAP:
|
||||
parameters = parameters.replace(", ", ",")
|
||||
|
||||
if place == PLACE.COOKIE:
|
||||
|
|
|
@ -25,6 +25,7 @@ from extra.safe2bin.safe2bin import safecharencode
|
|||
from extra.safe2bin.safe2bin import safechardecode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.enums import PLACE
|
||||
from lib.core.settings import UNICODE_ENCODING
|
||||
from lib.core.settings import URLENCODE_CHAR_LIMIT
|
||||
from lib.core.settings import URLENCODE_FAILSAFE_CHARS
|
||||
|
@ -89,7 +90,7 @@ def urldecode(value, encoding=None):
|
|||
return result
|
||||
|
||||
def urlencode(value, safe="%&=", convall=False, limit=False):
|
||||
if conf.direct or "POSTxml" in conf.paramDict:
|
||||
if conf.direct or PLACE.SOAP in conf.paramDict:
|
||||
return value
|
||||
|
||||
count = 0
|
||||
|
|
|
@ -38,6 +38,7 @@ class DBMS:
|
|||
class PLACE:
|
||||
GET = "GET"
|
||||
POST = "POST"
|
||||
SOAP = "SOAP"
|
||||
URI = "URI"
|
||||
COOKIE = "Cookie"
|
||||
UA = "User-Agent"
|
||||
|
|
|
@ -68,17 +68,18 @@ def __setRequestParams():
|
|||
|
||||
if conf.data:
|
||||
conf.data = conf.data.replace("\n", " ")
|
||||
conf.parameters[PLACE.POST] = conf.data
|
||||
|
||||
# Check if POST data is in xml syntax
|
||||
if re.match("[\n]*<(\?xml |soap\:|ns).*>", conf.data):
|
||||
conf.paramDict["POSTxml"] = True
|
||||
__paramDict = paramToDict("POSTxml", conf.data)
|
||||
place = PLACE.SOAP
|
||||
else:
|
||||
__paramDict = paramToDict(PLACE.POST, conf.data)
|
||||
place = PLACE.POST
|
||||
|
||||
conf.parameters[place] = conf.data
|
||||
__paramDict = paramToDict(place, conf.data)
|
||||
|
||||
if __paramDict:
|
||||
conf.paramDict[PLACE.POST] = __paramDict
|
||||
conf.paramDict[place] = __paramDict
|
||||
__testableParameters = True
|
||||
|
||||
conf.method = HTTPMETHOD.POST
|
||||
|
|
|
@ -149,9 +149,11 @@ class Connect:
|
|||
url = "%s?%s" % (url, get)
|
||||
requestMsg += "?%s" % get
|
||||
|
||||
if conf.method == HTTPMETHOD.POST:
|
||||
if conf.parameters.has_key(PLACE.POST) and not post:
|
||||
post = conf.parameters[PLACE.POST]
|
||||
if conf.method == HTTPMETHOD.POST and not post:
|
||||
for place in (PLACE.POST, PLACE.SOAP):
|
||||
if conf.parameters.has_key(place):
|
||||
post = conf.parameters[place]
|
||||
break
|
||||
|
||||
requestMsg += " %s" % httplib.HTTPConnection._http_vsn_str
|
||||
|
||||
|
@ -466,6 +468,9 @@ class Connect:
|
|||
if PLACE.POST in conf.parameters:
|
||||
post = urlencode(conf.parameters[PLACE.POST] if place != PLACE.POST or not value else value)
|
||||
|
||||
if PLACE.SOAP in conf.parameters:
|
||||
post = conf.parameters[PLACE.SOAP] if place != PLACE.SOAP or not value else value
|
||||
|
||||
if PLACE.COOKIE in conf.parameters:
|
||||
cookie = conf.parameters[PLACE.COOKIE] if place != PLACE.COOKIE or not value else value
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user