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

Skip to content

Commit 6b45199

Browse files
committed
Removing obsolete code
1 parent bb51c0e commit 6b45199

9 files changed

Lines changed: 6 additions & 148 deletions

File tree

lib/core/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,6 @@ def setPaths(rootPath):
13981398
paths.WORDLIST = os.path.join(paths.SQLMAP_TXT_PATH, "wordlist.tx_")
13991399
paths.ERRORS_XML = os.path.join(paths.SQLMAP_XML_PATH, "errors.xml")
14001400
paths.BOUNDARIES_XML = os.path.join(paths.SQLMAP_XML_PATH, "boundaries.xml")
1401-
paths.LIVE_TESTS_XML = os.path.join(paths.SQLMAP_XML_PATH, "livetests.xml")
14021401
paths.QUERIES_XML = os.path.join(paths.SQLMAP_XML_PATH, "queries.xml")
14031402
paths.GENERIC_XML = os.path.join(paths.SQLMAP_XML_BANNER_PATH, "generic.xml")
14041403
paths.MSSQL_XML = os.path.join(paths.SQLMAP_XML_BANNER_PATH, "mssql.xml")

lib/core/option.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@ def _basicOptionValidation():
26022602
errMsg = "value for option '--union-char' must be an alpha-numeric value (e.g. 1)"
26032603
raise SqlmapSyntaxException(errMsg)
26042604

2605-
if conf.hashFile and any((conf.direct, conf.url, conf.logFile, conf.bulkFile, conf.googleDork, conf.configFile, conf.requestFile, conf.updateAll, conf.smokeTest, conf.liveTest, conf.wizard, conf.dependencies, conf.purge, conf.listTampers)):
2605+
if conf.hashFile and any((conf.direct, conf.url, conf.logFile, conf.bulkFile, conf.googleDork, conf.configFile, conf.requestFile, conf.updateAll, conf.smokeTest, conf.wizard, conf.dependencies, conf.purge, conf.listTampers)):
26062606
errMsg = "option '--crack' should be used as a standalone"
26072607
raise SqlmapSyntaxException(errMsg)
26082608

@@ -2669,7 +2669,7 @@ def init():
26692669

26702670
parseTargetDirect()
26712671

2672-
if any((conf.url, conf.logFile, conf.bulkFile, conf.requestFile, conf.googleDork, conf.liveTest)):
2672+
if any((conf.url, conf.logFile, conf.bulkFile, conf.requestFile, conf.googleDork)):
26732673
_setHostname()
26742674
_setHTTPTimeout()
26752675
_setHTTPExtraHeaders()

lib/core/optiondict.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@
252252
"forceDns": "boolean",
253253
"murphyRate": "integer",
254254
"smokeTest": "boolean",
255-
"liveTest": "boolean",
256255
"stopFail": "boolean",
257256
"runCase": "string",
258257
},

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.4.1.4"
21+
VERSION = "1.4.1.5"
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: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -289,130 +289,6 @@ def adjustValueType(tagName, value):
289289
break
290290
return value
291291

