Fix several DeprecationWarning: invalid escape sequence

Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
This commit is contained in:
Mickaël Schoentgen 2019-01-22 20:01:18 +01:00
parent bdc4457f34
commit fb7f2bb1b6
4 changed files with 7 additions and 7 deletions

View File

@ -1592,7 +1592,7 @@ def checkConnection(suppressOutput=False):
conf.url = re.sub(r"https?://", "https://", conf.url) conf.url = re.sub(r"https?://", "https://", conf.url)
match = re.search(r":(\d+)", threadData.lastRedirectURL[1]) match = re.search(r":(\d+)", threadData.lastRedirectURL[1])
port = match.group(1) if match else 443 port = match.group(1) if match else 443
conf.url = re.sub(r":\d+(/|\Z)", ":%s\g<1>" % port, conf.url) conf.url = re.sub(r":\d+(/|\Z)", r":%s\g<1>" % port, conf.url)
except SqlmapConnectionException as ex: except SqlmapConnectionException as ex:
if conf.ipv6: if conf.ipv6:

View File

@ -1551,7 +1551,7 @@ def expandAsteriskForColumns(expression):
if expression != conf.query: if expression != conf.query:
conf.db = db conf.db = db
else: else:
expression = re.sub(r"([^\w])%s" % re.escape(conf.tbl), "\g<1>%s.%s" % (conf.db, conf.tbl), expression) expression = re.sub(r"([^\w])%s" % re.escape(conf.tbl), r"\g<1>%s.%s" % (conf.db, conf.tbl), expression)
else: else:
conf.db = db conf.db = db
@ -1950,18 +1950,18 @@ def isWindowsDriveLetterPath(filepath):
return re.search(r"\A[\w]\:", filepath) is not None return re.search(r"\A[\w]\:", filepath) is not None
def posixToNtSlashes(filepath): def posixToNtSlashes(filepath):
""" r"""
Replaces all occurrences of Posix slashes (/) in provided Replaces all occurrences of Posix slashes (/) in provided
filepath with NT ones (\) filepath with NT ones (\)
>>> posixToNtSlashes('C:/Windows') >>> posixToNtSlashes('C:/Windows')
'C:\\\\Windows' 'C:\\Windows'
""" """
return filepath.replace('/', '\\') if filepath else filepath return filepath.replace('/', '\\') if filepath else filepath
def ntToPosixSlashes(filepath): def ntToPosixSlashes(filepath):
""" r"""
Replaces all occurrences of NT slashes (\) in provided Replaces all occurrences of NT slashes (\) in provided
filepath with Posix ones (/) filepath with Posix ones (/)

View File

@ -323,7 +323,7 @@ def replaceVars(item, vars_):
retVal = item retVal = item
if item and vars_: if item and vars_:
for var in re.findall("\$\{([^}]+)\}", item): for var in re.findall(r"\$\{([^}]+)\}", item):
if var in vars_: if var in vars_:
retVal = retVal.replace("${%s}" % var, vars_[var]) retVal = retVal.replace("${%s}" % var, vars_[var])

View File

@ -734,7 +734,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
DataStore.password = password DataStore.password = password
dbgMsg = "Example client access from command line:" dbgMsg = "Example client access from command line:"
dbgMsg += "\n\t$ taskid=$(curl http://%s:%d/task/new 2>1 | grep -o -I '[a-f0-9]\{16\}') && echo $taskid" % (host, port) dbgMsg += r"\n\t$ taskid=$(curl http://%s:%d/task/new 2>1 | grep -o -I '[a-f0-9]\{16\}') && echo $taskid" % (host, port)
dbgMsg += "\n\t$ curl -H \"Content-Type: application/json\" -X POST -d '{\"url\": \"http://testphp.vulnweb.com/artists.php?artist=1\"}' http://%s:%d/scan/$taskid/start" % (host, port) dbgMsg += "\n\t$ curl -H \"Content-Type: application/json\" -X POST -d '{\"url\": \"http://testphp.vulnweb.com/artists.php?artist=1\"}' http://%s:%d/scan/$taskid/start" % (host, port)
dbgMsg += "\n\t$ curl http://%s:%d/scan/$taskid/data" % (host, port) dbgMsg += "\n\t$ curl http://%s:%d/scan/$taskid/data" % (host, port)
dbgMsg += "\n\t$ curl http://%s:%d/scan/$taskid/log" % (host, port) dbgMsg += "\n\t$ curl http://%s:%d/scan/$taskid/log" % (host, port)