mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
some doc test samples included
This commit is contained in:
parent
4edf6ebe00
commit
2cd8f31003
|
@ -1106,15 +1106,41 @@ def isWindowsDriveLetterPath(filepath):
|
||||||
return re.search("\A[\w]\:", filepath) is not None
|
return re.search("\A[\w]\:", filepath) is not None
|
||||||
|
|
||||||
def posixToNtSlashes(filepath):
|
def posixToNtSlashes(filepath):
|
||||||
|
"""
|
||||||
|
Replaces all occurances of Posix slashes (/) in provided
|
||||||
|
filepath with NT ones (/)
|
||||||
|
>>> posixToNtSlashes('C:/Windows')
|
||||||
|
'C:\\\\Windows'
|
||||||
|
"""
|
||||||
return filepath.replace('/', '\\')
|
return filepath.replace('/', '\\')
|
||||||
|
|
||||||
def ntToPosixSlashes(filepath):
|
def ntToPosixSlashes(filepath):
|
||||||
|
"""
|
||||||
|
Replaces all occurances of NT slashes (\) in provided
|
||||||
|
filepath with Posix ones (/)
|
||||||
|
>>> ntToPosixSlashes('C:\\Windows')
|
||||||
|
'C:/Windows'
|
||||||
|
"""
|
||||||
return filepath.replace('\\', '/')
|
return filepath.replace('\\', '/')
|
||||||
|
|
||||||
def isBase64EncodedString(subject):
|
def isBase64EncodedString(subject):
|
||||||
|
"""
|
||||||
|
Checks if the provided string is Base64 encoded
|
||||||
|
>>> isBase64EncodedString('dGVzdA==')
|
||||||
|
True
|
||||||
|
>>> isBase64EncodedString('123456')
|
||||||
|
False
|
||||||
|
"""
|
||||||
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
|
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
|
||||||
|
|
||||||
def isHexEncodedString(subject):
|
def isHexEncodedString(subject):
|
||||||
|
"""
|
||||||
|
Checks if the provided string is hex encoded
|
||||||
|
>>> isHexEncodedString('DEADBEEF')
|
||||||
|
True
|
||||||
|
>>> isHexEncodedString('test')
|
||||||
|
False
|
||||||
|
"""
|
||||||
return re.match(r"\A[0-9a-fA-F]+\Z", subject) is not None
|
return re.match(r"\A[0-9a-fA-F]+\Z", subject) is not None
|
||||||
|
|
||||||
def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
|
def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
|
||||||
|
@ -1217,6 +1243,10 @@ def parseXmlFile(xmlFile, handler):
|
||||||
xfile.close()
|
xfile.close()
|
||||||
|
|
||||||
def calculateDeltaSeconds(start, epsilon=0.05):
|
def calculateDeltaSeconds(start, epsilon=0.05):
|
||||||
|
"""
|
||||||
|
Returns elapsed time from start till now (including expected
|
||||||
|
error set by epsilon parameter)
|
||||||
|
"""
|
||||||
return int(time.time() - start + epsilon)
|
return int(time.time() - start + epsilon)
|
||||||
|
|
||||||
def initCommonOutputs():
|
def initCommonOutputs():
|
||||||
|
@ -1316,6 +1346,8 @@ def getCompiledRegex(regex, *args):
|
||||||
"""
|
"""
|
||||||
Returns compiled regular expression and stores it in cache for further
|
Returns compiled regular expression and stores it in cache for further
|
||||||
usage
|
usage
|
||||||
|
>>> getCompiledRegex('test') # doctest: +ELLIPSIS
|
||||||
|
<_sre.SRE_Pattern object at...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if (regex, args) in kb.cache.regex:
|
if (regex, args) in kb.cache.regex:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user