5757from lib .core .data import temp
5858from lib .core .convert import urlencode
5959from lib .core .exception import sqlmapFilePathException
60+ from lib .core .exception import sqlmapGenericException
6061from lib .core .exception import sqlmapNoneDataException
6162from lib .core .exception import sqlmapMissingDependence
6263from lib .core .exception import sqlmapSyntaxException
@@ -471,7 +472,7 @@ def readInput(message, default=None):
471472
472473 data = default
473474 else :
474- data = raw_input (message .encode (conf . dataEncoding ))
475+ data = raw_input (message .encode (sys . stdout . encoding ))
475476
476477 if not data :
477478 data = default
@@ -1410,3 +1411,18 @@ def longestCommonPrefix(*sequences):
14101411
14111412def commonFinderOnly (initial , sequence ):
14121413 return longestCommonPrefix (* filter (lambda x : x .startswith (initial ), sequence ))
1414+
1415+ def smokeTest ():
1416+ for root , _ , files in os .walk (paths .SQLMAP_ROOT_PATH ):
1417+ for file in files :
1418+ if os .path .splitext (file )[1 ].lower () == '.py' and file != '__init__.py' :
1419+ path = os .path .join (root , os .path .splitext (file )[0 ])
1420+ path = path .replace (paths .SQLMAP_ROOT_PATH , '.' )
1421+ path = path .replace (os .sep , '.' ).lstrip ('.' )
1422+ try :
1423+ module = __import__ (path )
1424+ except Exception , msg :
1425+ raise sqlmapGenericException , "smoke test failed at importing module '%s' (%s):\n \n %s" % (path , os .path .join (paths .SQLMAP_ROOT_PATH , file ), msg )
1426+
1427+ infoMsg = "smoke test passed"
1428+ logger .info (infoMsg )
0 commit comments