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

Skip to content

Commit a7cab63

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents dcec56e + aa467cb commit a7cab63

16 files changed

Lines changed: 18 additions & 218 deletions

File tree

lib/core/common.py

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
from lib.core.settings import ISSUES_PAGE
100100
from lib.core.settings import IS_WIN
101101
from lib.core.settings import LARGE_OUTPUT_THRESHOLD
102+
from lib.core.settings import MIN_ENCODED_LEN_CHECK
102103
from lib.core.settings import MIN_TIME_RESPONSES
103104
from lib.core.settings import ML
104105
from lib.core.settings import NULL
@@ -570,7 +571,7 @@ def paramToDict(place, parameters=None):
570571
for encoding in ("hex", "base64"):
571572
try:
572573
decoded = value.decode(encoding)
573-
if all(_ in string.printable for _ in decoded):
574+
if len(decoded) > MIN_ENCODED_LEN_CHECK and all(_ in string.printable for _ in decoded):
574575
warnMsg = "provided parameter '%s' " % parameter
575576
warnMsg += "seems to be '%s' encoded" % encoding
576577
logger.warn(warnMsg)
@@ -768,13 +769,6 @@ def dataToOutFile(filename, data):
768769

769770
return retVal
770771

771-
def strToHex(value):
772-
"""
773-
Converts string value to it's hexadecimal representation
774-
"""
775-
776-
return (value if not isinstance(value, unicode) else value.encode(UNICODE_ENCODING)).encode("hex").upper()
777-
778772
def readInput(message, default=None, checkBatch=True):
779773
"""
780774
Reads input from terminal
@@ -1313,20 +1307,6 @@ def getCharset(charsetType=None):
13131307

13141308
return asciiTbl
13151309

1316-
def searchEnvPath(filename):
1317-
retVal = None
1318-
path = os.environ.get("PATH", "")
1319-
paths = path.split(";") if IS_WIN else path.split(":")
1320-
1321-
for _ in paths:
1322-
_ = _.replace(";", "")
1323-
retVal = os.path.exists(os.path.normpath(os.path.join(_, filename)))
1324-
1325-
if retVal:
1326-
break
1327-
1328-
return retVal
1329-
13301310
def directoryPath(filepath):
13311311
"""
13321312
Returns directory path for a given filepath
@@ -1434,13 +1414,6 @@ def showStaticWords(firstPage, secondPage):
14341414

14351415
logger.info(infoMsg)
14361416

1437-
def isWindowsPath(filepath):
1438-
"""
1439-
Returns True if given filepath is in Windows format
1440-
"""
1441-
1442-
return re.search("\A[\w]\:\\\\", filepath) is not None
1443-
14441417
def isWindowsDriveLetterPath(filepath):
14451418
"""
14461419
Returns True if given filepath starts with a Windows drive letter
@@ -1470,18 +1443,6 @@ def ntToPosixSlashes(filepath):
14701443

14711444
return filepath.replace('\\', '/')
14721445

1473-
def isBase64EncodedString(subject):
1474-
"""
1475-
Checks if the provided string is Base64 encoded
1476-
1477-
>>> isBase64EncodedString('dGVzdA==')
1478-
True
1479-
>>> isBase64EncodedString('123456')
1480-
False
1481-
"""
1482-
1483-
return re.match(r"\A(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z", subject) is not None
1484-
14851446
def isHexEncodedString(subject):
14861447
"""
14871448
Checks if the provided string is hex encoded
@@ -2485,20 +2446,6 @@ def showHttpErrorCodes():
24852446
for code, count in kb.httpErrorCodes.items())
24862447
logger.warn(warnMsg)
24872448

2488-
def getComparePageRatio(firstPage, secondPage, filtered=False):
2489-
"""
2490-
Returns comparison ratio between two given pages
2491-
"""
2492-
2493-
if filtered:
2494-
(firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage))
2495-
2496-
seqMatcher = getCurrentThreadData().seqMatcher
2497-
seqMatcher.set_seq1(firstPage)
2498-
seqMatcher.set_seq2(secondPage)
2499-
2500-
return seqMatcher.quick_ratio()
2501-
25022449
def openFile(filename, mode='r'):
25032450
"""
25042451
Returns file handle of a given filename
@@ -2752,16 +2699,6 @@ def unsafeSQLIdentificatorNaming(name):
27522699

27532700
return retVal
27542701

2755-
def isBinaryData(value):
2756-
"""
2757-
Tests given value for binary content
2758-
"""
2759-
2760-
retVal = False
2761-
if isinstance(value, basestring):
2762-
retVal = reduce(lambda x, y: x or not (y in string.printable or ord(y) > 255), value, False)
2763-
return retVal
2764-
27652702
def isNoneValue(value):
27662703
"""
27672704
Returns whether the value is unusable (None or '')

