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