more updates

This commit is contained in:
Miroslav Stampar 2010-09-27 13:26:46 +00:00
parent 1da672e3c5
commit 3cd15960a0
2 changed files with 23 additions and 5 deletions

View File

@ -22,6 +22,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
""" """
import codecs import codecs
import doctest
import logging import logging
import os import os
import re import re
@ -41,13 +42,13 @@ from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
from lib.core.option import init from lib.core.option import init
from lib.core.option import __setVerbosity from lib.core.option import __setVerbosity
from lib.core.optiondict import optDict
from lib.parse.cmdline import cmdLineParser from lib.parse.cmdline import cmdLineParser
def smokeTest(): def smokeTest():
""" """
This will run the basic smoke testing of a program This will run the basic smoke testing of a program
""" """
import doctest
retVal = True retVal = True
count, length = 0, 0 count, length = 0, 0
@ -88,6 +89,21 @@ def smokeTest():
return retVal return retVal
def adjustValueType(tagName, value):
for family in optDict.keys():
for name, type_ in optDict[family].items():
if type(type_) == tuple:
type_ = type_[0]
if tagName == name:
if type_ == "boolean":
value = (value == "True")
elif type_ == "integer":
value = int(value)
elif type_ == "float":
value = float(value)
break
return value
def liveTest(): def liveTest():
""" """
This will run the test of a program against the live testing environment This will run the test of a program against the live testing environment
@ -106,7 +122,7 @@ def liveTest():
for item in element: for item in element:
for child in item.childNodes: for child in item.childNodes:
if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"): if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"):
global_[child.tagName] = child.getAttribute("value") global_[child.tagName] = adjustValueType(child.tagName, child.getAttribute("value"))
element = livetests.getElementsByTagName("vars") element = livetests.getElementsByTagName("vars")
if element: if element:
@ -127,7 +143,8 @@ def liveTest():
if case.getElementsByTagName("switches"): if case.getElementsByTagName("switches"):
for child in case.getElementsByTagName("switches")[0].childNodes: for child in case.getElementsByTagName("switches")[0].childNodes:
if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"): if child.nodeType == child.ELEMENT_NODE and child.hasAttribute("value"):
switches[child.tagName] = replaceVars(child.getAttribute("value"), vars_) value = replaceVars(child.getAttribute("value"), vars_)
switches[child.tagName] = adjustValueType(child.tagName, value)
if case.getElementsByTagName("log"): if case.getElementsByTagName("log"):
for item in case.getElementsByTagName("log")[0].getElementsByTagName("item"): for item in case.getElementsByTagName("log")[0].getElementsByTagName("item"):
@ -163,11 +180,11 @@ def initCase(switches=None):
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")
cmdLineOptions = cmdLineParser() cmdLineOptions = cmdLineParser()
cmdLineOptions.liveTest = cmdLineOptions.smokeTest = False cmdLineOptions.liveTest = cmdLineOptions.smokeTest = False
cmdLineOptions.verbose = 0
if switches: if switches:
for key, value in switches.items(): for key, value in switches.items():
conf[key] = value if key in cmdLineOptions.__dict__:
cmdLineOptions.__dict__[key] = value
conf.sessionFile = None conf.sessionFile = None
init(cmdLineOptions) init(cmdLineOptions)

View File

@ -3,6 +3,7 @@
<root> <root>
<global> <global>
<ignoreProxy value="True"/> <ignoreProxy value="True"/>
<verbose value="0"/>
</global> </global>
<vars> <vars>
<host value="172.16.104.130"/> <host value="172.16.104.130"/>