lib/core/convert.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,6 @@ def hexdecode(value):
4747
def hexencode(value):
4848
return utf8encode(value).encode("hex")
4949

50-
def md5hash(value):
51-
if "hashlib" in sys.modules:
52-
return hashlib.md5(value).hexdigest()
53-
else:
54-
return md5.new(value).hexdigest()
55-
56-
def orddecode(value):
57-
packedString = struct.pack("!" + "I" * len(value), *value)
58-
return "".join(chr(char) for char in struct.unpack("!" + "I" * (len(packedString) / 4), packedString))
59-
60-
def ordencode(value):
61-
return tuple(ord(char) for char in value)
62-
63-
def sha1hash(value):
64-
if "hashlib" in sys.modules:
65-
return hashlib.sha1(value).hexdigest()
66-
else:
67-
return sha.new(value).hexdigest()
68-
6950
def unicodeencode(value, encoding=None):
7051
"""
7152
Return 8-bit string representation of the supplied unicode value:

lib/core/option.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
from lib.request.basic import checkCharEncoding
132132
from lib.request.connect import Connect as Request
133133
from lib.request.dns import DNSServer
134-
from lib.request.proxy import ProxyHTTPSHandler
135134
from lib.request.basicauthhandler import SmartHTTPBasicAuthHandler
136135
from lib.request.certhandler import HTTPSCertAuthHandler
137136
from lib.request.httpshandler import HTTPSHandler
@@ -970,17 +969,7 @@ def _setHTTPProxy():
970969
proxyString = ""
971970

972971
proxyString += "%s:%d" % (hostname, port)
973-
974-
# Workaround for http://bugs.python.org/issue1424152 (urllib/urllib2:
975-
# HTTPS over (Squid) Proxy fails) as long as HTTP over SSL requests
976-
# can't be tunneled over an HTTP proxy natively by Python (<= 2.5)
977-
# urllib2 standard library
978-
if PYVERSION >= "2.6":
979-
proxyHandler = urllib2.ProxyHandler({"http": proxyString, "https": proxyString})
980-
elif conf.scheme == "https":
981-
proxyHandler = ProxyHTTPSHandler(proxyString)
982-
else:
983-
proxyHandler = urllib2.ProxyHandler({"http": proxyString})
972+
proxyHandler = urllib2.ProxyHandler({"http": proxyString, "https": proxyString})
984973

985974
def _setSafeUrl():
986975
"""

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@
506506
# Regular expression used for extracting form tags
507507
FORM_SEARCH_REGEX = r"(?si)<form(?!.+<form).+?</form>"
508508

509+
# Minimum field entry length needed for encoded content (hex, base64,...) check
510+
MIN_ENCODED_LEN_CHECK = 5
511+
509512
# CSS style used in HTML dump format
510513
HTML_DUMP_CSS_STYLE = """<style>
511514
table{

lib/request/proxy.py

Lines changed: 0 additions & 106 deletions
This file was deleted.

plugins/dbms/access/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def connect(self):
4545
except (pyodbc.Error, pyodbc.OperationalError), msg:
4646
raise SqlmapConnectionException(msg[1])
4747

48-
self.setCursor()
48+
self.initCursor()
4949
self.connected()
5050

5151
def fetchall(self):

plugins/dbms/db2/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def connect(self):
3838
raise SqlmapConnectionException(msg)
3939

4040

41-
self.setCursor()
41+
self.initCursor()
4242
self.connected()
4343

4444
def fetchall(self):

plugins/dbms/firebird/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def connect(self):
4343
user=self.user.encode(UNICODE_ENCODING), password=self.password.encode(UNICODE_ENCODING), charset="UTF8") # Reference: http://www.daniweb.com/forums/thread248499.html
4444
except kinterbasdb.OperationalError, msg:
4545
raise SqlmapConnectionException(msg[1])
46-
self.setCursor()
46+
self.initCursor()
4747
self.connected()
4848

4949
def fetchall(self):

plugins/dbms/mssqlserver/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def connect(self):
4444
except pymssql.OperationalError, msg:
4545
raise SqlmapConnectionException(msg)
4646

47-
self.setCursor()
47+
self.initCursor()
4848
self.connected()
4949

5050
def fetchall(self):

plugins/dbms/mysql/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def connect(self):
3939
except (pymysql.OperationalError, pymysql.InternalError), msg:
4040
raise SqlmapConnectionException(msg[1])
4141

42-
self.setCursor()
42+
self.initCursor()
4343
self.connected()
4444

4545
def fetchall(self):

0 commit comments

Comments
 (0)