removing of unused imports together with some general code refactoring

This commit is contained in:
Miroslav Stampar
2012-02-22 10:40:11 +00:00
parent 386e98a0e3
commit b3bd4144f5
104 changed files with 255 additions and 499 deletions

View File

@@ -12,7 +12,6 @@ import re
from lib.core.common import getCompiledRegex
from lib.core.common import readXmlFile
from lib.core.convert import urldecode
from lib.core.data import conf
from lib.core.data import paths
from lib.core.data import logger

View File

@@ -9,7 +9,6 @@ See the file 'doc/COPYING' for copying permission
import httplib
import re
import threading
import urlparse
import time
@@ -73,16 +72,16 @@ class Crawler:
for tag in soup('a'):
if tag.get("href"):
url = urlparse.urljoin(conf.url, tag.get("href"))
# flag to know if we are dealing with the same target host
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
if conf.scope:
if not re.search(conf.scope, url, re.I):
continue
elif not target:
continue
if url.split('.')[-1].lower() not in CRAWL_EXCLUDE_EXTENSIONS:
kb.locks.outputs.acquire()
threadData.shared.deeper.add(url)

View File

@@ -7,10 +7,8 @@ Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.data import conf
from lib.core.data import logger
from lib.core.enums import DBMS
from lib.core.exception import sqlmapMissingDependence
from lib.core.settings import DBMS_DICT
from lib.core.settings import IS_WIN

View File

@@ -15,7 +15,6 @@ import urllib2
from lib.core.common import getUnicode
from lib.core.common import readInput
from lib.core.convert import htmlunescape
from lib.core.convert import urldecode
from lib.core.convert import urlencode
from lib.core.data import conf
@@ -51,7 +50,7 @@ class Google:
retVal = re.findall(GOOGLE_REGEX, page, re.I | re.S)
return retVal
return retVal
def getTargetUrls(self):
"""
@@ -84,7 +83,7 @@ class Google:
_ = conn.info()
except urllib2.HTTPError, e:
_ = e.info()
except urllib2.URLError, _:
except urllib2.URLError:
errMsg = "unable to connect to Google"
raise sqlmapConnectionException, errMsg
@@ -134,7 +133,7 @@ class Google:
warnMsg += "to get error page information (%d)" % e.code
logger.critical(warnMsg)
return None
except (urllib2.URLError, socket.error, socket.timeout), _:
except (urllib2.URLError, socket.error, socket.timeout):
errMsg = "unable to connect to Google"
raise sqlmapConnectionException, errMsg

View File

@@ -23,14 +23,11 @@ except (ImportError, OSError):
else:
_multiprocessing = multiprocessing
import os
import re
import time
from hashlib import md5
from hashlib import sha1
from Queue import Queue
from zipfile import ZipFile
from extra.pydes.pyDes import des
from extra.pydes.pyDes import CBC
@@ -63,7 +60,6 @@ from lib.core.settings import HASH_MOD_ITEM_DISPLAY
from lib.core.settings import HASH_RECOGNITION_QUIT_THRESHOLD
from lib.core.settings import IS_WIN
from lib.core.settings import ITOA64
from lib.core.settings import PYVERSION
from lib.core.settings import ML
from lib.core.settings import UNICODE_ENCODING
from lib.core.settings import ROTATING_CHARS
@@ -289,14 +285,14 @@ def wordpress_passwd(password, salt, count, prefix, uppercase=False):
return retVal.upper() if uppercase else retVal
__functions__ = {
HASH.MYSQL: mysql_passwd,
HASH.MYSQL: mysql_passwd,
HASH.MYSQL_OLD: mysql_old_passwd,
HASH.POSTGRES: postgres_passwd,
HASH.MSSQL: mssql_passwd,
HASH.MSSQL_OLD: mssql_old_passwd,
HASH.POSTGRES: postgres_passwd,
HASH.MSSQL: mssql_passwd,
HASH.MSSQL_OLD: mssql_old_passwd,
HASH.ORACLE: oracle_passwd,
HASH.ORACLE_OLD: oracle_old_passwd,
HASH.MD5_GENERIC: md5_generic_passwd,
HASH.ORACLE_OLD: oracle_old_passwd,
HASH.MD5_GENERIC: md5_generic_passwd,
HASH.SHA1_GENERIC: sha1_generic_passwd,
HASH.CRYPT_GENERIC: crypt_generic_passwd,
HASH.WORDPRESS: wordpress_passwd

View File

@@ -13,7 +13,6 @@ import threading
from lib.core.common import serializeObject
from lib.core.common import unserializeObject
from lib.core.data import conf
from lib.core.settings import HASHDB_FLUSH_THRESHOLD
from lib.core.settings import UNICODE_ENCODING
from lib.core.threads import getCurrentThreadData

View File

@@ -24,7 +24,6 @@ from lib.core.data import kb
from lib.core.data import logger
from lib.core.data import queries
from lib.core.enums import DBMS
from lib.core.enums import PAYLOAD
from lib.core.unescaper import unescaper
from lib.techniques.blind.inference import bisection