292-
def liveTest():
293-
"""
294-
Runs the test of a program against the live testing environment
295-
"""
296-
297-
retVal = True
298-
count = 0
299-
global_ = {}
300-
vars_ = {}
301-
302-
livetests = readXmlFile(paths.LIVE_TESTS_XML)
303-
length = len(livetests.getElementsByTagName("case"))
304-
305-
element = livetests.getElementsByTagName("global")
306-
if element:
307-
for item in element:
308-
for child in item.childNodes:
309-
if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"):
310-
global_[child.tagName] = adjustValueType(child.tagName, child.getAttribute("value"))
311-
312-
element = livetests.getElementsByTagName("vars")
313-
if element:
314-
for item in element:
315-
for child in item.childNodes:
316-
if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"):
317-
var = child.getAttribute("value")
318-
vars_[child.tagName] = randomStr(6) if var == "random" else var
319-
320-
for case in livetests.getElementsByTagName("case"):
321-
parse_from_console_output = False
322-
count += 1
323-
name = None
324-
parse = []
325-
switches = dict(global_)
326-
value = ""
327-
vulnerable = True
328-
result = None
329-
330-
if case.hasAttribute("name"):
331-
name = case.getAttribute("name")
332-
333-
if conf.runCase and ((conf.runCase.isdigit() and conf.runCase != count) or not re.search(conf.runCase, name, re.DOTALL)):
334-
continue
335-
336-
if case.getElementsByTagName("switches"):
337-
for child in case.getElementsByTagName("switches")[0].childNodes:
338-
if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"):
339-
value = replaceVars(child.getAttribute("value"), vars_)
340-
switches[child.tagName] = adjustValueType(child.tagName, value)
341-
342-
if case.getElementsByTagName("parse"):
343-
for item in case.getElementsByTagName("parse")[0].getElementsByTagName("item"):
344-
if item.hasAttribute("value"):
345-
value = replaceVars(item.getAttribute("value"), vars_)
346-
347-
if item.hasAttribute("console_output"):
348-
parse_from_console_output = bool(item.getAttribute("console_output"))
349-
350-
parse.append((value, parse_from_console_output))
351-
352-
conf.verbose = global_.get("verbose", 1)
353-
setVerbosity()
354-
355-
msg = "running live test case: %s (%d/%d)" % (name, count, length)
356-
logger.info(msg)
357-
358-
initCase(switches, count)
359-
360-
test_case_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "test_case"), "wb", UNICODE_ENCODING)
361-
test_case_fd.write("%s\n" % name)
362-
363-
try:
364-
result = runCase(parse)
365-
except SqlmapNotVulnerableException:
366-
vulnerable = False
367-
finally:
368-
conf.verbose = global_.get("verbose", 1)
369-
setVerbosity()
370-
371-
if result is True:
372-
logger.info("test passed")
373-
cleanCase()
374-
else:
375-
errMsg = "test failed"
376-
377-
if _failures.failedItems:
378-
errMsg += " at parsing items: %s" % ", ".join(i for i in _failures.failedItems)
379-
380-
errMsg += " - scan folder: %s" % paths.SQLMAP_OUTPUT_PATH
381-
errMsg += " - traceback: %s" % bool(_failures.failedTraceBack)
382-
383-
if not vulnerable:
384-
errMsg += " - SQL injection not detected"
385-
386-
logger.error(errMsg)
387-
test_case_fd.write("%s\n" % errMsg)
388-
389-
if _failures.failedParseOn:
390-
console_output_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "console_output"), "wb", UNICODE_ENCODING)
391-
console_output_fd.write(_failures.failedParseOn)
392-
console_output_fd.close()
393-
394-
if _failures.failedTraceBack:
395-
traceback_fd = codecs.open(os.path.join(paths.SQLMAP_OUTPUT_PATH, "traceback"), "wb", UNICODE_ENCODING)
396-
traceback_fd.write(_failures.failedTraceBack)
397-
traceback_fd.close()
398-
399-
beep()
400-
401-
if conf.stopFail is True:
402-
return retVal
403-
404-
test_case_fd.close()
405-
retVal &= bool(result)
406-
407-
dataToStdout("\n")
408-
409-
if retVal:
410-
logger.info("live test final result: PASSED")
411-
else:
412-
logger.error("live test final result: FAILED")
413-
414-
return retVal
415-
416292
def initCase(switches, count):
417293
_failures.failedItems = []
418294
_failures.failedParseOn = None

lib/parse/cmdline.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,9 +787,6 @@ def cmdLineParser(argv=None):
787787
parser.add_argument("--smoke-test", dest="smokeTest", action="store_true",
788788
help=SUPPRESS)
789789

790-
parser.add_argument("--live-test", dest="liveTest", action="store_true",
791-
help=SUPPRESS)
792-
793790
parser.add_argument("--vuln-test", dest="vulnTest", action="store_true",
794791
help=SUPPRESS)
795792

@@ -1005,7 +1002,7 @@ def _format_action_invocation(self, action):
10051002
if args.dummy:
10061003
args.url = args.url or DUMMY_URL
10071004

1008-
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.vulnTest, args.liveTest, args.wizard, args.dependencies, args.purge, args.listTampers, args.hashFile)):
1005+
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.vulnTest, args.wizard, args.dependencies, args.purge, args.listTampers, args.hashFile)):
10091006
errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, --list-tampers, --wizard, --update, --purge or --dependencies). "
10101007
errMsg += "Use -h for basic and -hh for advanced help\n"
10111008
parser.error(errMsg)

lib/takeover/metasploit.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,6 @@ def _controlMsfCmd(self, proc, func):
569569
errMsg += "to open a remote session"
570570
raise SqlmapGenericException(errMsg)
571571

572-
if conf.liveTest and timeout:
573-
if initialized:
574-
send_all(proc, "exit\n")
575-
time.sleep(2)
576-
else:
577-
proc.kill()
578-
579572
except select.error as ex:
580573
# Reference: https://github.com/andymccurdy/redis-py/pull/743/commits/2b59b25bb08ea09e98aede1b1f23a270fc085a9f
581574
if ex.args[0] == errno.EINTR:

lib/utils/progress.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,8 @@ def draw(self, eta=None):
9393

9494
dataToStdout("\r%s %d/%d%s" % (self._progBar, self._amount, self._max, (" (ETA %s)" % (self._convertSeconds(int(eta)) if eta is not None else "??:??"))))
9595
if self._amount >= self._max:
96-
if not conf.liveTest:
97-
dataToStdout("\r%s\r" % (" " * self._width))
98-
kb.prependFlag = False
99-
else:
100-
dataToStdout("\n")
96+
dataToStdout("\r%s\r" % (" " * self._width))
97+
kb.prependFlag = False
10198

10299
def __str__(self):
103100
"""

sqlmap.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ def main():
173173
elif conf.vulnTest:
174174
from lib.core.testing import vulnTest
175175
os._exitcode = 1 - (vulnTest() or 0)
176-
elif conf.liveTest:
177-
from lib.core.testing import liveTest
178-
os._exitcode = 1 - (liveTest() or 0)
179176
else:
180177
from lib.controller.controller import start
181178
if conf.profile and six.PY2:

0 commit comments

Comments
 (0)