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

Skip to content

Commit 7e28c02

Browse files
committed
Minor improvements
1 parent aa9ff9e commit 7e28c02

6 files changed

Lines changed: 19 additions & 7 deletions

File tree

extra/vulnserver/vulnserver.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ def do_REQUEST(self):
124124
self.url, self.params = path, params
125125

126126
if self.url == '/':
127+
self.send_response(OK)
128+
127129
if "id" not in params:
128-
self.send_response(FOUND)
130+
self.send_header("Content-type", "text/html")
129131
self.send_header("Connection", "close")
130-
self.send_header("Location", "/?id=1")
131132
self.end_headers()
133+
self.wfile.write(b"<html><p><h3>GET:</h3><a href='/?id=1'>link</a></p><hr><p><h3>POST:</h3><form method='post'>ID: <input type='text' name='id'><input type='submit' value='Submit'></form></p></html>")
132134
else:
133-
self.send_response(OK)
134135
self.send_header("Content-type", "text/html")
135136
self.send_header("Connection", "close")
136137

lib/controller/controller.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from lib.core.common import parseTargetUrl
3737
from lib.core.common import popValue
3838
from lib.core.common import pushValue
39+
from lib.core.common import randomInt
3940
from lib.core.common import randomStr
4041
from lib.core.common import readInput
4142
from lib.core.common import removePostHintPrefix
@@ -203,10 +204,11 @@ def _randomFillBlankFields(value):
203204
for match in re.finditer(EMPTY_FORM_FIELDS_REGEX, retVal):
204205
item = match.group("result")
205206
if not any(_ in item for _ in IGNORE_PARAMETERS) and not re.search(ASP_NET_CONTROL_REGEX, item):
207+
newValue = randomStr() if not re.search(r"^id|id$", item, re.I) else randomInt()
206208
if item[-1] == DEFAULT_GET_POST_DELIMITER:
207-
retVal = retVal.replace(item, "%s%s%s" % (item[:-1], randomStr(), DEFAULT_GET_POST_DELIMITER))
209+
retVal = retVal.replace(item, "%s%s%s" % (item[:-1], newValue, DEFAULT_GET_POST_DELIMITER))
208210
else:
209-
retVal = retVal.replace(item, "%s%s" % (item, randomStr()))
211+
retVal = retVal.replace(item, "%s%s" % (item, newValue))
210212

211213
return retVal
212214

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4909,7 +4909,7 @@ def prioritySortColumns(columns):
49094909
"""
49104910

49114911
def _(column):
4912-
return column and "id" in column.lower()
4912+
return column and re.search(r"^id|id$", column, re.I) is not None
49134913

49144914
return sorted(sorted(columns, key=len), key=functools.cmp_to_key(lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0))
49154915

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.11.49"
21+
VERSION = "1.3.11.50"
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/core/testing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def vulnTest():
6464

6565
TESTS = (
6666
("--flush-session", ("CloudFlare",)),
67+
("--flush-session --forms --crawl=2 --banner", ("total of 2 targets", "might be injectable", "Type: UNION query", "banner: '3")),
6768
("--flush-session --data='{\"id\": 1}' --banner", ("might be injectable", "Payload: {\"id\"", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3")),
6869
("--flush-session --data='<root><param name=\"id\" value=\"1*\"/></root>' --mobile --banner --smart", ("might be injectable", "Payload: <root><param name=\"id\" value=\"1", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3")),
6970
("--flush-session --method=PUT --data='a=1&b=2&c=3&id=1' --skip-static --dump -T users --start=1 --stop=2", ("might be injectable", "Parameter: id (PUT)", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "2 entries")),

lib/utils/crawler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ def crawlThread():
136136
threadData.shared.deeper = set()
137137
threadData.shared.unprocessed = set([target])
138138

139+
_ = re.sub(r"(?<!/)/(?!/).*", "", target)
140+
if _:
141+
if target.strip('/') != _.strip('/'):
142+
threadData.shared.unprocessed.add(_)
143+
144+
if re.search(r"\?.*\b\w+=", target):
145+
threadData.shared.value.add(target)
146+
139147
if kb.checkSitemap is None:
140148
message = "do you want to check for the existence of "
141149
message += "site's sitemap(.xml) [y/N] "

0 commit comments

Comments
 (0)