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

Skip to content

Commit fa58a9c

Browse files
committed
update (now URIs like www.site.com/id82 are automatically treated as possible URI injectable)
1 parent 777a19c commit fa58a9c

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/controller/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def start():
196196
if conf.forms:
197197
message = "[#%d] form:\n%s %s" % (hostCount, conf.method or HTTPMETHOD.GET, targetUrl)
198198
else:
199-
message = "url %d:\n%s %s%s" % (hostCount, conf.method or HTTPMETHOD.GET, targetUrl, "(PR: %s)" % get_pagerank(targetUrl) if conf.googleDork else "")
199+
message = "url %d:\n%s %s%s" % (hostCount, conf.method or HTTPMETHOD.GET, targetUrl, " (PR: %s)" % get_pagerank(targetUrl) if conf.googleDork else "")
200200

201201
if conf.cookie:
202202
message += "\nCookie: %s" % conf.cookie

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,6 @@
217217

218218
# Reference: http://www.w3.org/Protocols/HTTP/Object_Headers.html#uri
219219
URI_HTTP_HEADER = "URI"
220+
221+
# Uri format which could be injectable (e.g. www.site.com/id82)
222+
URI_INJECTABLE_REGEX = r".*/([^\.*?]+)\Z"

lib/core/target.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from lib.core.option import __setKnowledgeBaseAttributes
3333
from lib.core.session import resumeConfKb
3434
from lib.core.settings import UNICODE_ENCODING
35+
from lib.core.settings import URI_INJECTABLE_REGEX
3536
from lib.core.xmldump import dumper as xmldumper
3637
from lib.request.connect import Connect as Request
3738

@@ -78,6 +79,9 @@ def __setRequestParams():
7879

7980
conf.method = HTTPMETHOD.POST
8081

82+
if re.search(URI_INJECTABLE_REGEX, conf.url, re.I):
83+
conf.url = "%s*" % conf.url
84+
8185
if "*" in conf.url:
8286
conf.parameters[PLACE.URI] = conf.url
8387
conf.paramDict[PLACE.URI] = {}

lib/utils/google.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from lib.core.exception import sqlmapConnectionException
2323
from lib.core.exception import sqlmapGenericException
2424
from lib.core.settings import UNICODE_ENCODING
25+
from lib.core.settings import URI_INJECTABLE_REGEX
2526
from lib.request.basic import decodePage
2627

2728
class Google:
@@ -59,8 +60,10 @@ def getTargetUrls(self):
5960
"""
6061

6162
for match in self.__matches:
62-
if re.search("(.*?)\?(.+)", match, re.I):
63+
if re.search(r"(.*?)\?(.+)", match, re.I):
6364
kb.targetUrls.add(( htmlunescape(htmlunescape(match)), None, None, None ))
65+
elif re.search(URI_INJECTABLE_REGEX, match, re.I):
66+
kb.targetUrls.add(( htmlunescape(htmlunescape("%s" % match)), None, None, None ))
6467

6568
def getCookie(self):
6669
"""

0 commit comments

Comments
 (0)