From da8ae5578b508b187e5be6c34f5de7bff0c6906f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 22 Sep 2010 11:56:35 +0000 Subject: [PATCH] first commit regarding Feature #144 --- lib/core/agent.py | 2 ++ lib/core/target.py | 6 ++++++ lib/request/connect.py | 11 ++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index e530f75e6..d1ebf46fb 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -99,6 +99,8 @@ class Agent: # Before identifing the injectable parameter elif parameter == "User-Agent": retValue = value.replace(value, newValue) + elif parameter == "URI": + retValue = value.replace('*', newValue) else: paramString = conf.parameters[place] diff --git a/lib/core/target.py b/lib/core/target.py index 8e5abd83b..7866082f8 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -83,6 +83,12 @@ def __setRequestParams(): conf.method = "POST" + if '*' in conf.url: + conf.parameters["URI"] = conf.url + conf.paramDict["URI"] = { "URI": conf.url } # similar as for User-Agent + conf.url = conf.url.replace('*', '') + __testableParameters = True + # Perform checks on Cookie parameters if conf.cookie: conf.parameters["Cookie"] = conf.cookie diff --git a/lib/request/connect.py b/lib/request/connect.py index 3e4708d13..4194bb822 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -293,6 +293,8 @@ class Connect: ua = None page = None pageLength = None + uri = conf.url + raise404 = place != "URI" if not place: place = kb.injPlace @@ -309,6 +311,9 @@ class Connect: if "User-Agent" in conf.parameters: ua = conf.parameters["User-Agent"] if place != "User-Agent" or not value else value + if "URI" in conf.parameters: + uri = conf.url if place != "URI" or not value else value + if conf.safUrl and conf.saFreq > 0: kb.queryCounter += 1 if kb.queryCounter % conf.saFreq == 0: @@ -316,19 +321,19 @@ class Connect: if not content and kb.nullConnection: if kb.nullConnection == "HEAD": - _, headers = Connect.getPage(get=get, post=post, cookie=cookie, ua=ua, silent=silent, method="HEAD", auxHeaders=auxHeaders) + _, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method="HEAD", auxHeaders=auxHeaders, raise404=raise404) pageLength = int(headers['Content-Length']) elif kb.nullConnection == "Range": if not auxHeaders: auxHeaders = {} auxHeaders["Range"] = "bytes=-1" - _, headers = Connect.getPage(get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders) + _, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders, raise404=raise404) pageLength = int(headers['Content-Range'][headers['Content-Range'].find('/') + 1:]) else: kb.nullConnection = None if not pageLength: - page, headers = Connect.getPage(get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders) + page, headers = Connect.getPage(url=uri, get=get, post=post, cookie=cookie, ua=ua, silent=silent, method=method, auxHeaders=auxHeaders, raise404=raise404) if content: return page, headers