Removal of leftovers

This commit is contained in:
Miroslav Stampar 2012-12-06 14:15:44 +01:00
parent 974407396e
commit 1028afce37

View File

@ -9,7 +9,6 @@ import doctest
import os
import re
import shutil
import string
import sys
import tempfile
import time
@ -46,36 +45,13 @@ def smokeTest():
continue
for ifile in files:
if os.path.splitext(ifile)[1].lower() == ".py":
content = None
with open(os.path.join(root, ifile), "r+b") as f:
content = f.read()
active = content
active = re.sub(r"(?s)\"\"\".+?\"\"\"", "", active)
active = re.sub(r"\".+?\"", "", active)
active = re.sub(r"\'.+?\'", "", active)
active = re.sub(r"#.+", "", active)
for ss in re.findall(r"\b_*?[a-z]+[A-Z].*?\b", active):
original = ss
if ss.startswith("sqlmap") and any(_ in ss.lower() for _ in ("exception", "sqlmapmissing", "sqlmapundefinedmethod")):
ss = "S" + ss[1:]
if ss.startswith("_"):
ss = "_" + ss.lstrip("_")
content = content.replace(original, ss)
if content:
with open(os.path.join(root, ifile), "w+b") as f:
f.write(content)
if os.path.splitext(ifile)[1].lower() == ".py" and ifile != "__init__.py":
path = os.path.join(root, os.path.splitext(ifile)[0])
path = path.replace(paths.SQLMAP_ROOT_PATH, '.')
path = path.replace(os.sep, '.').lstrip('.')
try:
__import__(path)
module = sys.modules[path]
#for name in dir(module):
#_ = getattr(module, name)
#if type(_) == type(lambda x: x):
#if re.match(r"\b_*?[a-z]+[A-Z]", name):
#print name
except Exception, msg:
retVal = False
dataToStdout("\r")
@ -90,7 +66,7 @@ def smokeTest():
count += 1
status = '%d/%d (%d%s) ' % (count, length, round(100.0*count/length), '%')
#dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
clearConsoleLine()
if retVal:
@ -235,4 +211,4 @@ def replaceVars(item, vars_):
for var in re.findall("\$\{([^}]+)\}", item):
if var in vars_:
retVal = retVal.replace("${%s}" % var, vars_[var])
return retVal
return retVal