Compare commits

..
87 Commits
Author SHA1 Message Date
Miroslav Stampar bd74a201d5 Update regarding #3466 2019-02-04 15:49:13 +01:00
Miroslav Stampar 82aa481e06 Patch for IPv6 addresses (proper Host header) 2019-01-30 01:30:30 +01:00
Miroslav Stampar 1f375e418a Fixing unhandled exception message and removing sticky level logic 2019-01-30 00:45:38 +01:00
Miroslav Stampar ed26dc0235 Important patch for #3459 2019-01-29 23:44:58 +01:00
Miroslav Stampar e8f505b701 First memory leak patched (related to the #3459) 2019-01-29 17:40:06 +01:00
Miroslav Stampar dddff45adb Patch for --update progress 2019-01-29 14:59:31 +01:00
Miroslav Stampar b3777995b2 Minor patch for progress dots 2019-01-29 14:55:38 +01:00
Miroslav Stampar a52328bfba Adding new WAF script (Bekchy) 2019-01-29 14:29:58 +01:00
Miroslav Stampar a303d6712e Patch related to the #3455 2019-01-29 12:30:51 +01:00
Miroslav Stampar e01a7908aa Trivial renaming update 2019-01-26 12:36:03 +01:00
Miroslav Stampar 4b5457903a Minor update 2019-01-24 11:36:48 +01:00
Richard Fontana 78da395506 Add GPL Cooperation Commitment (#3445) 2019-01-24 11:07:13 +01:00
Miroslav Stampar 44a8242d2f Dummy commit to force md5-resum 2019-01-23 21:07:51 +01:00
neargle 66e2fc302c Add MySQL sys Schema in MYSQL_SYSTEM_DBS (#3443) 2019-01-23 20:58:53 +01:00
Miroslav Stampar bdc4457f34 Old exception handling format to new one 2019-01-22 14:09:13 +01:00
Miroslav Stampar ba356baab0 Minor stability patch for multi-threading console output (#3284) 2019-01-22 13:45:16 +01:00
Miroslav Stampar ae6235ce20 Fixes #3440 2019-01-22 13:06:13 +01:00
Miroslav Stampar ef8530af5b Fixing mess with template payloads and URI/JSON/XML/custom cases 2019-01-22 11:08:57 +01:00
Miroslav Stampar 3d88dc0a51 Fixes #3439 2019-01-22 10:12:17 +01:00
Miroslav Stampar a31ac0376d Minor refactoring related to last couple of commits 2019-01-22 03:14:23 +01:00
Miroslav Stampar 8f13bda035 Some more preparing for 2to3 (keys() is iter in 3) 2019-01-22 03:00:44 +01:00
Miroslav Stampar 1adc66b763 Dealing with deprecated next() 2019-01-22 02:47:06 +01:00
Miroslav Stampar 2c270ed250 One more 2to3 baby step 2019-01-22 02:29:52 +01:00
Miroslav Stampar 7074365f8e More refactoring like the last couple of commits 2019-01-22 02:08:02 +01:00
Miroslav Stampar fd705c3dff Baby steps 2019-01-22 01:28:24 +01:00
Miroslav Stampar db3bed3f44 Update related to the last commit 2019-01-22 01:20:27 +01:00
Miroslav Stampar 7672b9a0a2 Baby steps (2 to 3 at a time) 2019-01-22 00:40:48 +01:00
Miroslav Stampar 17b79cd21b Minor cleanup 2019-01-20 16:49:14 +01:00
Miroslav Stampar 36b69bbe79 More cleaning up 2019-01-20 15:34:30 +01:00
Miroslav Stampar daa915a6f2 Removing unusable WAF script 2019-01-20 15:26:57 +01:00
Miroslav Stampar 01dba5c505 Removing obsolete WAF 2019-01-20 15:13:43 +01:00
Miroslav Stampar b5db4dc15a Trivial update (comment) 2019-01-18 14:31:37 +01:00
Miroslav Stampar 915d2bdec0 Minor patch related to the 3438 2019-01-17 15:12:31 +01:00
Miroslav Stampar 7eb45b9d8f Patch related to the #3438 2019-01-17 15:06:00 +01:00
Miroslav Stampar 669afdd81b Adding new waf script 2019-01-16 14:38:50 +01:00
Miroslav Stampar 21ce71bee8 Removing junk 2019-01-16 10:32:56 +01:00
Miroslav Stampar 40f067aa17 Adding new WAF scripts (merging from identYwaf - same author) 2019-01-15 00:41:00 +01:00
Miroslav Stampar 6cdb90ddf8 Same sentence in Cloudflare (too) 2019-01-14 11:35:54 +01:00
Miroslav Stampar c0d4db3aba URI injection patch (on request by @bojanisc) 2019-01-13 12:07:46 +01:00
Miroslav Stampar d086b2aca0 Minor update of WAF scripts 2019-01-12 17:47:43 +01:00
Miroslav Stampar 7cf4b0e1d2 Too generic (removing) 2019-01-12 02:38:54 +01:00
Miroslav Stampar 660036c38b New WAF script 2019-01-12 01:56:18 +01:00
Miroslav Stampar 0a3144ebb5 New WAF script (Squarespace) 2019-01-12 00:15:13 +01:00
Miroslav Stampar 02d66db7e0 New WAF script (SiteGuard) 2019-01-11 23:00:28 +01:00
Miroslav Stampar c94bddd924 Adding new WAF script 2019-01-11 22:33:08 +01:00
Miroslav Stampar aea3749015 Dealing with FP for expressionengine.py 2019-01-11 12:35:35 +01:00
Miroslav Stampar 204c1950fc Fixes #3433 2019-01-10 16:43:06 +01:00
Miroslav Stampar 17be4d6374 Minor update 2019-01-10 16:05:46 +01:00
Miroslav Stampar d7ba7150ce Removing junk 2019-01-10 15:56:49 +01:00
Miroslav Stampar d31d2eeb27 Minor updates and removal of faulty denyall.py WAF script (junk - FP) 2019-01-10 15:35:52 +01:00
Miroslav Stampar c74c58c47e Varnish Cache is not a proof of Varnish WAF usage 2019-01-10 14:27:19 +01:00
Miroslav Stampar d16252e959 Removing junk 2019-01-10 14:19:20 +01:00
Miroslav Stampar 9fef4336b0 Minor update of safe3 WAF script 2019-01-10 14:19:03 +01:00
Miroslav Stampar aa7af33fd5 Update of airlock WAF script 2019-01-10 13:40:51 +01:00
Miroslav Stampar 241c6b02f0 Update of distil WAF script 2019-01-10 13:23:34 +01:00
Miroslav Stampar 915ee5ce53 Trivial file renaming 2019-01-10 13:06:35 +01:00
Miroslav Stampar beee81697c Removing some junk 2019-01-10 11:31:09 +01:00
Nicolas Bonnet 880545cad4 Fix incompatible errMsg for tor and osPwn args (#3432) 2019-01-10 11:28:10 +01:00
Miroslav Stampar 5274c88c7d Minor patch of --identify-waf mechanism 2019-01-09 16:26:11 +01:00
Miroslav Stampar 9a221470e7 Minor patch 2019-01-09 15:44:11 +01:00
Miroslav Stampar 256ec75580 Trivial update of banner 2019-01-09 15:12:16 +01:00
Miroslav Stampar debb64167a Minor update of WAF scripts 2019-01-08 15:36:28 +01:00
Miroslav Stampar 49514adcd9 Minor patch 2019-01-08 12:58:27 +01:00
Miroslav Stampar 02b78d2691 Update of WAF scripts 2019-01-08 12:41:05 +01:00
Miroslav Stampar 82e3c48c8c Removing junk 2019-01-08 11:17:42 +01:00
Miroslav Stampar 243b564b6a Minor updates to WAF scripts 2019-01-07 17:22:16 +01:00
Miroslav Stampar cb72223452 Minor patch 2019-01-07 16:23:18 +01:00
Miroslav Stampar bf207a7ea6 Minor improvement 2019-01-07 16:06:33 +01:00
Miroslav Stampar 3b4e44a38d Better results with following the redirect in identifyWaf phase 2019-01-07 16:05:59 +01:00
Miroslav Stampar 97cf5b9ace New WAF script 2019-01-07 15:52:22 +01:00
Miroslav Stampar ba617c49a4 Minor patch 2019-01-07 15:35:54 +01:00
Miroslav Stampar 929df9bc34 Minor update of WAF scripts 2019-01-07 15:29:35 +01:00
Miroslav Stampar 48cdc6a308 Wrong naming fix 2019-01-07 14:44:31 +01:00
Miroslav Stampar 3b7ef42b30 Goodbye junk 2019-01-07 14:23:20 +01:00
Miroslav Stampar bdddc5c333 Some more junk removal 2019-01-07 14:21:09 +01:00
Miroslav Stampar 8ceff3dcc7 Cleaning junk and updating asm.py WAF script 2019-01-07 14:13:29 +01:00
Miroslav Stampar fcfbc5d59f Removing junk 2019-01-07 13:56:37 +01:00
Miroslav Stampar 12883cac16 Minor update 2019-01-07 13:45:01 +01:00
Miroslav Stampar 9f75fd4fb8 New WAF scripts 2019-01-07 02:58:47 +01:00
Miroslav Stampar 54d0678cbe Adding new WAF scripts 2019-01-07 01:21:07 +01:00
Miroslav Stampar 30497acd0c Minor update of ExpressionEngine WAF script 2019-01-06 03:48:56 +01:00
Miroslav Stampar ed0420e635 Update of WAF script for Cloudfront 2019-01-06 03:22:15 +01:00
Miroslav Stampar 094ce29709 Removing useless netscaler WAF script (passive appliance) 2019-01-06 03:11:31 +01:00
Miroslav Stampar ddd8712c4f Trivial cleanup 2019-01-06 02:30:05 +01:00
Miroslav Stampar 37449262df Fixes #3425 2019-01-06 02:29:09 +01:00
Miroslav Stampar 45c699e9cf Minor patch 2019-01-06 00:37:30 +01:00
Miroslav Stampar e22fab1945 Minor update of PyPI info 2019-01-06 00:29:31 +01:00
149 changed files with 1221 additions and 896 deletions
+46
View File
@@ -0,0 +1,46 @@
GPL Cooperation Commitment
Version 1.0
Before filing or continuing to prosecute any legal proceeding or claim
(other than a Defensive Action) arising from termination of a Covered
License, we commit to extend to the person or entity ('you') accused
of violating the Covered License the following provisions regarding
cure and reinstatement, taken from GPL version 3. As used here, the
term 'this License' refers to the specific Covered License being
enforced.
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly
and finally terminates your license, and (b) permanently, if the
copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you
have received notice of violation of this License (for any work)
from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.
We intend this Commitment to be irrevocable, and binding and
enforceable against us and assignees of or successors to our
copyrights.
Definitions
'Covered License' means the GNU General Public License, version 2
(GPLv2), the GNU Lesser General Public License, version 2.1
(LGPLv2.1), or the GNU Library General Public License, version 2
(LGPLv2), all as published by the Free Software Foundation.
'Defensive Action' means a legal proceeding or claim that We bring
against you in response to a prior proceeding or claim initiated by
you or your affiliate.
'We' means each contributor to this repository as of the date of
inclusion of this file, including subsidiaries of a corporate
contributor.
This work is available under a Creative Commons Attribution-ShareAlike
4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/).
+6 -4
View File
@@ -7,6 +7,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import sys
import zlib
@@ -38,7 +40,7 @@ def decloak(inputFile=None, data=None):
try:
data = zlib.decompress(hideAscii(data))
except:
print 'ERROR: the provided input file \'%s\' does not contain valid cloaked content' % inputFile
print('ERROR: the provided input file \'%s\' does not contain valid cloaked content' % inputFile)
sys.exit(1)
finally:
f.close()
@@ -59,11 +61,11 @@ def main():
if not args.inputFile:
parser.error('Missing the input file, -h for help')
except (OptionError, TypeError), e:
parser.error(e)
except (OptionError, TypeError) as ex:
parser.error(ex)
if not os.path.isfile(args.inputFile):
print 'ERROR: the provided input file \'%s\' is non existent' % args.inputFile
print('ERROR: the provided input file \'%s\' is non existent' % args.inputFile)
sys.exit(1)
if not args.decrypt:
+7 -5
View File
@@ -7,6 +7,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import sys
import struct
@@ -19,7 +21,7 @@ def convert(inputFile):
fileSize = fileStat.st_size
if fileSize > 65280:
print "ERROR: the provided input file '%s' is too big for debug.exe" % inputFile
print("ERROR: the provided input file '%s' is too big for debug.exe" % inputFile)
sys.exit(1)
script = "n %s\nr cx\n" % os.path.basename(inputFile.replace(".", "_"))
@@ -59,7 +61,7 @@ def convert(inputFile):
def main(inputFile, outputFile):
if not os.path.isfile(inputFile):
print "ERROR: the provided input file '%s' is not a regular file" % inputFile
print("ERROR: the provided input file '%s' is not a regular file" % inputFile)
sys.exit(1)
script = convert(inputFile)
@@ -70,7 +72,7 @@ def main(inputFile, outputFile):
sys.stdout.write(script)
sys.stdout.close()
else:
print script
print(script)
if __name__ == "__main__":
usage = "%s -i <input file> [-o <output file>]" % sys.argv[0]
@@ -86,8 +88,8 @@ if __name__ == "__main__":
if not args.inputFile:
parser.error("Missing the input file, -h for help")
except (OptionError, TypeError), e:
parser.error(e)
except (OptionError, TypeError) as ex:
parser.error(ex)
inputFile = args.inputFile
outputFile = args.outputFile
+1 -1
View File
@@ -128,7 +128,7 @@ def main(src, dst):
try:
# Send it to the target host
sock.sendto(ip.get_packet(), (dst, 0))
except socket.error, ex:
except socket.error as ex:
sys.stderr.write("'%s'\n" % ex)
sys.stderr.flush()
+5 -3
View File
@@ -7,6 +7,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import binascii
import re
import string
@@ -108,11 +110,11 @@ def main():
if not args.inputFile:
parser.error('Missing the input file, -h for help')
except (OptionError, TypeError), e:
parser.error(e)
except (OptionError, TypeError) as ex:
parser.error(ex)
if not os.path.isfile(args.inputFile):
print 'ERROR: the provided input file \'%s\' is not a regular file' % args.inputFile
print('ERROR: the provided input file \'%s\' is not a regular file' % args.inputFile)
sys.exit(1)
f = open(args.inputFile, 'r')
+3 -1
View File
@@ -5,6 +5,8 @@
# Removes duplicate entries in wordlist like files
from __future__ import print_function
import sys
if len(sys.argv) > 0:
@@ -17,7 +19,7 @@ if len(sys.argv) > 0:
str.encode(item)
if item in items:
if item:
print item
print(item)
else:
items.append(item)
except:
+5 -3
View File
@@ -3,6 +3,8 @@
# Runs pylint on all python scripts found in a directory tree
# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html
from __future__ import print_function
import os
import sys
@@ -12,16 +14,16 @@ def check(filepath):
if "\n\n\n" in content:
index = content.find("\n\n\n")
print filepath, repr(content[index - 30:index + 30])
print(filepath, repr(content[index - 30:index + 30]))
if __name__ == "__main__":
try:
BASE_DIRECTORY = sys.argv[1]
except IndexError:
print "no directory specified, defaulting to current working directory"
print("no directory specified, defaulting to current working directory")
BASE_DIRECTORY = os.getcwd()
print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY
print("looking for *.py scripts in subdirectories of '%s'" % BASE_DIRECTORY)
for root, dirs, files in os.walk(BASE_DIRECTORY):
if any(_ in root for _ in ("extra", "thirdparty")):
continue
+2 -2
View File
@@ -26,7 +26,7 @@ if [ -f $SETTINGS_FULLPATH ]
then
LINE=$(grep -o ${SETTINGS_FULLPATH} -e 'VERSION = "[0-9.]*"')
declare -a LINE
INCREMENTED=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); _.append(0) if len(_) < 3 else _; _[-1] = str(int(_[-1]) + 1); month = str(time.gmtime().tm_mon); _[-1] = '0' if _[-2] != month else _[-1]; _[-2] = month; print sys.argv[1].replace(version, '.'.join(_))" "$LINE")
INCREMENTED=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); _.extend([0] * (4 - len(_))); _[-1] = str(int(_[-1]) + 1); month = str(time.gmtime().tm_mon); _[-1] = '0' if _[-2] != month else _[-1]; _[-2] = month; print sys.argv[1].replace(version, '.'.join(_))" "$LINE")
if [ -n "$INCREMENTED" ]
then
sed -i "s/${LINE}/${INCREMENTED}/" $SETTINGS_FULLPATH
@@ -39,4 +39,4 @@ then
fi
truncate -s 0 "$CHECKSUM_FULLPATH"
cd $PROJECT_FULLPATH && for i in $(find . -name "*.py" -o -name "*.xml" -o -iname "*_" | sort); do git ls-files $i --error-unmatch &>/dev/null && md5sum $i | stdbuf -i0 -o0 -e0 sed 's/\.\///' >> "$CHECKSUM_FULLPATH"; git add "$CHECKSUM_FULLPATH"; done
cd $PROJECT_FULLPATH && for i in $(find . -name "*.py" -o -name "*.xml" -o -name "*_" -o -type f -regex "./[^./]*" | sort); do git ls-files $i --error-unmatch &>/dev/null && md5sum $i | stdbuf -i0 -o0 -e0 sed 's/\.\///' >> "$CHECKSUM_FULLPATH"; git add "$CHECKSUM_FULLPATH"; done
+11 -9
View File
@@ -3,6 +3,8 @@
# Runs pylint on all python scripts found in a directory tree
# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html
from __future__ import print_function
import os
import re
import sys
@@ -17,26 +19,26 @@ def check(module):
if module[-3:] == ".py":
print "CHECKING ", module
print("CHECKING ", module)
pout = os.popen("pylint --rcfile=/dev/null %s" % module, 'r')
for line in pout:
if re.match(r"\AE:", line):
print line.strip()
print(line.strip())
if __RATING__ and "Your code has been rated at" in line:
print line
print(line)
score = re.findall(r"\d.\d\d", line)[0]
total += float(score)
count += 1
if __name__ == "__main__":
try:
print sys.argv
print(sys.argv)
BASE_DIRECTORY = sys.argv[1]
except IndexError:
print "no directory specified, defaulting to current working directory"
print("no directory specified, defaulting to current working directory")
BASE_DIRECTORY = os.getcwd()
print "looking for *.py scripts in subdirectories of ", BASE_DIRECTORY
print("looking for *.py scripts in subdirectories of ", BASE_DIRECTORY)
for root, dirs, files in os.walk(BASE_DIRECTORY):
if any(_ in root for _ in ("extra", "thirdparty")):
continue
@@ -45,6 +47,6 @@ if __name__ == "__main__":
check(filepath)
if __RATING__:
print "==" * 50
print "%d modules found" % count
print "AVERAGE SCORE = %.02f" % (total / count)
print("==" * 50)
print("%d modules found" % count)
print("AVERAGE SCORE = %.02f" % (total / count))
+6 -1
View File
@@ -30,6 +30,11 @@ setup(
author='Bernardo Damele Assumpcao Guimaraes, Miroslav Stampar',
author_email='[email protected], [email protected]',
url='http://sqlmap.org',
project_urls={
'Documentation': 'https://github.com/sqlmapproject/sqlmap/wiki',
'Source': 'https://github.com/sqlmapproject/sqlmap/',
'Tracker': 'https://github.com/sqlmapproject/sqlmap/issues',
},
download_url='https://github.com/sqlmapproject/sqlmap/archive/$VERSION.zip',
license='GNU General Public License v2 (GPLv2)',
packages=find_packages(),
@@ -174,4 +179,4 @@ sed -i "s/^TYPE =.*/TYPE = \"$TYPE\"/g" sqlmap/lib/core/settings.py
sed -i "s/.*lib\/core\/settings\.py/`md5sum sqlmap/lib/core/settings.py | cut -d ' ' -f 1` lib\/core\/settings\.py/g" sqlmap/txt/checksum.md5
for file in $(find sqlmap -type f | grep -v -E "\.(git|yml)"); do echo include $file >> MANIFEST.in; done
python setup.py sdist upload
rm -rf $TMP_DIR
rm -rf $TMP_DIR
+5 -3
View File
@@ -3,6 +3,8 @@
# Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
# See the file 'LICENSE' for copying permission
from __future__ import print_function
import codecs
import inspect
import os
@@ -56,8 +58,8 @@ def send_email(msg):
s.sendmail(FROM, TO, msg.as_string())
s.quit()
# Catch all for SMTP exceptions
except smtplib.SMTPException, e:
print "Failure to send email: %s" % str(e)
except smtplib.SMTPException as ex:
print("Failure to send email: '%s" % ex)
def failure_email(msg):
msg = prepare_email(msg)
@@ -157,7 +159,7 @@ if __name__ == "__main__":
try:
main()
except Exception, e:
except Exception:
log_fd.write("An exception has occurred:\n%s" % str(traceback.format_exc()))
log_fd.write("Regression test finished at %s\n\n" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime()))
+7 -5
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import cookielib
import re
import socket
@@ -75,8 +77,8 @@ def main():
except KeyboardInterrupt:
raise
except Exception, msg:
print msg
except Exception as ex:
print(ex)
if abort:
break
@@ -86,7 +88,7 @@ def main():
sys.stdout.write("---------------\n")
for sqlfile in files:
print sqlfile
print(sqlfile)
try:
req = urllib2.Request(sqlfile)
@@ -118,8 +120,8 @@ def main():
except KeyboardInterrupt:
raise
except Exception, msg:
print msg
except Exception as ex:
print(ex)
else:
i += 1
+23 -10
View File
@@ -5,21 +5,28 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import cookielib
import glob
import httplib
import inspect
import os
import re
import socket
import ssl
import subprocess
import sys
import urllib2
sys.dont_write_bytecode = True
if hasattr(ssl, "_create_unverified_context"):
ssl._create_default_https_context = ssl._create_unverified_context
NAME, VERSION, AUTHOR = "WAF Detectify", "0.1", "sqlmap developers (@sqlmap)"
TIMEOUT = 10
HEADERS = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Cache-Control": "max-age=0"}
HEADERS = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "identity", "Cache-Control": "max-age=0"}
SQLMAP_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
SCRIPTS_DIR = os.path.join(SQLMAP_DIR, "waf")
LEVEL_COLORS = {"o": "\033[00;94m", "x": "\033[00;91m", "!": "\033[00;93m", "i": "\033[00;92m"}
@@ -43,7 +50,7 @@ def get_page(get=None, url=None, host=None, data=None):
conn = urllib2.urlopen(req, timeout=TIMEOUT)
page = conn.read()
headers = conn.info()
except Exception, ex:
except Exception as ex:
code = getattr(ex, "code", None)
page = ex.read() if hasattr(ex, "read") else getattr(ex, "msg", "")
headers = ex.info() if hasattr(ex, "info") else {}
@@ -63,7 +70,7 @@ def colorize(message):
def main():
global WAF_FUNCTIONS
print colorize("%s #v%s\n by: %s\n" % (NAME, VERSION, AUTHOR))
print(colorize("%s #v%s\n by: %s\n" % (NAME, VERSION, AUTHOR)))
if len(sys.argv) < 2:
exit(colorize("[x] usage: python %s <hostname>" % os.path.split(__file__)[-1]))
@@ -88,8 +95,8 @@ def main():
if filename[:-3] in sys.modules:
del sys.modules[filename[:-3]]
module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or "utf8"))
except ImportError, msg:
exit(colorize("[x] cannot import WAF script '%s' (%s)" % (filename[:-3], msg)))
except ImportError as ex:
exit(colorize("[x] cannot import WAF script '%s' (%s)" % (filename[:-3], ex)))
_ = dict(inspect.getmembers(module))
if "detect" not in _:
@@ -99,7 +106,14 @@ def main():
WAF_FUNCTIONS = sorted(WAF_FUNCTIONS, key=lambda _: "generic" in _[1].lower())
print colorize("[i] checking '%s'..." % sys.argv[1])
print(colorize("[i] checking '%s'..." % sys.argv[1]))
hostname = sys.argv[1].split("//")[-1].split('/')[0]
try:
socket.getaddrinfo(hostname, None)
except socket.gaierror:
print(colorize("[x] host '%s' does not exist" % hostname))
exit(1)
found = False
for function, product in WAF_FUNCTIONS:
@@ -107,13 +121,12 @@ def main():
continue
if function(get_page):
print colorize("[!] WAF/IPS identified as '%s'" % product)
found = True
exit(colorize("[!] WAF/IPS identified as '%s'" % product))
if not found:
print colorize("[o] nothing found")
print(colorize("[o] nothing found"))
print
print()
exit(int(not found))
+3 -3
View File
@@ -75,7 +75,7 @@ def action():
if conf.getPasswordHashes:
try:
conf.dumper.userSettings("database management system users password hashes", conf.dbmsHandler.getPasswordHashes(), "password hash", CONTENT_TYPE.PASSWORDS)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise
@@ -83,7 +83,7 @@ def action():
if conf.getPrivileges:
try:
conf.dumper.userSettings("database management system users privileges", conf.dbmsHandler.getPrivileges(), "privilege", CONTENT_TYPE.PRIVILEGES)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise
@@ -91,7 +91,7 @@ def action():
if conf.getRoles:
try:
conf.dumper.userSettings("database management system users roles", conf.dbmsHandler.getRoles(), "role", CONTENT_TYPE.ROLES)
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.critical(ex)
except:
raise
+18 -14
View File
@@ -86,7 +86,7 @@ from lib.core.settings import DUMMY_NON_SQLI_CHECK_APPENDIX
from lib.core.settings import FI_ERROR_REGEX
from lib.core.settings import FORMAT_EXCEPTION_STRINGS
from lib.core.settings import HEURISTIC_CHECK_ALPHABET
from lib.core.settings import IDS_WAF_CHECK_PAYLOAD
from lib.core.settings import IPS_WAF_CHECK_PAYLOAD
from lib.core.settings import IDS_WAF_CHECK_RATIO
from lib.core.settings import IDS_WAF_CHECK_TIMEOUT
from lib.core.settings import MAX_DIFFLIB_SEQUENCE_LENGTH
@@ -426,11 +426,14 @@ def checkSqlInjection(place, parameter, value):
templatePayload = None
vector = None
origValue = value
if kb.customInjectionMark in origValue:
origValue = origValue.split(kb.customInjectionMark)[0]
origValue = re.search(r"(\w*)\Z", origValue).group(1)
# Threat the parameter original value according to the
# test's <where> tag
if where == PAYLOAD.WHERE.ORIGINAL or conf.prefix:
origValue = value
if kb.tamperFunctions:
templatePayload = agent.payload(place, parameter, value="", newValue=origValue, where=where)
elif where == PAYLOAD.WHERE.NEGATIVE:
@@ -440,7 +443,7 @@ def checkSqlInjection(place, parameter, value):
if conf.invalidLogical:
_ = int(kb.data.randomInt[:2])
origValue = "%s AND %s LIKE %s" % (value, _, _ + 1)
origValue = "%s AND %s LIKE %s" % (origValue, _, _ + 1)
elif conf.invalidBignum:
origValue = kb.data.randomInt[:6]
elif conf.invalidString:
@@ -615,7 +618,7 @@ def checkSqlInjection(place, parameter, value):
page, headers, _ = Request.queryPage(reqPayload, place, content=True, raise404=False)
output = extractRegexResult(check, page, re.DOTALL | re.IGNORECASE)
output = output or extractRegexResult(check, threadData.lastHTTPError[2] if wasLastResponseHTTPError() else None, re.DOTALL | re.IGNORECASE)
output = output or extractRegexResult(check, listToStrValue((headers[key] for key in headers.keys() if key.lower() != URI_HTTP_HEADER.lower()) if headers else None), re.DOTALL | re.IGNORECASE)
output = output or extractRegexResult(check, listToStrValue((headers[key] for key in headers if key.lower() != URI_HTTP_HEADER.lower()) if headers else None), re.DOTALL | re.IGNORECASE)
output = output or extractRegexResult(check, threadData.lastRedirectMsg[1] if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE)
if output:
@@ -627,10 +630,10 @@ def checkSqlInjection(place, parameter, value):
injectable = True
except SqlmapConnectionException, msg:
except SqlmapConnectionException as ex:
debugMsg = "problem occurred most likely because the "
debugMsg += "server hasn't recovered as expected from the "
debugMsg += "error-based payload used ('%s')" % msg
debugMsg += "error-based payload used ('%s')" % getSafeExString(ex)
logger.debug(debugMsg)
# In case of time-based blind or stacked queries
@@ -1350,7 +1353,7 @@ def checkWaf():
logger.info(infoMsg)
retVal = False
payload = "%d %s" % (randomInt(), IDS_WAF_CHECK_PAYLOAD)
payload = "%d %s" % (randomInt(), IPS_WAF_CHECK_PAYLOAD)
if PLACE.URI in conf.parameters:
place = PLACE.POST
@@ -1418,11 +1421,12 @@ def identifyWaf():
page, headers, code = None, None, None
try:
pushValue(kb.redirectChoice)
kb.redirectChoice = REDIRECTION.NO
kb.redirectChoice = REDIRECTION.YES
if kwargs.get("get"):
kwargs["get"] = urlencode(kwargs["get"])
kwargs["raise404"] = False
kwargs["silent"] = True
kwargs["finalCode"] = True
page, headers, code = Request.getPage(*args, **kwargs)
except Exception:
pass
@@ -1439,7 +1443,7 @@ def identifyWaf():
try:
logger.debug("checking for WAF/IPS product '%s'" % product)
found = function(_)
except Exception, ex:
except Exception as ex:
errMsg = "exception occurred while running "
errMsg += "WAF script for '%s' ('%s')" % (product, getSafeExString(ex))
logger.critical(errMsg)
@@ -1542,11 +1546,11 @@ def checkConnection(suppressOutput=False):
except socket.gaierror:
errMsg = "host '%s' does not exist" % conf.hostname
raise SqlmapConnectionException(errMsg)
except socket.error, ex:
except socket.error as ex:
errMsg = "problem occurred while "
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
except UnicodeError, ex:
except UnicodeError as ex:
errMsg = "problem occurred while "
errMsg += "handling a host name '%s' ('%s')" % (conf.hostname, getSafeExString(ex))
raise SqlmapDataException(errMsg)
@@ -1588,9 +1592,9 @@ def checkConnection(suppressOutput=False):
conf.url = re.sub(r"https?://", "https://", conf.url)
match = re.search(r":(\d+)", threadData.lastRedirectURL[1])
port = match.group(1) if match else 443
conf.url = re.sub(r":\d+/", ":%s/" % port, conf.url)
conf.url = re.sub(r":\d+(/|\Z)", ":%s\g<1>" % port, conf.url)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
if conf.ipv6:
warnMsg = "check connection to a provided "
warnMsg += "IPv6 address with a tool like ping6 "
+5 -5
View File
@@ -90,7 +90,7 @@ def _selectInjection():
if point not in points:
points[point] = injection
else:
for key in points[point].keys():
for key in points[point]:
if key != 'data':
points[point][key] = points[point][key] or injection[key]
points[point]['data'].update(injection['data'])
@@ -244,7 +244,7 @@ def _saveToResultsFile():
if key not in results:
results[key] = []
results[key].extend(injection.data.keys())
results[key].extend(list(injection.data.keys()))
try:
for key, value in results.items():
@@ -257,7 +257,7 @@ def _saveToResultsFile():
conf.resultsFP.write(line)
conf.resultsFP.flush()
except IOError, ex:
except IOError as ex:
errMsg = "unable to write to the results file '%s' ('%s'). " % (conf.resultsFilename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -427,7 +427,7 @@ def start():
checkStability()
# Do a little prioritization reorder of a testable parameter list
parameters = conf.parameters.keys()
parameters = list(conf.parameters.keys())
# Order of testing list (first to last)
orderList = (PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER, PLACE.URI, PLACE.POST, PLACE.GET)
@@ -689,7 +689,7 @@ def start():
except SqlmapSilentQuitException:
raise
except SqlmapBaseException, ex:
except SqlmapBaseException as ex:
errMsg = getSafeExString(ex)
if conf.multipleTargets:
+2 -2
View File
@@ -105,13 +105,13 @@ def setHandler():
if sqlalchemy.connector:
conf.dbmsConnector = sqlalchemy
except Exception, ex:
except Exception as ex:
exception = ex
if not dialect or exception:
try:
conf.dbmsConnector.connect()
except Exception, ex:
except Exception as ex:
if exception:
raise exception
else:
+1 -1
View File
@@ -107,7 +107,7 @@ class Agent(object):
else:
origValue = filter(None, (re.search(_, origValue.split(BOUNDED_INJECTION_MARKER)[0]) for _ in (r"\w+\Z", r"[^\"'><]+\Z", r"[^ ]+\Z")))[0].group(0)
origValue = origValue[origValue.rfind('/') + 1:]
for char in ('?', '=', ':', ','):
for char in ('?', '=', ':', ',', '&'):
if char in origValue:
origValue = origValue[origValue.rfind(char) + 1:]
elif place == PLACE.CUSTOM_POST:
+5 -5
View File
@@ -87,7 +87,7 @@ class BigArray(list):
try:
with open(self.chunks[-1], "rb") as f:
self.chunks[-1] = pickle.loads(bz2.decompress(f.read()))
except IOError, ex:
except IOError as ex:
errMsg = "exception occurred while retrieving data "
errMsg += "from a temporary file ('%s')" % ex.message
raise SqlmapSystemException(errMsg)
@@ -109,7 +109,7 @@ class BigArray(list):
with open(filename, "w+b") as f:
f.write(bz2.compress(pickle.dumps(chunk, pickle.HIGHEST_PROTOCOL), BIGARRAY_COMPRESS_LEVEL))
return filename
except (OSError, IOError), ex:
except (OSError, IOError) as ex:
errMsg = "exception occurred while storing data "
errMsg += "to a temporary file ('%s'). Please " % ex.message
errMsg += "make sure that there is enough disk space left. If problem persists, "
@@ -126,7 +126,7 @@ class BigArray(list):
try:
with open(self.chunks[index], "rb") as f:
self.cache = Cache(index, pickle.loads(bz2.decompress(f.read())), False)
except Exception, ex:
except Exception as ex:
errMsg = "exception occurred while retrieving data "
errMsg += "from a temporary file ('%s')" % ex.message
raise SqlmapSystemException(errMsg)
@@ -148,7 +148,7 @@ class BigArray(list):
if y < 0:
y += len(self)
index = y / self.chunk_length
index = y // self.chunk_length
offset = y % self.chunk_length
chunk = self.chunks[index]
@@ -159,7 +159,7 @@ class BigArray(list):
return self.cache.data[offset]
def __setitem__(self, y, value):
index = y / self.chunk_length
index = y // self.chunk_length
offset = y % self.chunk_length
chunk = self.chunks[index]
+73 -39
View File
@@ -688,7 +688,7 @@ def paramToDict(place, parameters=None):
debugMsg += "is not inside the %s" % place
logger.debug(debugMsg)
elif len(conf.testParameter) != len(testableParameters.keys()):
elif len(conf.testParameter) != len(testableParameters):
for parameter in conf.testParameter:
if parameter not in testableParameters:
debugMsg = "provided parameter '%s' " % parameter
@@ -872,9 +872,9 @@ def boldifyMessage(message):
return retVal
def setColor(message, color=None, bold=False):
def setColor(message, color=None, bold=False, level=None):
retVal = message
level = extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message) or kb.get("stickyLevel")
level = level or extractRegexResult(r"\[(?P<result>%s)\]" % '|'.join(_[0] for _ in getPublicTypeMembers(LOGGING_LEVELS)), message)
if isinstance(level, unicode):
level = unicodeencode(level)
@@ -885,7 +885,6 @@ def setColor(message, color=None, bold=False):
elif level:
level = getattr(logging, level, None) if isinstance(level, basestring) else level
retVal = LOGGER_HANDLER.colorize(message, level)
kb.stickyLevel = level if message and message[-1] != "\n" else None
return retVal
@@ -913,7 +912,8 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
if not kb.get("threadException"):
if forceOutput or not (getCurrentThreadData().disableStdOut or kb.get("wizardMode")):
if kb.get("multiThreadMode"):
multiThreadMode = isMultiThreadMode()
if multiThreadMode:
logging._acquireLock()
if isinstance(data, unicode):
@@ -931,7 +931,7 @@ def dataToStdout(data, forceOutput=False, bold=False, content_type=None, status=
except IOError:
pass
if kb.get("multiThreadMode"):
if multiThreadMode:
logging._releaseLock()
kb.prependFlag = isinstance(data, basestring) and (len(data) == 1 and data not in ('\n', '\r') or len(data) > 2 and data[0] == '\r' and data[-1] != '\n')
@@ -943,7 +943,7 @@ def dataToTrafficFile(data):
try:
conf.trafficFP.write(data)
conf.trafficFP.flush()
except IOError, ex:
except IOError as ex:
errMsg = "something went wrong while trying "
errMsg += "to write to the traffic file '%s' ('%s')" % (conf.trafficFile, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -952,7 +952,7 @@ def dataToDumpFile(dumpFile, data):
try:
dumpFile.write(data)
dumpFile.flush()
except IOError, ex:
except IOError as ex:
if "No space left" in getUnicode(ex):
errMsg = "no space left on output device"
logger.error(errMsg)
@@ -972,7 +972,7 @@ def dataToOutFile(filename, data):
try:
with open(retVal, "w+b") as f: # has to stay as non-codecs because data is raw ASCII encoded data
f.write(unicodeencode(data))
except UnicodeEncodeError, ex:
except UnicodeEncodeError as ex:
_ = normalizeUnicode(filename)
if filename != _:
filename = _
@@ -980,7 +980,7 @@ def dataToOutFile(filename, data):
errMsg = "couldn't write to the "
errMsg += "output file ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
except IOError, ex:
except IOError as ex:
errMsg = "something went wrong while trying to write "
errMsg += "to the output file ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
@@ -995,7 +995,6 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
"""
retVal = None
kb.stickyLevel = None
message = getUnicode(message)
@@ -1446,7 +1445,7 @@ def parseTargetUrl():
try:
urlSplit = urlparse.urlsplit(conf.url)
except ValueError, ex:
except ValueError as ex:
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, getSafeExString(ex))
errMsg += "Please be sure that you don't have any leftover characters (e.g. '[' or ']') "
errMsg += "in the hostname part"
@@ -1560,7 +1559,7 @@ def expandAsteriskForColumns(expression):
columnsDict = conf.dbmsHandler.getColumns(onlyColNames=True)
if columnsDict and conf.db in columnsDict and conf.tbl in columnsDict[conf.db]:
columns = columnsDict[conf.db][conf.tbl].keys()
columns = list(columnsDict[conf.db][conf.tbl].keys())
columns.sort()
columnsStr = ", ".join(column for column in columns)
expression = expression.replace('*', columnsStr, 1)
@@ -1982,6 +1981,13 @@ def isHexEncodedString(subject):
return re.match(r"\A[0-9a-fA-Fx]+\Z", subject) is not None
def isMultiThreadMode():
"""
Checks if running in multi-thread(ing) mode
"""
return threading.activeCount() > 1
@cachedmethod
def getConsoleWidth(default=80):
"""
@@ -2028,7 +2034,6 @@ def clearConsoleLine(forceOutput=False):
dataToStdout("\r%s\r" % (" " * (getConsoleWidth() - 1)), forceOutput)
kb.prependFlag = False
kb.stickyLevel = None
def parseXmlFile(xmlFile, handler):
"""
@@ -2038,7 +2043,7 @@ def parseXmlFile(xmlFile, handler):
try:
with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream:
parse(stream, handler)
except (SAXParseException, UnicodeError), ex:
except (SAXParseException, UnicodeError) as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
@@ -2064,7 +2069,7 @@ def getSQLSnippet(dbms, sfile, **variables):
retVal = re.sub(r"#.+", "", retVal)
retVal = re.sub(r";\s+", "; ", retVal).strip("\r\n")
for _ in variables.keys():
for _ in variables:
retVal = re.sub(r"%%%s%%" % _, variables[_].replace('\\', r'\\'), retVal)
for _ in re.findall(r"%RANDSTR\d+%", retVal, re.I):
@@ -2104,7 +2109,7 @@ def readCachedFileContent(filename, mode="rb"):
try:
with openFile(filename, mode) as f:
kb.cache.content[filename] = f.read()
except (IOError, OSError, MemoryError), ex:
except (IOError, OSError, MemoryError) as ex:
errMsg = "something went wrong while trying "
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -2129,7 +2134,7 @@ def average(values):
0.9
"""
return (sum(values) / len(values)) if values else None
return (1.0 * sum(values) / len(values)) if values else None
@cachedmethod
def stdev(values):
@@ -2218,12 +2223,12 @@ def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, un
retVal[line] = True
else:
retVal.append(line)
except (IOError, OSError, MemoryError), ex:
except (IOError, OSError, MemoryError) as ex:
errMsg = "something went wrong while trying "
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
return retVal if not unique else retVal.keys()
return retVal if not unique else list(retVal.keys())
def goGoodSamaritan(prevValue, originalCharset):
"""
@@ -2351,7 +2356,7 @@ def getUnicode(value, encoding=None, noneToNull=False):
while True:
try:
return unicode(value, encoding or (kb.get("pageEncoding") if kb.get("originalPage") else None) or UNICODE_ENCODING)
except UnicodeDecodeError, ex:
except UnicodeDecodeError as ex:
try:
return unicode(value, UNICODE_ENCODING)
except:
@@ -2407,7 +2412,7 @@ def pushValue(value):
getCurrentThreadData().valueStack.append(copy.deepcopy(value))
success = True
break
except Exception, ex:
except Exception as ex:
_ = ex
if not success:
@@ -3056,7 +3061,7 @@ def saveConfig(conf, filename):
config = UnicodeRawConfigParser()
userOpts = {}
for family in optDict.keys():
for family in optDict:
userOpts[family] = []
for option, value in conf.items():
@@ -3095,7 +3100,7 @@ def saveConfig(conf, filename):
with openFile(filename, "wb") as f:
try:
config.write(f)
except IOError, ex:
except IOError as ex:
errMsg = "something went wrong while trying "
errMsg += "to write to the configuration file '%s' ('%s')" % (filename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -3347,8 +3352,7 @@ def unhandledExceptionMessage():
errMsg += "repository at '%s'. If the exception persists, please open a new issue " % GIT_PAGE
errMsg += "at '%s' " % ISSUES_PAGE
errMsg += "with the following text and any other information required to "
errMsg += "reproduce the bug. The "
errMsg += "developers will try to reproduce the bug, fix it accordingly "
errMsg += "reproduce the bug. Developers will try to reproduce the bug, fix it accordingly "
errMsg += "and get back to you\n"
errMsg += "Running version: %s\n" % VERSION_STRING[VERSION_STRING.find('/') + 1:]
errMsg += "Python version: %s\n" % PYVERSION
@@ -3442,7 +3446,7 @@ def createGithubIssue(errMsg, excMsg):
try:
content = urllib2.urlopen(req).read()
except Exception, ex:
except Exception as ex:
content = None
issueUrl = re.search(r"https://github.com/sqlmapproject/sqlmap/issues/\d+", content or "")
@@ -3484,7 +3488,7 @@ def maskSensitiveData(msg):
retVal = retVal.replace(match.group(3), '*' * len(match.group(3)))
# Fail-safe substitution
retVal = re.sub(r"(?i)\bhttps?://[^ ]+", lambda match: '*' * len(match.group(0)), retVal)
retVal = re.sub(r"(?i)(Command line:.+)\b(https?://[^ ]+)", lambda match: "%s%s" % (match.group(1), '*' * len(match.group(2))), retVal)
if getpass.getuser():
retVal = re.sub(r"(?i)\b%s\b" % re.escape(getpass.getuser()), '*' * len(getpass.getuser()), retVal)
@@ -3531,6 +3535,32 @@ def intersect(containerA, containerB, lowerCase=False):
return retVal
def decodeStringEscape(value):
"""
Decodes escaped string values (e.g. "\\t" -> "\t")
"""
retVal = value
if value and '\\' in value:
if isinstance(value, unicode):
retVal = retVal.encode(UNICODE_ENCODING)
try:
retVal = codecs.escape_decode(retVal)[0]
except:
try:
retVal = retVal.decode("string_escape")
except:
charset = string.whitespace.replace(" ", "")
for _ in charset:
retVal = retVal.replace(repr(_).strip("'"), _)
if isinstance(value, unicode):
retVal = getUnicode(retVal)
return retVal
def removeReflectiveValues(content, payload, suppressWarning=False):
"""
Neutralizes reflective values in a given content based on a payload
@@ -3555,7 +3585,7 @@ def removeReflectiveValues(content, payload, suppressWarning=False):
retVal = content.replace(payload, REFLECTED_VALUE_MARKER) # dummy approach
if len(parts) > REFLECTED_MAX_REGEX_PARTS: # preventing CPU hogs
regex = _("%s%s%s" % (REFLECTED_REPLACEMENT_REGEX.join(parts[:REFLECTED_MAX_REGEX_PARTS / 2]), REFLECTED_REPLACEMENT_REGEX, REFLECTED_REPLACEMENT_REGEX.join(parts[-REFLECTED_MAX_REGEX_PARTS / 2:])))
regex = _("%s%s%s" % (REFLECTED_REPLACEMENT_REGEX.join(parts[:REFLECTED_MAX_REGEX_PARTS // 2]), REFLECTED_REPLACEMENT_REGEX, REFLECTED_REPLACEMENT_REGEX.join(parts[-REFLECTED_MAX_REGEX_PARTS // 2:])))
parts = filter(None, regex.split(REFLECTED_REPLACEMENT_REGEX))
@@ -3795,7 +3825,7 @@ def expandMnemonics(mnemonics, parser, args):
logger.debug(debugMsg)
else:
found = sorted(options.keys(), key=lambda x: len(x))[0]
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options.keys()))
warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to any of: %s). " % (name, ", ".join("'%s'" % key for key in options))
warnMsg += "Resolved to shortest of those ('%s')" % found
logger.warn(warnMsg)
@@ -4063,7 +4093,7 @@ def findPageForms(content, url, raise_=False, addToTargets=False):
continue
request = form.click()
except (ValueError, TypeError), ex:
except (ValueError, TypeError) as ex:
errMsg = "there has been a problem while "
errMsg += "processing page forms ('%s')" % getSafeExString(ex)
if raise_:
@@ -4145,6 +4175,9 @@ def getHostHeader(url):
elif any(retVal.endswith(':%d' % _) for _ in (80, 443)):
retVal = retVal.split(':')[0]
if retVal and retVal.count(':') > 1 and not any(_ in retVal for _ in ('[', ']')):
retVal = "[%s]" % retVal
return retVal
def checkDeprecatedOptions(args):
@@ -4193,7 +4226,7 @@ def evaluateCode(code, variables=None):
exec(code, variables)
except KeyboardInterrupt:
raise
except Exception, ex:
except Exception as ex:
errMsg = "an error occurred while evaluating provided code ('%s') " % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
@@ -4409,9 +4442,9 @@ def resetCookieJar(cookieJar):
errMsg = "no valid cookies found"
raise SqlmapGenericException(errMsg)
except cookielib.LoadError, msg:
except cookielib.LoadError as ex:
errMsg = "there was a problem loading "
errMsg += "cookies file ('%s')" % re.sub(r"(cookies) file '[^']+'", r"\g<1>", str(msg))
errMsg += "cookies file ('%s')" % re.sub(r"(cookies) file '[^']+'", r"\g<1>", getSafeExString(ex))
raise SqlmapGenericException(errMsg)
def decloakToTemp(filename):
@@ -4598,9 +4631,8 @@ def parseRequestFile(reqFile, checkParams=True):
reqResList = re.finditer(BURP_REQUEST_REGEX, content, re.I | re.S)
for match in reqResList:
request = match if isinstance(match, basestring) else match.group(0)
request = match if isinstance(match, basestring) else match.group(1)
request = re.sub(r"\A[^\w]+", "", request)
schemePort = re.search(r"(http[\w]*)\:\/\/.*?\:([\d]+).+?={10,}", request, re.I | re.S)
if schemePort:
@@ -4716,7 +4748,7 @@ def parseRequestFile(reqFile, checkParams=True):
try:
with openFile(reqFile, "rb") as f:
content = f.read()
except (IOError, OSError, MemoryError), ex:
except (IOError, OSError, MemoryError) as ex:
errMsg = "something went wrong while trying "
errMsg += "to read the content of file '%s' ('%s')" % (reqFile, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
@@ -4739,14 +4771,16 @@ def getSafeExString(ex, encoding=None):
u'foobar'
"""
retVal = ex
if getattr(ex, "message", None):
retVal = ex.message
elif getattr(ex, "msg", None):
retVal = ex.msg
elif isinstance(ex, (list, tuple)) and len(ex) > 1 and isinstance(ex[1], basestring):
retVal = ex[1]
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], basestring):
retVal = ex[0]
else:
retVal = str(ex)
return getUnicode(retVal or "", encoding=encoding).strip()
+39
View File
@@ -8,6 +8,8 @@ See the file 'LICENSE' for copying permission
import copy
import types
from thirdparty.odict.odict import OrderedDict
class AttribDict(dict):
"""
This class defines the sqlmap object, inheriting from Python data
@@ -104,3 +106,40 @@ class InjectionDict(AttribDict):
self.dbms = None
self.dbms_version = None
self.os = None
# Reference: https://www.kunxi.org/2014/05/lru-cache-in-python
class LRUDict(object):
def __init__(self, capacity):
self.capacity = capacity
self.cache = OrderedDict()
def __len__(self):
return len(self.cache)
def __contains__(self, key):
return key in self.cache
def __getitem__(self, key):
try:
value = self.cache.pop(key)
self.cache[key] = value
return value
except KeyError:
return -1
def get(self, key):
return self.__getitem__(self, key)
def __setitem__(self, key, value):
try:
self.cache.pop(key)
except KeyError:
if len(self.cache) >= self.capacity:
self.cache.popitem(last=False)
self.cache[key] = value
def set(self, key, value):
self.__setitem__(key, value)
def keys(self):
return self.cache.keys()
+11 -5
View File
@@ -7,10 +7,15 @@ See the file 'LICENSE' for copying permission
import functools
import hashlib
import threading
from lib.core.settings import MAX_CACHE_ITEMS
from lib.core.datatype import LRUDict
from lib.core.threads import getCurrentThreadData
def cachedmethod(f, cache={}):
_lock = threading.Lock()
def cachedmethod(f, cache=LRUDict(capacity=MAX_CACHE_ITEMS)):
"""
Method with a cached content
@@ -19,11 +24,12 @@ def cachedmethod(f, cache={}):
@functools.wraps(f)
def _(*args, **kwargs):
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs))).hexdigest(), 16) & 0x7fffffffffffffff
if key not in cache:
cache[key] = f(*args, **kwargs)
with _lock:
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs))).hexdigest(), 16) & 0x7fffffffffffffff
if key not in cache:
cache[key] = f(*args, **kwargs)
return cache[key]
return cache[key]
return _
+10 -10
View File
@@ -20,6 +20,7 @@ from lib.core.common import dataToStdout
from lib.core.common import getSafeExString
from lib.core.common import getUnicode
from lib.core.common import isListLike
from lib.core.common import isMultiThreadMode
from lib.core.common import normalizeUnicode
from lib.core.common import openFile
from lib.core.common import prioritySortColumns
@@ -74,16 +75,17 @@ class Dump(object):
if console:
dataToStdout(text)
if kb.get("multiThreadMode"):
multiThreadMode = isMultiThreadMode()
if multiThreadMode:
self._lock.acquire()
try:
self._outputFP.write(text)
except IOError, ex:
except IOError as ex:
errMsg = "error occurred while writing to log file ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
if kb.get("multiThreadMode"):
if multiThreadMode:
self._lock.release()
kb.dataOutputFlag = True
@@ -99,7 +101,7 @@ class Dump(object):
self._outputFile = os.path.join(conf.outputPath, "log")
try:
self._outputFP = openFile(self._outputFile, "ab" if not conf.flushSession else "wb")
except IOError, ex:
except IOError as ex:
errMsg = "error occurred while opening log file ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
@@ -110,8 +112,6 @@ class Dump(object):
self._write(data, content_type=content_type)
def string(self, header, data, content_type=None, sort=True):
kb.stickyLevel = None
if conf.api:
self._write(data, content_type=content_type)
return
@@ -426,10 +426,10 @@ class Dump(object):
if not os.path.isdir(dumpDbPath):
try:
os.makedirs(dumpDbPath)
except Exception, ex:
except Exception as ex:
try:
tempDir = tempfile.mkdtemp(prefix="sqlmapdb")
except IOError, _:
except IOError as _:
errMsg = "unable to write to the temporary directory ('%s'). " % _
errMsg += "Please make sure that your disk is not full and "
errMsg += "that you have sufficient write permissions to "
@@ -624,8 +624,8 @@ class Dump(object):
with open(filepath, "wb") as f:
_ = safechardecode(value, True)
f.write(_)
except magic.MagicException, err:
logger.debug(str(err))
except magic.MagicException as ex:
logger.debug(getSafeExString(ex))
if conf.dumpFormat == DUMP_FORMAT.CSV:
if field == fields:
+34 -40
View File
@@ -33,6 +33,7 @@ from lib.core.common import Backend
from lib.core.common import boldifyMessage
from lib.core.common import checkFile
from lib.core.common import dataToStdout
from lib.core.common import decodeStringEscape
from lib.core.common import getPublicTypeMembers
from lib.core.common import getSafeExString
from lib.core.common import findLocalPort
@@ -100,6 +101,7 @@ from lib.core.optiondict import optDict
from lib.core.settings import CODECS_LIST_PAGE
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
from lib.core.settings import DBMS_ALIASES
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
from lib.core.settings import DEFAULT_PAGE_ENCODING
from lib.core.settings import DEFAULT_TOR_HTTP_PORTS
from lib.core.settings import DEFAULT_TOR_SOCKS_PORTS
@@ -193,7 +195,7 @@ def _loadQueries():
tree = ElementTree()
try:
tree.parse(paths.QUERIES_XML)
except Exception, ex:
except Exception as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
@@ -223,10 +225,11 @@ def _setMultipleTargets():
if os.path.isfile(conf.logFile):
for target in parseRequestFile(conf.logFile):
url = target[0]
if url not in seen:
url, _, data, _, _ = target
key = re.sub(r"(\w+=)[^%s ]*" % (conf.paramDel or DEFAULT_GET_POST_DELIMITER), r"\g<1>", "%s %s" % (url, data))
if key not in seen:
kb.targets.add(target)
seen.add(url)
seen.add(key)
elif os.path.isdir(conf.logFile):
files = os.listdir(conf.logFile)
@@ -237,10 +240,11 @@ def _setMultipleTargets():
continue
for target in parseRequestFile(os.path.join(conf.logFile, reqFile)):
url = target[0]
if url not in seen:
url, _, data, _, _ = target
key = re.sub(r"(\w+=)[^%s ]*" % (conf.paramDel or DEFAULT_GET_POST_DELIMITER), r"\g<1>", "%s %s" % (url, data))
if key not in seen:
kb.targets.add(target)
seen.add(url)
seen.add(key)
else:
errMsg = "the specified list of targets is not a file "
@@ -310,7 +314,7 @@ def _setRequestFromFile():
infoMsg = "parsing second-order HTTP request from '%s'" % conf.secondReq
logger.info(infoMsg)
target = parseRequestFile(conf.secondReq, False).next()
target = next(parseRequestFile(conf.secondReq, False))
kb.secondReq = target
def _setCrawler():
@@ -332,7 +336,7 @@ def _setCrawler():
if conf.verbose in (1, 2):
status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except Exception, ex:
except Exception as ex:
errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, getSafeExString(ex))
logger.error(errMsg)
@@ -468,7 +472,7 @@ def _findPageForms():
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except KeyboardInterrupt:
break
except Exception, ex:
except Exception as ex:
errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, getSafeExString(ex))
logger.error(errMsg)
@@ -765,7 +769,7 @@ def _setTamperingFunctions():
try:
module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or UNICODE_ENCODING))
except Exception, ex:
except Exception as ex:
raise SqlmapSyntaxException("cannot import tamper module '%s' (%s)" % (filename[:-3], getSafeExString(ex)))
priority = PRIORITY.NORMAL if not hasattr(module, "__priority__") else module.__priority__
@@ -798,7 +802,7 @@ def _setTamperingFunctions():
elif name == "dependencies":
try:
function()
except Exception, ex:
except Exception as ex:
errMsg = "error occurred while checking dependencies "
errMsg += "for tamper module '%s' ('%s')" % (filename[:-3], getSafeExString(ex))
raise SqlmapGenericException(errMsg)
@@ -843,8 +847,8 @@ def _setWafFunctions():
if filename[:-3] in sys.modules:
del sys.modules[filename[:-3]]
module = __import__(filename[:-3].encode(sys.getfilesystemencoding() or UNICODE_ENCODING))
except ImportError, msg:
raise SqlmapSyntaxException("cannot import WAF script '%s' (%s)" % (filename[:-3], msg))
except ImportError as ex:
raise SqlmapSyntaxException("cannot import WAF script '%s' (%s)" % (filename[:-3], getSafeExString(ex)))
_ = dict(inspect.getmembers(module))
if "detect" not in _:
@@ -971,7 +975,7 @@ def _setHTTPHandlers():
try:
_ = urlparse.urlsplit(conf.proxy)
except Exception, ex:
except Exception as ex:
errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, getSafeExString(ex))
raise SqlmapSyntaxException(errMsg)
@@ -1192,7 +1196,7 @@ def _setHTTPAuthentication():
elif authType == AUTH_TYPE.NTLM:
regExp = "^(.*\\\\.*):(.*?)$"
errMsg = "HTTP NTLM authentication credentials value must "
errMsg += "be in format 'DOMAIN\username:password'"
errMsg += "be in format 'DOMAIN\\username:password'"
elif authType == AUTH_TYPE.PKI:
errMsg = "HTTP PKI authentication require "
errMsg += "usage of option `--auth-pki`"
@@ -1373,7 +1377,7 @@ def _setHostname():
if conf.url:
try:
conf.hostname = urlparse.urlsplit(conf.url).netloc.split(':')[0]
except ValueError, ex:
except ValueError as ex:
errMsg = "problem occurred while "
errMsg += "parsing an URL '%s' ('%s')" % (conf.url, getSafeExString(ex))
raise SqlmapDataException(errMsg)
@@ -1427,7 +1431,7 @@ def _createTemporaryDirectory():
warnMsg = "using '%s' as the temporary directory" % conf.tmpDir
logger.warn(warnMsg)
except (OSError, IOError), ex:
except (OSError, IOError) as ex:
errMsg = "there has been a problem while accessing "
errMsg += "temporary directory location(s) ('%s')" % getSafeExString(ex)
raise SqlmapSystemException(errMsg)
@@ -1435,7 +1439,7 @@ def _createTemporaryDirectory():
try:
if not os.path.isdir(tempfile.gettempdir()):
os.makedirs(tempfile.gettempdir())
except Exception, ex:
except Exception as ex:
warnMsg = "there has been a problem while accessing "
warnMsg += "system's temporary directory location(s) ('%s'). Please " % getSafeExString(ex)
warnMsg += "make sure that there is enough disk space left. If problem persists, "
@@ -1454,7 +1458,7 @@ def _createTemporaryDirectory():
if not os.path.isdir(tempfile.tempdir):
try:
os.makedirs(tempfile.tempdir)
except Exception, ex:
except Exception as ex:
errMsg = "there has been a problem while setting "
errMsg += "temporary directory location ('%s')" % getSafeExString(ex)
raise SqlmapSystemException(errMsg)
@@ -1497,11 +1501,8 @@ def _cleanupOptions():
else:
conf.rParam = []
if conf.paramDel and '\\' in conf.paramDel:
try:
conf.paramDel = conf.paramDel.decode("string_escape")
except ValueError:
pass
if conf.paramDel:
conf.paramDel = decodeStringEscape(conf.paramDel)
if conf.skip:
conf.skip = conf.skip.replace(" ", "")
@@ -1613,7 +1614,7 @@ def _cleanupOptions():
conf.code = int(conf.code)
if conf.csvDel:
conf.csvDel = conf.csvDel.decode("string_escape") # e.g. '\\t' -> '\t'
conf.csvDel = decodeStringEscape(conf.csvDel)
if conf.torPort and isinstance(conf.torPort, basestring) and conf.torPort.isdigit():
conf.torPort = int(conf.torPort)
@@ -1626,18 +1627,13 @@ def _cleanupOptions():
setPaths(paths.SQLMAP_ROOT_PATH)
if conf.string:
try:
conf.string = conf.string.decode("unicode_escape")
except:
charset = string.whitespace.replace(" ", "")
for _ in charset:
conf.string = conf.string.replace(_.encode("string_escape"), _)
conf.string = decodeStringEscape(conf.string)
if conf.getAll:
map(lambda _: conf.__setitem__(_, True), WIZARD.ALL)
if conf.noCast:
for _ in DUMP_REPLACEMENTS.keys():
for _ in list(DUMP_REPLACEMENTS.keys()):
del DUMP_REPLACEMENTS[_]
if conf.dumpFormat:
@@ -1826,7 +1822,6 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.matchRatio = None
kb.maxConnectionsFlag = False
kb.mergeCookies = None
kb.multiThreadMode = False
kb.negativeLogic = False
kb.nullConnection = None
kb.oldMsf = None
@@ -1879,7 +1874,6 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.reduceTests = None
kb.tlsSNI = {}
kb.stickyDBMS = False
kb.stickyLevel = None
kb.storeCrawlingChoice = None
kb.storeHashesChoice = None
kb.suppressResumeInfo = False
@@ -2133,9 +2127,9 @@ def _setDNSServer():
try:
conf.dnsServer = DNSServer()
conf.dnsServer.run()
except socket.error, msg:
except socket.error as ex:
errMsg = "there was an error while setting up "
errMsg += "DNS server instance ('%s')" % msg
errMsg += "DNS server instance ('%s')" % getSafeExString(ex)
raise SqlmapGenericException(errMsg)
else:
errMsg = "you need to run sqlmap as an administrator "
@@ -2303,7 +2297,7 @@ def _basicOptionValidation():
errMsg = "option '--not-string' is incompatible with switch '--null-connection'"
raise SqlmapSyntaxException(errMsg)
if conf.notString and conf.nullConnection:
if conf.tor and conf.osPwn:
errMsg = "option '--tor' is incompatible with switch '--os-pwn'"
raise SqlmapSyntaxException(errMsg)
@@ -2326,14 +2320,14 @@ def _basicOptionValidation():
if conf.regexp:
try:
re.compile(conf.regexp)
except Exception, ex:
except Exception as ex:
errMsg = "invalid regular expression '%s' ('%s')" % (conf.regexp, getSafeExString(ex))
raise SqlmapSyntaxException(errMsg)
if conf.crawlExclude:
try:
re.compile(conf.crawlExclude)
except Exception, ex:
except Exception as ex:
errMsg = "invalid regular expression '%s' ('%s')" % (conf.crawlExclude, getSafeExString(ex))
raise SqlmapSyntaxException(errMsg)
+3 -3
View File
@@ -9,7 +9,7 @@ import codecs
import os
import cProfile
from lib.core.common import getUnicode
from lib.core.common import getSafeExString
from lib.core.data import logger
from lib.core.data import paths
from lib.core.settings import UNICODE_ENCODING
@@ -25,8 +25,8 @@ def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
from thirdparty.xdot import xdot
import gtk
import pydot
except ImportError, e:
errMsg = "profiling requires third-party libraries ('%s') " % getUnicode(e, UNICODE_ENCODING)
except ImportError as ex:
errMsg = "profiling requires third-party libraries ('%s') " % getSafeExString(ex)
errMsg += "(Hint: 'sudo apt-get install python-pydot python-pyparsing python-profiler graphviz')"
logger.error(errMsg)
+3 -3
View File
@@ -27,7 +27,7 @@ class Replication(object):
self.connection = sqlite3.connect(dbpath)
self.connection.isolation_level = None
self.cursor = self.connection.cursor()
except sqlite3.OperationalError, ex:
except sqlite3.OperationalError as ex:
errMsg = "error occurred while opening a replication "
errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
@@ -63,7 +63,7 @@ class Replication(object):
self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s" %s' % (unsafeSQLIdentificatorNaming(colname), coltype) for colname, coltype in self.columns)))
else:
self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s"' % unsafeSQLIdentificatorNaming(colname) for colname in self.columns)))
except Exception, ex:
except Exception as ex:
errMsg = "problem occurred ('%s') while initializing the sqlite database " % getSafeExString(ex, UNICODE_ENCODING)
errMsg += "located at '%s'" % self.parent.dbpath
raise SqlmapGenericException(errMsg)
@@ -82,7 +82,7 @@ class Replication(object):
def execute(self, sql, parameters=[]):
try:
self.parent.cursor.execute(sql, parameters)
except sqlite3.OperationalError, ex:
except sqlite3.OperationalError as ex:
errMsg = "problem occurred ('%s') while accessing sqlite database " % getSafeExString(ex, UNICODE_ENCODING)
errMsg += "located at '%s'. Please make sure that " % self.parent.dbpath
errMsg += "it's not used by some other program"
+12 -9
View File
@@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3"
VERSION = "1.3.2.0"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -39,7 +39,7 @@ BANNER = """\033[01;33m\
___ ___[.]_____ ___ ___ \033[01;37m{\033[01;%dm%s\033[01;37m}\033[01;33m
|_ -| . [.] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V |_| \033[0m\033[4;37m%s\033[0m\n
|_|V... |_| \033[0m\033[4;37m%s\033[0m\n
""" % (TYPE_COLORS.get(TYPE, 31), VERSION_STRING.split('/')[-1], SITE)
# Minimum distance of ratio from kb.matchRatio to result in True
@@ -109,7 +109,7 @@ MAX_MURPHY_SLEEP_TIME = 3
GOOGLE_REGEX = r"webcache\.googleusercontent\.com/search\?q=cache:[^:]+:([^+]+)\+&amp;cd=|url\?\w+=((?![^>]+webcache\.googleusercontent\.com)http[^>]+)&(sa=U|rct=j)"
# Regular expression used for extracting results from DuckDuckGo search
DUCKDUCKGO_REGEX = r'"u":"([^"]+)'
DUCKDUCKGO_REGEX = r'<a class="result__url" href="(htt[^"]+)'
# Regular expression used for extracting results from Bing search
BING_REGEX = r'<h2><a href="([^"]+)" h='
@@ -166,6 +166,9 @@ MAX_TECHNIQUES_PER_VALUE = 2
# In case of missing piece of partial union dump, buffered array must be flushed after certain size
MAX_BUFFERED_PARTIAL_UNION_LENGTH = 1024
# Maximum size of cache used in @cachedmethod decorator
MAX_CACHE_ITEMS = 256
# Suffix used for naming meta databases in DBMS(es) without explicit database name
METADB_SUFFIX = "_masterdb"
@@ -231,7 +234,7 @@ PYVERSION = sys.version.split()[0]
# DBMS system databases
MSSQL_SYSTEM_DBS = ("Northwind", "master", "model", "msdb", "pubs", "tempdb")
MYSQL_SYSTEM_DBS = ("information_schema", "mysql", "performance_schema")
MYSQL_SYSTEM_DBS = ("information_schema", "mysql", "performance_schema", "sys")
PGSQL_SYSTEM_DBS = ("information_schema", "pg_catalog", "pg_toast", "pgagent")
ORACLE_SYSTEM_DBS = ('ANONYMOUS', 'APEX_030200', 'APEX_PUBLIC_USER', 'APPQOSSYS', 'BI', 'CTXSYS', 'DBSNMP', 'DIP', 'EXFSYS', 'FLOWS_%', 'FLOWS_FILES', 'HR', 'IX', 'LBACSYS', 'MDDATA', 'MDSYS', 'MGMT_VIEW', 'OC', 'OE', 'OLAPSYS', 'ORACLE_OCM', 'ORDDATA', 'ORDPLUGINS', 'ORDSYS', 'OUTLN', 'OWBSYS', 'PM', 'SCOTT', 'SH', 'SI_INFORMTN_SCHEMA', 'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'SYS', 'SYSMAN', 'SYSTEM', 'WKPROXY', 'WKSYS', 'WK_TEST', 'WMSYS', 'XDB', 'XS$NULL')
SQLITE_SYSTEM_DBS = ("sqlite_master", "sqlite_temp_master")
@@ -360,7 +363,7 @@ COMMON_PASSWORD_SUFFIXES += ("!", ".", "*", "!!", "?", ";", "..", "!!!", ", ", "
WEBSCARAB_SPLITTER = "### Conversation"
# Splitter used between requests in BURP log files
BURP_REQUEST_REGEX = r"={10,}\s+[^=]+={10,}\s(.+?)\s={10,}"
BURP_REQUEST_REGEX = r"={10,}\s+([A-Z]{3,} .+?)\s+={10,}"
# Regex used for parsing XML Burp saved history items
BURP_XML_HISTORY_REGEX = r'<port>(\d+)</port>.+?<request base64="true"><!\[CDATA\[([^]]+)'
@@ -526,9 +529,6 @@ BRUTE_TABLE_EXISTS_TEMPLATE = "EXISTS(SELECT %d FROM %s)"
# Template used for common column existence check
BRUTE_COLUMN_EXISTS_TEMPLATE = "EXISTS(SELECT %s FROM %s)"
# Payload used for checking of existence of IDS/IPS/WAF (dummier the better)
IDS_WAF_CHECK_PAYLOAD = "AND 1=1 UNION ALL SELECT 1,NULL,'<script>alert(\"XSS\")</script>',table_name FROM information_schema.tables WHERE 2>1--/**/; EXEC xp_cmdshell('cat ../../../etc/passwd')#"
# Data inside shellcodeexec to be filled with random string
SHELLCODEEXEC_RANDOM_STRING_MARKER = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
@@ -538,13 +538,16 @@ CHECK_INTERNET_ADDRESS = "https://ipinfo.io/"
# Value to look for in response to CHECK_INTERNET_ADDRESS
CHECK_INTERNET_VALUE = "IP Address Details"
# Payload used for checking of existence of WAF/IPS (dummier the better)
IPS_WAF_CHECK_PAYLOAD = "AND 1=1 UNION ALL SELECT 1,NULL,'<script>alert(\"XSS\")</script>',table_name FROM information_schema.tables WHERE 2>1--/**/; EXEC xp_cmdshell('cat ../../../etc/passwd')#"
# Vectors used for provoking specific WAF/IPS behavior(s)
WAF_ATTACK_VECTORS = (
"", # NIL
"search=<script>alert(1)</script>",
"file=../../../../etc/passwd",
"q=<invalid>foobar",
"id=1 %s" % IDS_WAF_CHECK_PAYLOAD
"id=1 %s" % IPS_WAF_CHECK_PAYLOAD
)
# Used for status representation in dictionary attack phase
+5 -4
View File
@@ -9,6 +9,7 @@ import atexit
import os
from lib.core import readlineng as readline
from lib.core.common import getSafeExString
from lib.core.data import logger
from lib.core.data import paths
from lib.core.enums import AUTOCOMPLETE_TYPE
@@ -75,8 +76,8 @@ def saveHistory(completion=None):
readline.set_history_length(MAX_HISTORY_LENGTH)
try:
readline.write_history_file(historyPath)
except IOError, msg:
warnMsg = "there was a problem writing the history file '%s' (%s)" % (historyPath, msg)
except IOError as ex:
warnMsg = "there was a problem writing the history file '%s' (%s)" % (historyPath, getSafeExString(ex))
logger.warn(warnMsg)
except KeyboardInterrupt:
pass
@@ -99,8 +100,8 @@ def loadHistory(completion=None):
if os.path.exists(historyPath):
try:
readline.read_history_file(historyPath)
except IOError, msg:
warnMsg = "there was a problem loading the history file '%s' (%s)" % (historyPath, msg)
except IOError as ex:
warnMsg = "there was a problem loading the history file '%s' (%s)" % (historyPath, getSafeExString(ex))
logger.warn(warnMsg)
def autoCompletion(completion=None, os=None, commands=None):
+8 -8
View File
@@ -31,7 +31,7 @@ def blockingReadFromFD(fd):
while True:
try:
output += os.read(fd, 8192)
except (OSError, IOError), ioe:
except (OSError, IOError) as ioe:
if ioe.args[0] in (errno.EAGAIN, errno.EINTR):
# Uncomment the following line if the process seems to
# take a huge amount of cpu time
@@ -52,7 +52,7 @@ def blockingWriteToFD(fd, data):
try:
data_length = len(data)
wrote_data = os.write(fd, data)
except (OSError, IOError), io:
except (OSError, IOError) as io:
if io.errno in (errno.EAGAIN, errno.EINTR):
continue
else:
@@ -95,8 +95,8 @@ class Popen(subprocess.Popen):
(errCode, written) = WriteFile(x, input)
except ValueError:
return self._close('stdin')
except (subprocess.pywintypes.error, Exception), why:
if why[0] in (109, errno.ESHUTDOWN):
except (subprocess.pywintypes.error, Exception) as ex:
if ex[0] in (109, errno.ESHUTDOWN):
return self._close('stdin')
raise
@@ -116,8 +116,8 @@ class Popen(subprocess.Popen):
(errCode, read) = ReadFile(x, nAvail, None)
except (ValueError, NameError):
return self._close(which)
except (subprocess.pywintypes.error, Exception), why:
if why[0] in (109, errno.ESHUTDOWN):
except (subprocess.pywintypes.error, Exception) as ex:
if ex[0] in (109, errno.ESHUTDOWN):
return self._close(which)
raise
@@ -134,8 +134,8 @@ class Popen(subprocess.Popen):
try:
written = os.write(self.stdin.fileno(), input)
except OSError, why:
if why[0] == errno.EPIPE: # broken pipe
except OSError as ex:
if ex[0] == errno.EPIPE: # broken pipe
return self._close('stdin')
raise
+12 -12
View File
@@ -427,8 +427,8 @@ def _setHashDB():
try:
os.remove(conf.hashDBFile)
logger.info("flushing session file")
except OSError, msg:
errMsg = "unable to flush the session file (%s)" % msg
except OSError as ex:
errMsg = "unable to flush the session file ('%s')" % getSafeExString(ex)
raise SqlmapFilePathException(errMsg)
conf.hashDB = HashDB(conf.hashDBFile)
@@ -558,7 +558,7 @@ def _setResultsFile():
conf.resultsFilename = os.path.join(paths.SQLMAP_OUTPUT_PATH, time.strftime(RESULTS_FILE_FORMAT).lower())
try:
conf.resultsFP = openFile(conf.resultsFilename, "a", UNICODE_ENCODING, buffering=0)
except (OSError, IOError), ex:
except (OSError, IOError) as ex:
try:
warnMsg = "unable to create results file '%s' ('%s'). " % (conf.resultsFilename, getUnicode(ex))
handle, conf.resultsFilename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.RESULTS, suffix=".csv")
@@ -566,7 +566,7 @@ def _setResultsFile():
conf.resultsFP = openFile(conf.resultsFilename, "w+", UNICODE_ENCODING, buffering=0)
warnMsg += "Using temporary file '%s' instead" % conf.resultsFilename
logger.warn(warnMsg)
except IOError, _:
except IOError as _:
errMsg = "unable to write to the temporary directory ('%s'). " % _
errMsg += "Please make sure that your disk is not full and "
errMsg += "that you have sufficient write permissions to "
@@ -590,7 +590,7 @@ def _createFilesDir():
if not os.path.isdir(conf.filePath):
try:
os.makedirs(conf.filePath)
except OSError, ex:
except OSError as ex:
tempDir = tempfile.mkdtemp(prefix="sqlmapfiles")
warnMsg = "unable to create files directory "
warnMsg += "'%s' (%s). " % (conf.filePath, getUnicode(ex))
@@ -612,7 +612,7 @@ def _createDumpDir():
if not os.path.isdir(conf.dumpPath):
try:
os.makedirs(conf.dumpPath)
except OSError, ex:
except OSError as ex:
tempDir = tempfile.mkdtemp(prefix="sqlmapdump")
warnMsg = "unable to create dump directory "
warnMsg += "'%s' (%s). " % (conf.dumpPath, getUnicode(ex))
@@ -643,10 +643,10 @@ def _createTargetDirs():
if conf.outputDir and context == "output":
warnMsg = "using '%s' as the %s directory" % (directory, context)
logger.warn(warnMsg)
except (OSError, IOError), ex:
except (OSError, IOError) as ex:
try:
tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context)
except Exception, _:
except Exception as _:
errMsg = "unable to write to the temporary directory ('%s'). " % _
errMsg += "Please make sure that your disk is not full and "
errMsg += "that you have sufficient write permissions to "
@@ -665,10 +665,10 @@ def _createTargetDirs():
try:
if not os.path.isdir(conf.outputPath):
os.makedirs(conf.outputPath)
except (OSError, IOError, TypeError), ex:
except (OSError, IOError, TypeError) as ex:
try:
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
except Exception, _:
except Exception as _:
errMsg = "unable to write to the temporary directory ('%s'). " % _
errMsg += "Please make sure that your disk is not full and "
errMsg += "that you have sufficient write permissions to "
@@ -691,7 +691,7 @@ def _createTargetDirs():
f.write(" # %s" % getUnicode(subprocess.list2cmdline(sys.argv), encoding=sys.stdin.encoding))
if conf.data:
f.write("\n\n%s" % getUnicode(conf.data))
except IOError, ex:
except IOError as ex:
if "denied" in getUnicode(ex):
errMsg = "you don't have enough permissions "
else:
@@ -767,4 +767,4 @@ def setupTargetEnv():
_resumeHashDBValues()
_setResultsFile()
_setAuthCred()
_setAuxOptions()
_setAuxOptions()
+35 -35
View File
@@ -54,42 +54,42 @@ def smokeTest():
if not checkIntegrity():
retVal = False
else:
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
if any(_ in root for _ in ("thirdparty", "extra")):
continue
for filename in files:
if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py":
length += 1
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
if any(_ in root for _ in ("thirdparty", "extra")):
continue
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
if any(_ in root for _ in ("thirdparty", "extra")):
continue
for filename in files:
if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py":
length += 1
for filename in files:
if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py":
path = os.path.join(root, os.path.splitext(filename)[0])
path = path.replace(paths.SQLMAP_ROOT_PATH, '.')
path = path.replace(os.sep, '.').lstrip('.')
try:
__import__(path)
module = sys.modules[path]
except Exception, msg:
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
if any(_ in root for _ in ("thirdparty", "extra")):
continue
for filename in files:
if os.path.splitext(filename)[1].lower() == ".py" and filename != "__init__.py":
path = os.path.join(root, os.path.splitext(filename)[0])
path = path.replace(paths.SQLMAP_ROOT_PATH, '.')
path = path.replace(os.sep, '.').lstrip('.')
try:
__import__(path)
module = sys.modules[path]
except Exception as ex:
retVal = False
dataToStdout("\r")
errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), ex)
logger.error(errMsg)
else:
# Run doc tests
# Reference: http://docs.python.org/library/doctest.html
(failure_count, test_count) = doctest.testmod(module)
if failure_count > 0:
retVal = False
dataToStdout("\r")
errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(root, filename), msg)
logger.error(errMsg)
else:
# Run doc tests
# Reference: http://docs.python.org/library/doctest.html
(failure_count, test_count) = doctest.testmod(module)
if failure_count > 0:
retVal = False
count += 1
status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length))
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
count += 1
status = '%d/%d (%d%%) ' % (count, length, round(100.0 * count / length))
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
clearConsoleLine()
if retVal:
@@ -275,10 +275,10 @@ def runCase(parse):
result = start()
except KeyboardInterrupt:
pass
except SqlmapBaseException, e:
handled_exception = e
except Exception, e:
unhandled_exception = e
except SqlmapBaseException as ex:
handled_exception = ex
except Exception as ex:
unhandled_exception = ex
finally:
sys.stdout.seek(0)
console = sys.stdout.read()
+9 -9
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import difflib
import random
import threading
@@ -91,7 +93,7 @@ def exceptionHandledFunction(threadFunction, silent=False):
kb.threadContinue = False
kb.threadException = True
raise
except Exception, ex:
except Exception as ex:
if not silent and kb.get("threadContinue"):
logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
@@ -108,7 +110,6 @@ def setDaemon(thread):
def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardException=True, threadChoice=False, startThreadMsg=True):
threads = []
kb.multiThreadMode = True
kb.threadContinue = True
kb.threadException = False
@@ -150,7 +151,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
try:
thread.start()
except Exception, ex:
except Exception as ex:
errMsg = "error occurred while starting new thread ('%s')" % ex.message
logger.critical(errMsg)
break
@@ -166,8 +167,8 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
alive = True
time.sleep(0.1)
except (KeyboardInterrupt, SqlmapUserQuitException), ex:
print
except (KeyboardInterrupt, SqlmapUserQuitException) as ex:
print()
kb.prependFlag = False
kb.threadContinue = False
kb.threadException = True
@@ -184,8 +185,8 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
if forwardException:
raise
except (SqlmapConnectionException, SqlmapValueException), ex:
print
except (SqlmapConnectionException, SqlmapValueException) as ex:
print()
kb.threadException = True
logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message))
@@ -195,14 +196,13 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
except:
from lib.core.common import unhandledExceptionMessage
print
print()
kb.threadException = True
errMsg = unhandledExceptionMessage()
logger.error("thread %s: %s" % (threading.currentThread().getName(), errMsg))
traceback.print_exc()
finally:
kb.multiThreadMode = False
kb.bruteMode = False
kb.threadContinue = True
kb.threadException = False
+4 -4
View File
@@ -51,7 +51,7 @@ def update():
try:
open(os.path.join(directory, "sqlmap.py"), "w+b")
except Exception, ex:
except Exception as ex:
errMsg = "unable to update content of directory '%s' ('%s')" % (directory, getSafeExString(ex))
logger.error(errMsg)
else:
@@ -85,7 +85,7 @@ def update():
version = re.search(r"(?m)^VERSION\s*=\s*['\"]([^'\"]+)", f.read()).group(1)
logger.info("updated to the latest version '%s#dev'" % version)
success = True
except Exception, ex:
except Exception as ex:
logger.error("update could not be completed ('%s')" % getSafeExString(ex))
else:
if not success:
@@ -103,14 +103,14 @@ def update():
debugMsg = "sqlmap will try to update itself using 'git' command"
logger.debug(debugMsg)
dataToStdout("\r[%s] [INFO] update in progress " % time.strftime("%X"))
dataToStdout("\r[%s] [INFO] update in progress" % time.strftime("%X"))
try:
process = subprocess.Popen("git checkout . && git pull %s HEAD" % GIT_REPOSITORY, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=paths.SQLMAP_ROOT_PATH.encode(sys.getfilesystemencoding() or UNICODE_ENCODING))
pollProcess(process, True)
stdout, stderr = process.communicate()
success = not process.returncode
except (IOError, OSError), ex:
except (IOError, OSError) as ex:
success = False
stderr = getSafeExString(ex)
+4 -4
View File
@@ -43,7 +43,7 @@ class Wordlist(object):
if os.path.splitext(self.current)[1].lower() == ".zip":
try:
_ = zipfile.ZipFile(self.current, 'r')
except zipfile.error, ex:
except zipfile.error as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
@@ -68,15 +68,15 @@ class Wordlist(object):
while True:
self.counter += 1
try:
retVal = self.iter.next().rstrip()
except zipfile.error, ex:
retVal = next(self.iter).rstrip()
except zipfile.error as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
raise SqlmapInstallationException(errMsg)
except StopIteration:
self.adjust()
retVal = self.iter.next().rstrip()
retVal = next(self.iter).rstrip()
if not self.proc_count or self.counter % self.proc_count == self.proc_id:
break
return retVal
+8 -6
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import re
import shlex
@@ -792,7 +794,7 @@ def cmdLineParser(argv=None):
command = raw_input("sqlmap-shell> ").strip()
command = getUnicode(command, encoding=sys.stdin.encoding)
except (KeyboardInterrupt, EOFError):
print
print()
raise SqlmapShellQuitException
if not command:
@@ -814,7 +816,7 @@ def cmdLineParser(argv=None):
try:
for arg in shlex.split(command):
argv.append(getUnicode(arg, encoding=sys.stdin.encoding))
except ValueError, ex:
except ValueError as ex:
raise SqlmapSyntaxException("something went wrong during command line parsing ('%s')" % ex.message)
for i in xrange(len(argv)):
@@ -842,7 +844,7 @@ def cmdLineParser(argv=None):
argv[i] = argv[i][:-1]
conf.skipThreadCheck = True
elif argv[i] == "--version":
print VERSION_STRING.split('/')[-1]
print(VERSION_STRING.split('/')[-1])
raise SystemExit
elif argv[i] in ("-h", "--help"):
advancedHelp = False
@@ -866,7 +868,7 @@ def cmdLineParser(argv=None):
try:
(args, _) = parser.parse_args(argv)
except UnicodeEncodeError, ex:
except UnicodeEncodeError as ex:
dataToStdout("\n[!] %s\n" % ex.object.encode("unicode-escape"))
raise SystemExit
except SystemExit:
@@ -895,8 +897,8 @@ def cmdLineParser(argv=None):
return args
except (OptionError, TypeError), e:
parser.error(e)
except (OptionError, TypeError) as ex:
parser.error(ex)
except SystemExit:
# Protection against Windows dummy double clicking
+2 -2
View File
@@ -39,7 +39,7 @@ def configFileProxy(section, option, datatype):
value = config.getfloat(section, option) if config.get(section, option) else 0.0
else:
value = config.get(section, option)
except ValueError, ex:
except ValueError as ex:
errMsg = "error occurred while processing the option "
errMsg += "'%s' in provided configuration file ('%s')" % (option, getUnicode(ex))
raise SqlmapSyntaxException(errMsg)
@@ -71,7 +71,7 @@ def configFileParser(configFile):
try:
config = UnicodeRawConfigParser()
config.readfp(configFP)
except Exception, ex:
except Exception as ex:
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getSafeExString(ex)
raise SqlmapSyntaxException(errMsg)
+1 -1
View File
@@ -35,7 +35,7 @@ class FingerprintHandler(ContentHandler):
if key == "dbmsVersion":
self._info[key] = value
else:
if key not in self._info.keys():
if key not in self._info:
self._info[key] = set()
for _ in value.split("|"):
+2 -2
View File
@@ -78,7 +78,7 @@ def parseXmlNode(node):
def loadBoundaries():
try:
doc = et.parse(paths.BOUNDARIES_XML)
except Exception, ex:
except Exception as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (paths.BOUNDARIES_XML, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
@@ -93,7 +93,7 @@ def loadPayloads():
try:
doc = et.parse(payloadFilePath)
except Exception, ex:
except Exception as ex:
errMsg = "something appears to be wrong with "
errMsg += "the file '%s' ('%s'). Please make " % (payloadFilePath, getSafeExString(ex))
errMsg += "sure that you haven't made any changes to it"
+4 -3
View File
@@ -17,6 +17,7 @@ from lib.core.common import Backend
from lib.core.common import extractErrorMessage
from lib.core.common import extractRegexResult
from lib.core.common import getPublicTypeMembers
from lib.core.common import getSafeExString
from lib.core.common import getUnicode
from lib.core.common import isListLike
from lib.core.common import randomStr
@@ -56,7 +57,7 @@ def forgeHeaders(items=None, base=None):
items = items or {}
for _ in items.keys():
for _ in list(items.keys()):
if items[_] is None:
del items[_]
@@ -280,10 +281,10 @@ def decodePage(page, contentEncoding, contentType):
raise Exception("size too large")
page = data.read()
except Exception, msg:
except Exception as ex:
if "<html" not in page: # in some cases, invalid "Content-Encoding" appears for plain HTML (should be ignored)
errMsg = "detected invalid data for declared content "
errMsg += "encoding '%s' ('%s')" % (contentEncoding, msg)
errMsg += "encoding '%s' ('%s')" % (contentEncoding, getSafeExString(ex))
singleTimeLogMessage(errMsg, logging.ERROR)
warnMsg = "turning off page compression"
+15 -13
View File
@@ -44,6 +44,7 @@ from lib.core.common import getHostHeader
from lib.core.common import getRequestHeader
from lib.core.common import getSafeExString
from lib.core.common import getUnicode
from lib.core.common import isMultiThreadMode
from lib.core.common import logHTTPTraffic
from lib.core.common import pushValue
from lib.core.common import popValue
@@ -102,7 +103,7 @@ from lib.core.settings import MAX_MURPHY_SLEEP_TIME
from lib.core.settings import META_REFRESH_REGEX
from lib.core.settings import MIN_TIME_RESPONSES
from lib.core.settings import MAX_TIME_RESPONSES
from lib.core.settings import IDS_WAF_CHECK_PAYLOAD
from lib.core.settings import IPS_WAF_CHECK_PAYLOAD
from lib.core.settings import IS_WIN
from lib.core.settings import LARGE_CHUNK_TRIM_MARKER
from lib.core.settings import PAYLOAD_DELIMITER
@@ -270,6 +271,7 @@ class Connect(object):
crawling = kwargs.get("crawling", False)
checking = kwargs.get("checking", False)
skipRead = kwargs.get("skipRead", False)
finalCode = kwargs.get("finalCode", False)
if multipart:
post = multipart
@@ -496,7 +498,7 @@ class Connect(object):
if hasattr(conn, "redurl"):
page = (threadData.lastRedirectMsg[1] if kb.redirectChoice == REDIRECTION.NO else Connect._connReadProxy(conn)) if not skipRead else None
skipLogTraffic = kb.redirectChoice == REDIRECTION.NO
code = conn.redcode
code = conn.redcode if not finalCode else code
else:
page = Connect._connReadProxy(conn) if not skipRead else None
@@ -555,11 +557,11 @@ class Connect(object):
if hasattr(conn.fp, '_sock'):
conn.fp._sock.close()
conn.close()
except Exception, ex:
except Exception as ex:
warnMsg = "problem occurred during connection closing ('%s')" % getSafeExString(ex)
logger.warn(warnMsg)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
if conf.proxyList and not kb.threadException:
warnMsg = "unable to connect to the target URL ('%s')" % ex
logger.critical(warnMsg)
@@ -568,7 +570,7 @@ class Connect(object):
else:
raise
except urllib2.HTTPError, ex:
except urllib2.HTTPError as ex:
page = None
responseHeaders = None
@@ -730,7 +732,7 @@ class Connect(object):
else:
logger.debug(warnMsg)
return Connect._retryProxy(**kwargs)
elif kb.testMode or kb.multiThreadMode:
elif kb.testMode or isMultiThreadMode():
logger.critical(warnMsg)
return None, None, None
else:
@@ -816,7 +818,7 @@ class Connect(object):
if conf.httpHeaders:
headers = OrderedDict(conf.httpHeaders)
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers.keys())
contentType = max(headers[_] if _.upper() == HTTP_HEADER.CONTENT_TYPE.upper() else None for _ in headers)
if (kb.postHint or conf.skipUrlEncode) and postUrlEncode:
postUrlEncode = False
@@ -833,7 +835,7 @@ class Connect(object):
try:
payload = function(payload=payload, headers=auxHeaders, delimiter=delimiter, hints=hints)
except Exception, ex:
except Exception as ex:
errMsg = "error occurred while running tamper "
errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex))
raise SqlmapGenericException(errMsg)
@@ -1096,7 +1098,7 @@ class Connect(object):
while True:
try:
compiler.parse(unicodeencode(conf.evalCode.replace(';', '\n')))
except SyntaxError, ex:
except SyntaxError as ex:
if ex.text:
original = replacement = ex.text.strip()
if '=' in original:
@@ -1124,7 +1126,7 @@ class Connect(object):
originals.update(variables)
evaluateCode(conf.evalCode, variables)
for variable in variables.keys():
for variable in list(variables.keys()):
if variable.endswith(EVALCODE_KEYWORD_SUFFIX):
value = variables[variable]
del variables[variable]
@@ -1282,7 +1284,7 @@ class Connect(object):
if conf.secondUrl:
page, headers, code = Connect.getPage(url=conf.secondUrl, cookie=cookie, ua=ua, silent=silent, auxHeaders=auxHeaders, response=response, raise404=False, ignoreTimeout=timeBasedCompare, refreshing=True)
elif kb.secondReq and IDS_WAF_CHECK_PAYLOAD not in urllib.unquote(value or ""):
elif kb.secondReq and IPS_WAF_CHECK_PAYLOAD not in urllib.unquote(value or ""):
def _(value):
if kb.customInjectionMark in (value or ""):
if payload is None:
@@ -1306,8 +1308,8 @@ class Connect(object):
elif noteResponseTime:
kb.responseTimes.setdefault(kb.responseTimeMode, [])
kb.responseTimes[kb.responseTimeMode].append(threadData.lastQueryDuration)
if len(kb.responseTimes) > MAX_TIME_RESPONSES:
kb.responseTimes = kb.responseTimes[-MAX_TIME_RESPONSES:]
if len(kb.responseTimes[kb.responseTimeMode]) > MAX_TIME_RESPONSES:
kb.responseTimes[kb.responseTimeMode] = kb.responseTimes[kb.responseTimeMode][-MAX_TIME_RESPONSES // 2:]
if not response and removeReflection:
page = removeReflectiveValues(page, payload)
+5 -3
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import re
import socket
@@ -145,13 +147,13 @@ if __name__ == "__main__":
if _ is None:
break
else:
print "[i] %s" % _
print("[i] %s" % _)
time.sleep(1)
except socket.error, ex:
except socket.error as ex:
if 'Permission' in str(ex):
print "[x] Please run with sudo/Administrator privileges"
print("[x] Please run with sudo/Administrator privileges")
else:
raise
except KeyboardInterrupt:
+2 -2
View File
@@ -63,7 +63,7 @@ class HTTPSConnection(httplib.HTTPSConnection):
break
else:
sock.close()
except (ssl.SSLError, socket.error, httplib.BadStatusLine), ex:
except (ssl.SSLError, socket.error, httplib.BadStatusLine) as ex:
self._tunnel_host = None
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
@@ -83,7 +83,7 @@ class HTTPSConnection(httplib.HTTPSConnection):
break
else:
sock.close()
except (ssl.SSLError, socket.error, httplib.BadStatusLine), ex:
except (ssl.SSLError, socket.error, httplib.BadStatusLine) as ex:
self._tunnel_host = None
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
+3 -1
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import re
import time
@@ -277,7 +279,7 @@ def _goInferenceProxy(expression, fromUser=False, batch=False, unpack=True, char
raise SqlmapDataException(errMsg)
except KeyboardInterrupt:
print
print()
warnMsg = "user aborted during dumping phase"
logger.warn(warnMsg)
+1 -1
View File
@@ -24,7 +24,7 @@ class HTTPSPKIAuthHandler(urllib2.HTTPSHandler):
try:
# Reference: https://docs.python.org/2/library/ssl.html#ssl.SSLContext.load_cert_chain
return httplib.HTTPSConnection(host, cert_file=self.auth_file, key_file=self.auth_file, timeout=conf.timeout)
except IOError, ex:
except IOError as ex:
errMsg = "error occurred while using key "
errMsg += "file '%s' ('%s')" % (self.auth_file, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
+6 -5
View File
@@ -16,6 +16,7 @@ from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.common import getHostHeader
from lib.core.common import getSafeExString
from lib.core.common import getUnicode
from lib.core.common import logHTTPTraffic
from lib.core.common import readInput
@@ -75,9 +76,9 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
try:
content = fp.read(MAX_CONNECTION_TOTAL_SIZE)
except Exception, msg:
except Exception as ex:
dbgMsg = "there was a problem while retrieving "
dbgMsg += "redirect response content (%s)" % msg
dbgMsg += "redirect response content ('%s')" % getSafeExString(ex)
logger.debug(dbgMsg)
finally:
if content:
@@ -140,8 +141,8 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
try:
result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
except urllib2.HTTPError, e:
result = e
except urllib2.HTTPError as ex:
result = ex
# Dirty hack for http://bugs.python.org/issue15701
try:
@@ -153,7 +154,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
if not hasattr(result, "read"):
def _(self, length=None):
return e.msg
return ex.msg
result.read = types.MethodType(_, result)
if not getattr(result, "url", None):
+4 -2
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import sys
from extra.safe2bin.safe2bin import safechardecode
@@ -129,11 +131,11 @@ class Abstraction(Web, UDF, XP_cmdshell):
command = raw_input("os-shell> ")
command = getUnicode(command, encoding=sys.stdin.encoding)
except KeyboardInterrupt:
print
print()
errMsg = "user aborted"
logger.error(errMsg)
except EOFError:
print
print()
errMsg = "exit"
logger.error(errMsg)
break
+4 -2
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import re
import select
@@ -483,7 +485,7 @@ class Metasploit:
send_all(proc, "getuid\n")
if conf.privEsc:
print
print()
infoMsg = "trying to escalate privileges using Meterpreter "
infoMsg += "'getsystem' command which tries different "
@@ -619,7 +621,7 @@ class Metasploit:
payloadSize = int(match.group(2))
if extra == "BufferRegister=EAX":
payloadSize = payloadSize / 2
payloadSize = payloadSize // 2
debugMsg = "the shellcode size is %d bytes" % payloadSize
logger.debug(debugMsg)
-1
View File
@@ -645,7 +645,6 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
abortedFlag = True
finally:
kb.prependFlag = False
kb.stickyLevel = None
retrievedLength = len(finalValue or "")
if finalValue is not None:
+1 -1
View File
@@ -57,7 +57,7 @@ def dnsUse(payload, expression):
while True:
count += 1
prefix, suffix = ("%s" % randomStr(length=3, alphabet=DNS_BOUNDARIES_ALPHABET) for _ in xrange(2))
chunk_length = MAX_DNS_LABEL / 2 if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.MYSQL, DBMS.PGSQL) else MAX_DNS_LABEL / 4 - 2
chunk_length = MAX_DNS_LABEL // 2 if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.MYSQL, DBMS.PGSQL) else MAX_DNS_LABEL // 4 - 2
_, _, _, _, _, _, fieldToCastStr, _ = agent.getFields(expression)
nulledCastedField = agent.nullAndCastField(fieldToCastStr)
extendedField = re.search(r"[^ ,]*%s[^ ,]*" % re.escape(fieldToCastStr), expression).group(0)
+5 -3
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import re
import time
@@ -92,7 +94,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
candidate = len(result) - len(kb.chars.stop)
current = candidate if candidate != current else current - 1
else:
current = current / 2
current = current // 2
if kb.errorChunkLength:
hashDBWrite(HASHDB_KEYS.KB_ERROR_CHUNK_LENGTH, kb.errorChunkLength)
@@ -242,7 +244,7 @@ def _errorFields(expression, expressionFields, expressionFieldsList, num=None, e
if not suppressOutput:
if kb.fileReadMode and output and output.strip():
print
print()
elif output is not None and not (threadData.resumed and kb.suppressResumeInfo) and not (emptyFields and field in emptyFields):
status = "[%s] [INFO] %s: '%s'" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", output if kb.safeCharEncode else safecharencode(output))
@@ -403,7 +405,7 @@ def errorUse(expression, dump=False):
with kb.locks.limit:
try:
threadData.shared.counter += 1
num = threadData.shared.limits.next()
num = next(threadData.shared.limits)
except StopIteration:
break
+1 -1
View File
@@ -74,7 +74,7 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
highCols += ORDER_BY_STEP
else:
while not found:
mid = highCols - (highCols - lowCols) / 2
mid = highCols - (highCols - lowCols) // 2
if _orderByTest(mid):
lowCols = mid
else:
+1 -1
View File
@@ -313,7 +313,7 @@ def unionUse(expression, unpack=True, dump=False):
with kb.locks.limit:
try:
threadData.shared.counter += 1
num = threadData.shared.limits.next()
num = next(threadData.shared.limits)
except StopIteration:
break
+9 -7
View File
@@ -6,6 +6,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import contextlib
import httplib
import logging
@@ -95,7 +97,7 @@ class Database(object):
self.cursor.execute(statement, arguments)
else:
self.cursor.execute(statement)
except sqlite3.OperationalError, ex:
except sqlite3.OperationalError as ex:
if "locked" not in getSafeExString(ex):
raise
else:
@@ -266,7 +268,7 @@ def setRestAPILog():
try:
conf.databaseCursor = Database(conf.database)
conf.databaseCursor.connect("client")
except sqlite3.OperationalError, ex:
except sqlite3.OperationalError as ex:
raise SqlmapConnectionException("%s ('%s')" % (ex, conf.database))
# Set a logging handler that writes log messages to a IPC database
@@ -689,7 +691,7 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
eventlet.monkey_patch()
logger.debug("Using adapter '%s' to run bottle" % adapter)
run(host=host, port=port, quiet=True, debug=True, server=adapter)
except socket.error, ex:
except socket.error as ex:
if "already in use" in getSafeExString(ex):
logger.error("Address already in use ('%s:%s')" % (host, port))
else:
@@ -697,7 +699,7 @@ def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=REST
except ImportError:
if adapter.lower() not in server_names:
errMsg = "Adapter '%s' is unknown. " % adapter
errMsg += "List of supported adapters: %s" % ', '.join(sorted(server_names.keys()))
errMsg += "List of supported adapters: %s" % ', '.join(sorted(list(server_names.keys())))
else:
errMsg = "Server support for adapter '%s' is not installed on this system " % adapter
errMsg += "(Note: you can try to install it with 'sudo apt-get install python-%s' or 'sudo pip install %s')" % (adapter, adapter)
@@ -743,7 +745,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
try:
_client(addr)
except Exception, ex:
except Exception as ex:
if not isinstance(ex, urllib2.HTTPError) or ex.code == httplib.UNAUTHORIZED:
errMsg = "There has been a problem while connecting to the "
errMsg += "REST-JSON API server at '%s' " % addr
@@ -762,7 +764,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
command = raw_input("api%s> " % (" (%s)" % taskid if taskid else "")).strip()
command = re.sub(r"\A(\w+)", lambda match: match.group(1).lower(), command)
except (EOFError, KeyboardInterrupt):
print
print()
break
if command in ("data", "log", "status", "stop", "kill"):
@@ -798,7 +800,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
try:
argv = ["sqlmap.py"] + shlex.split(command)[1:]
except Exception, ex:
except Exception as ex:
logger.error("Error occurred while parsing arguments ('%s')" % ex)
taskid = None
continue
+3 -3
View File
@@ -63,14 +63,14 @@ def crawl(target):
try:
if current:
content = Request.getPage(url=current, crawling=True, raise404=False)[0]
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
errMsg = "connection exception detected ('%s'). skipping " % getSafeExString(ex)
errMsg += "URL '%s'" % current
logger.critical(errMsg)
except SqlmapSyntaxException:
errMsg = "invalid URL detected. skipping '%s'" % current
logger.critical(errMsg)
except httplib.InvalidURL, ex:
except httplib.InvalidURL as ex:
errMsg = "invalid URL detected ('%s'). skipping " % getSafeExString(ex)
errMsg += "URL '%s'" % current
logger.critical(errMsg)
@@ -138,7 +138,7 @@ def crawl(target):
url = urlparse.urljoin(target, "/sitemap.xml")
try:
items = parseSitemap(url)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
if "page not found" in getSafeExString(ex):
found = False
logger.warn("'sitemap.xml' not found")
+13 -11
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
try:
from crypt import crypt
except: # removed ImportError because of https://github.com/sqlmapproject/sqlmap/issues/3171
@@ -19,7 +21,7 @@ try:
# problems with ctypes (Reference: https://github.com/sqlmapproject/sqlmap/issues/2952)
_ = multiprocessing.Value('i')
except (ImportError, OSError):
except (ImportError, OSError, AttributeError):
pass
else:
try:
@@ -599,7 +601,7 @@ def attackCachedUsersPasswords():
for (_, hash_, password) in results:
lut[hash_.lower()] = password
for user in kb.data.cachedUsersPasswords.keys():
for user in kb.data.cachedUsersPasswords:
for i in xrange(len(kb.data.cachedUsersPasswords[user])):
if (kb.data.cachedUsersPasswords[user][i] or "").strip():
value = kb.data.cachedUsersPasswords[user][i].lower().split()[0]
@@ -609,7 +611,7 @@ def attackCachedUsersPasswords():
def attackDumpedTable():
if kb.data.dumpedTable:
table = kb.data.dumpedTable
columns = table.keys()
columns = list(table.keys())
count = table["__infos__"]["count"]
if not count:
@@ -770,8 +772,8 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc
except (UnicodeEncodeError, UnicodeDecodeError):
pass # ignore possible encoding problems caused by some words in custom dictionaries
except Exception, e:
warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e)
except Exception as ex:
warnMsg = "there was a problem while hashing entry: %s ('%s'). " % (repr(word), getSafeExString(ex))
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
logger.critical(warnMsg)
@@ -847,8 +849,8 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
except (UnicodeEncodeError, UnicodeDecodeError):
pass # ignore possible encoding problems caused by some words in custom dictionaries
except Exception, e:
warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e)
except Exception as ex:
warnMsg = "there was a problem while hashing entry: %s ('%s'). " % (repr(word), getSafeExString(ex))
warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS
logger.critical(warnMsg)
@@ -983,7 +985,7 @@ def dictionaryAttack(attack_dict):
else:
logger.info("using default dictionary")
dictPaths = filter(None, dictPaths)
dictPaths = [_ for _ in dictPaths if _]
for dictPath in dictPaths:
checkFile(dictPath)
@@ -998,7 +1000,7 @@ def dictionaryAttack(attack_dict):
kb.wordlists = dictPaths
except Exception, ex:
except Exception as ex:
warnMsg = "there was a problem while loading dictionaries"
warnMsg += " ('%s')" % getSafeExString(ex)
logger.critical(warnMsg)
@@ -1061,7 +1063,7 @@ def dictionaryAttack(attack_dict):
_bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, 0, 1, kb.wordlists, custom_wordlist, conf.api)
except KeyboardInterrupt:
print
print()
processException = True
warnMsg = "user aborted during dictionary-based attack phase (Ctrl+C was pressed)"
logger.warn(warnMsg)
@@ -1157,7 +1159,7 @@ def dictionaryAttack(attack_dict):
found = found_.value
except KeyboardInterrupt:
print
print()
processException = True
warnMsg = "user aborted during dictionary-based attack phase (Ctrl+C was pressed)"
logger.warn(warnMsg)
+6 -8
View File
@@ -41,7 +41,7 @@ class HashDB(object):
threadData.hashDBCursor = connection.cursor()
threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)")
connection.commit()
except Exception, ex:
except Exception as ex:
errMsg = "error occurred while opening a session "
errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
@@ -81,18 +81,16 @@ class HashDB(object):
try:
for row in self.cursor.execute("SELECT value FROM storage WHERE id=?", (hash_,)):
retVal = row[0]
except sqlite3.OperationalError, ex:
except (sqlite3.OperationalError, sqlite3.DatabaseError) as ex:
if any(_ in getSafeExString(ex) for _ in ("locked", "no such table")):
warnMsg = "problem occurred while accessing session file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
singleTimeWarnMessage(warnMsg)
elif "Could not decode" in getSafeExString(ex):
break
else:
raise
except sqlite3.DatabaseError, ex:
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
errMsg += "If the problem persists please rerun with '--flush-session'"
raise SqlmapConnectionException(errMsg)
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
errMsg += "If the problem persists please rerun with '--flush-session'"
raise SqlmapConnectionException(errMsg)
else:
break
@@ -141,7 +139,7 @@ class HashDB(object):
self.cursor.execute("INSERT INTO storage VALUES (?, ?)", (hash_, value,))
except sqlite3.IntegrityError:
self.cursor.execute("UPDATE storage SET value=? WHERE id=?", (value, hash_,))
except sqlite3.DatabaseError, ex:
except sqlite3.DatabaseError as ex:
if not os.path.exists(self.filepath):
debugMsg = "session file '%s' does not exist" % self.filepath
logger.debug(debugMsg)
+1 -1
View File
@@ -175,7 +175,7 @@ def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
warnMsg += "will display partial output"
logger.warn(warnMsg)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
errMsg = "connection exception detected ('%s'). sqlmap " % getSafeExString(ex)
errMsg += "will display partial output"
+1 -1
View File
@@ -29,7 +29,7 @@ class ProgressBar(object):
def _convertSeconds(self, value):
seconds = value
minutes = seconds / 60
minutes = seconds // 60
seconds = seconds - (minutes * 60)
return "%.2d:%.2d" % (minutes, seconds)
+1 -1
View File
@@ -79,5 +79,5 @@ def purge(directory):
try:
shutil.rmtree(directory)
except OSError, ex:
except OSError as ex:
logger.error("problem occurred while removing directory '%s' ('%s')" % (directory, getSafeExString(ex)))
+24 -13
View File
@@ -45,6 +45,7 @@ def _search(dork):
if not dork:
return None
data = None
headers = {}
headers[HTTP_HEADER.USER_AGENT] = dict(conf.httpHeaders).get(HTTP_HEADER.USER_AGENT, DUMMY_SEARCH_USER_AGENT)
@@ -53,7 +54,7 @@ def _search(dork):
try:
req = urllib2.Request("https://www.google.com/ncr", headers=headers)
conn = urllib2.urlopen(req)
except Exception, ex:
except Exception as ex:
errMsg = "unable to connect to Google ('%s')" % getSafeExString(ex)
raise SqlmapConnectionException(errMsg)
@@ -87,12 +88,12 @@ def _search(dork):
responseMsg += "%s\n%s\n" % (responseHeaders, page)
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, responseMsg)
except urllib2.HTTPError, e:
except urllib2.HTTPError as ex:
try:
page = e.read()
except Exception, ex:
page = ex.read()
except Exception as _:
warnMsg = "problem occurred while trying to get "
warnMsg += "an error page information (%s)" % getSafeExString(ex)
warnMsg += "an error page information (%s)" % getSafeExString(_)
logger.critical(warnMsg)
return None
except (urllib2.URLError, httplib.error, socket.error, socket.timeout, socks.ProxyError):
@@ -123,12 +124,12 @@ def _search(dork):
url = "https://www.bing.com/search?q=%s&first=%d" % (urlencode(dork, convall=True), (gpage - 1) * 10 + 1)
regex = BING_REGEX
else:
url = "https://duckduckgo.com/d.js?"
url += "q=%s&p=%d&s=100" % (urlencode(dork, convall=True), gpage)
url = "https://duckduckgo.com/html/"
data = "q=%s&s=%d" % (urlencode(dork, convall=True), (gpage - 1) * 30)
regex = DUCKDUCKGO_REGEX
try:
req = urllib2.Request(url, headers=headers)
req = urllib2.Request(url, data=data, headers=headers)
conn = urllib2.urlopen(req)
requestMsg = "HTTP request:\nGET %s" % url
@@ -149,19 +150,29 @@ def _search(dork):
responseMsg += "%s\n%s\n" % (responseHeaders, page)
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, responseMsg)
except urllib2.HTTPError, e:
except urllib2.HTTPError as ex:
try:
page = e.read()
page = ex.read()
page = decodePage(page, ex.headers.get("Content-Encoding"), ex.headers.get("Content-Type"))
except socket.timeout:
warnMsg = "connection timed out while trying "
warnMsg += "to get error page information (%d)" % e.code
warnMsg += "to get error page information (%d)" % ex.code
logger.critical(warnMsg)
return None
except:
errMsg = "unable to connect"
raise SqlmapConnectionException(errMsg)
retVal = [urllib.unquote(match.group(1)) for match in re.finditer(regex, page, re.I | re.S)]
retVal = [urllib.unquote(match.group(1).replace("&amp;", "&")) for match in re.finditer(regex, page, re.I | re.S)]
if not retVal and "issue with the Tor Exit Node you are currently using" in page:
warnMsg = "DuckDuckGo has detected 'unusual' traffic from "
warnMsg += "used (Tor) IP address"
if conf.proxyList:
raise SqlmapBaseException(warnMsg)
else:
logger.critical(warnMsg)
return retVal
@@ -172,7 +183,7 @@ def search(dork):
try:
return _search(dork)
except SqlmapBaseException, ex:
except SqlmapBaseException as ex:
if conf.proxyList:
logger.critical(getSafeExString(ex))
+8 -8
View File
@@ -76,8 +76,8 @@ class SQLAlchemy(GenericConnector):
raise
except SqlmapFilePathException:
raise
except Exception, msg:
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % msg[0])
except Exception as ex:
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % ex[0])
self.printConnected()
else:
@@ -89,17 +89,17 @@ class SQLAlchemy(GenericConnector):
for row in self.cursor.fetchall():
retVal.append(tuple(row))
return retVal
except _sqlalchemy.exc.ProgrammingError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg.message if hasattr(msg, "message") else msg)
except _sqlalchemy.exc.ProgrammingError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % ex.message if hasattr(ex, "message") else ex)
return None
def execute(self, query):
try:
self.cursor = self.connector.execute(query)
except (_sqlalchemy.exc.OperationalError, _sqlalchemy.exc.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg.message if hasattr(msg, "message") else msg)
except _sqlalchemy.exc.InternalError, msg:
raise SqlmapConnectionException(msg[1])
except (_sqlalchemy.exc.OperationalError, _sqlalchemy.exc.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % ex.message if hasattr(ex, "message") else ex)
except _sqlalchemy.exc.InternalError as ex:
raise SqlmapConnectionException(ex[1])
def select(self, query):
self.execute(query)
+2 -2
View File
@@ -22,8 +22,8 @@ def timeout(func, args=(), kwargs={}, duration=1, default=None):
try:
self.result = func(*args, **kwargs)
self.timeout_state = TIMEOUT_STATE.NORMAL
except Exception, msg:
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, msg)
except Exception as ex:
logger.log(CUSTOM_LOGGING.TRAFFIC_IN, ex)
self.result = default
self.timeout_state = TIMEOUT_STATE.EXCEPTION
+1 -1
View File
@@ -58,7 +58,7 @@ class xrange(object):
return self._len()
def _len(self):
return max(0, int((self.stop - self.start) / self.step))
return max(0, int((self.stop - self.start) // self.step))
def __contains__(self, value):
return (self.start <= value < self.stop) and (value - self.start) % self.step == 0
+8 -8
View File
@@ -43,8 +43,8 @@ class Connector(GenericConnector):
try:
self.connector = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb)};Dbq=%s;Uid=Admin;Pwd=;' % self.db)
except (pyodbc.Error, pyodbc.OperationalError), msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (pyodbc.Error, pyodbc.OperationalError) as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -52,17 +52,17 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except pyodbc.ProgrammingError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except pyodbc.ProgrammingError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
return None
def execute(self, query):
try:
self.cursor.execute(query)
except (pyodbc.OperationalError, pyodbc.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except pyodbc.Error, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (pyodbc.OperationalError, pyodbc.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
except pyodbc.Error as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+8 -8
View File
@@ -35,8 +35,8 @@ class Connector(GenericConnector):
try:
database = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port)
self.connector = ibm_db_dbi.connect(database, self.user, self.password)
except ibm_db_dbi.OperationalError, msg:
raise SqlmapConnectionException(msg)
except ibm_db_dbi.OperationalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -44,17 +44,17 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except ibm_db_dbi.ProgrammingError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except ibm_db_dbi.ProgrammingError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
return None
def execute(self, query):
try:
self.cursor.execute(query)
except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except ibm_db_dbi.InternalError, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
except ibm_db_dbi.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+8 -8
View File
@@ -42,8 +42,8 @@ class Connector(GenericConnector):
try:
# Reference: http://www.daniweb.com/forums/thread248499.html
self.connector = kinterbasdb.connect(host=self.hostname.encode(UNICODE_ENCODING), database=self.db.encode(UNICODE_ENCODING), user=self.user.encode(UNICODE_ENCODING), password=self.password.encode(UNICODE_ENCODING), charset="UTF8")
except kinterbasdb.OperationalError, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except kinterbasdb.OperationalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -51,17 +51,17 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except kinterbasdb.OperationalError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except kinterbasdb.OperationalError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
return None
def execute(self, query):
try:
self.cursor.execute(query)
except kinterbasdb.OperationalError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except kinterbasdb.Error, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except kinterbasdb.OperationalError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
except kinterbasdb.Error as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+9 -8
View File
@@ -14,6 +14,7 @@ except:
import logging
from lib.core.common import checkFile
from lib.core.common import getSafeExString
from lib.core.common import readInput
from lib.core.data import conf
from lib.core.data import logger
@@ -41,15 +42,15 @@ class Connector(GenericConnector):
args = "-Djava.class.path=%s" % jar
jvm_path = jpype.getDefaultJVMPath()
jpype.startJVM(jvm_path, args)
except Exception, msg:
raise SqlmapConnectionException(msg[0])
except Exception as ex:
raise SqlmapConnectionException(getSafeExString(ex))
try:
driver = 'org.hsqldb.jdbc.JDBCDriver'
connection_string = 'jdbc:hsqldb:mem:.' # 'jdbc:hsqldb:hsql://%s/%s' % (self.hostname, self.db)
self.connector = jaydebeapi.connect(driver, connection_string, str(self.user), str(self.password))
except Exception, msg:
raise SqlmapConnectionException(msg[0])
except Exception as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -57,8 +58,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except Exception, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except Exception as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
return None
def execute(self, query):
@@ -67,8 +68,8 @@ class Connector(GenericConnector):
try:
self.cursor.execute(query)
retVal = True
except Exception, msg: # TODO: fix with specific error
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except Exception as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
self.connector.commit()
+8 -8
View File
@@ -35,8 +35,8 @@ class Connector(GenericConnector):
try:
database = "DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port)
self.connector = ibm_db_dbi.connect(database, self.user, self.password)
except ibm_db_dbi.OperationalError, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except ibm_db_dbi.OperationalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -44,17 +44,17 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except ibm_db_dbi.ProgrammingError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except ibm_db_dbi.ProgrammingError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
return None
def execute(self, query):
try:
self.cursor.execute(query)
except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except ibm_db_dbi.InternalError, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
except ibm_db_dbi.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+1 -1
View File
@@ -67,7 +67,7 @@ class Enumeration(GenericEnumeration):
else:
dbs = self.getDbs()
for db in filter(None, dbs):
for db in (_ for _ in dbs if _):
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
infoMsg = "fetching tables for database"
+9 -8
View File
@@ -13,6 +13,7 @@ except:
import logging
from lib.core.common import getSafeExString
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@@ -41,8 +42,8 @@ class Connector(GenericConnector):
try:
self.connector = pymssql.connect(host="%s:%d" % (self.hostname, self.port), user=self.user, password=self.password, database=self.db, login_timeout=conf.timeout, timeout=conf.timeout)
except (pymssql2.Error, _mssql.MssqlDatabaseException), msg:
raise SqlmapConnectionException(msg)
except (pymssql.Error, _mssql.MssqlDatabaseException) as ex:
raise SqlmapConnectionException(getSafeExString(ex))
except ValueError:
raise SqlmapConnectionException
@@ -52,8 +53,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except (pymssql.Error, _mssql.MssqlDatabaseException) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
return None
def execute(self, query):
@@ -62,10 +63,10 @@ class Connector(GenericConnector):
try:
self.cursor.execute(utf8encode(query))
retVal = True
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except pymssql.InternalError, msg:
raise SqlmapConnectionException(msg)
except (pymssql.OperationalError, pymssql.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
except pymssql.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
return retVal
+3 -3
View File
@@ -83,7 +83,7 @@ class Enumeration(GenericEnumeration):
for db in dbs:
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
dbs = filter(None, dbs)
dbs = [_ for _ in dbs if _]
infoMsg = "fetching tables for database"
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
@@ -110,7 +110,7 @@ class Enumeration(GenericEnumeration):
break
if not isNoneValue(value):
value = filter(None, arrayizeValue(value))
value = [_ for _ in arrayizeValue(value) if _]
value = [safeSQLIdentificatorNaming(unArrayizeValue(_), True) for _ in value]
kb.data.cachedTables[db] = value
@@ -340,7 +340,7 @@ class Enumeration(GenericEnumeration):
colQuery = "%s%s" % (colCond, colCondParam)
colQuery = colQuery % unsafeSQLIdentificatorNaming(column)
for db in filter(None, dbs.keys()):
for db in (_ for _ in dbs if _):
db = safeSQLIdentificatorNaming(db)
if conf.excludeSysDbs and db in self.excludeDbsList:
+8 -8
View File
@@ -38,8 +38,8 @@ class Connector(GenericConnector):
try:
self.connector = pymysql.connect(host=self.hostname, user=self.user, passwd=self.password, db=self.db, port=self.port, connect_timeout=conf.timeout, use_unicode=True)
except (pymysql.OperationalError, pymysql.InternalError, pymysql.ProgrammingError, struct.error), msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (pymysql.OperationalError, pymysql.InternalError, pymysql.ProgrammingError, struct.error) as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -47,8 +47,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except pymysql.ProgrammingError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except pymysql.ProgrammingError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
return None
def execute(self, query):
@@ -57,10 +57,10 @@ class Connector(GenericConnector):
try:
self.cursor.execute(query)
retVal = True
except (pymysql.OperationalError, pymysql.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(msg))
except pymysql.InternalError, msg:
raise SqlmapConnectionException(getSafeExString(msg))
except (pymysql.OperationalError, pymysql.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
except pymysql.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+10 -9
View File
@@ -14,6 +14,7 @@ import logging
import os
import re
from lib.core.common import getSafeExString
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@@ -43,17 +44,17 @@ class Connector(GenericConnector):
try:
self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password, mode=cx_Oracle.SYSDBA)
logger.info("successfully connected as SYSDBA")
except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError), ex:
if "Oracle Client library" in str(ex):
msg = re.sub(r"DPI-\d+:\s+", "", str(ex))
except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError) as ex:
if "Oracle Client library" in getSafeExString(ex):
msg = re.sub(r"DPI-\d+:\s+", "", getSafeExString(ex))
msg = re.sub(r': ("[^"]+")', r" (\g<1>)", msg)
msg = re.sub(r". See (http[^ ]+)", r'. See "\g<1>"', msg)
raise SqlmapConnectionException(msg)
try:
self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password)
except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError), msg:
raise SqlmapConnectionException(msg)
except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError) as ex:
raise SqlmapConnectionException(ex)
self.initCursor()
self.printConnected()
@@ -61,8 +62,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except cx_Oracle.InterfaceError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
except cx_Oracle.InterfaceError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
return None
def execute(self, query):
@@ -71,8 +72,8 @@ class Connector(GenericConnector):
try:
self.cursor.execute(utf8encode(query))
retVal = True
except cx_Oracle.DatabaseError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
except cx_Oracle.DatabaseError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
self.connector.commit()
+9 -8
View File
@@ -13,6 +13,7 @@ try:
except:
pass
from lib.core.common import getSafeExString
from lib.core.data import logger
from lib.core.exception import SqlmapConnectionException
from plugins.generic.connector import Connector as GenericConnector
@@ -36,8 +37,8 @@ class Connector(GenericConnector):
try:
self.connector = psycopg2.connect(host=self.hostname, user=self.user, password=self.password, database=self.db, port=self.port)
except psycopg2.OperationalError, msg:
raise SqlmapConnectionException(msg)
except psycopg2.OperationalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.set_client_encoding('UNICODE')
@@ -47,8 +48,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except psycopg2.ProgrammingError, msg:
logger.warn(msg)
except psycopg2.ProgrammingError as ex:
logger.warn(getSafeExString(ex))
return None
def execute(self, query):
@@ -57,10 +58,10 @@ class Connector(GenericConnector):
try:
self.cursor.execute(query)
retVal = True
except (psycopg2.OperationalError, psycopg2.ProgrammingError), msg:
logger.warn(("(remote) %s" % msg).strip())
except psycopg2.InternalError, msg:
raise SqlmapConnectionException(msg)
except (psycopg2.OperationalError, psycopg2.ProgrammingError) as ex:
logger.warn(("(remote) '%s'" % getSafeExString(ex)).strip())
except psycopg2.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+10 -9
View File
@@ -12,6 +12,7 @@ except:
import logging
from lib.core.common import getSafeExString
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@@ -45,7 +46,7 @@ class Connector(GenericConnector):
cursor.execute("SELECT * FROM sqlite_master")
cursor.close()
except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError), msg:
except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError):
warnMsg = "unable to connect using SQLite 3 library, trying with SQLite 2"
logger.warn(warnMsg)
@@ -59,8 +60,8 @@ class Connector(GenericConnector):
self.__sqlite = sqlite
self.connector = self.__sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError), msg:
raise SqlmapConnectionException(msg[0])
except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError) as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.initCursor()
self.printConnected()
@@ -68,17 +69,17 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except self.__sqlite.OperationalError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[0])
except self.__sqlite.OperationalError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
return None
def execute(self, query):
try:
self.cursor.execute(utf8encode(query))
except self.__sqlite.OperationalError, msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[0])
except self.__sqlite.DatabaseError, msg:
raise SqlmapConnectionException(msg[0])
except self.__sqlite.OperationalError as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex))
except self.__sqlite.DatabaseError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
self.connector.commit()
+9 -8
View File
@@ -13,6 +13,7 @@ except:
import logging
from lib.core.common import getSafeExString
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@@ -41,8 +42,8 @@ class Connector(GenericConnector):
try:
self.connector = pymssql.connect(host="%s:%d" % (self.hostname, self.port), user=self.user, password=self.password, database=self.db, login_timeout=conf.timeout, timeout=conf.timeout)
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
raise SqlmapConnectionException(msg)
except (pymssql.Error, _mssql.MssqlDatabaseException) as ex:
raise SqlmapConnectionException(ex)
except ValueError:
raise SqlmapConnectionException
@@ -52,8 +53,8 @@ class Connector(GenericConnector):
def fetchall(self):
try:
return self.cursor.fetchall()
except (pymssql.Error, _mssql.MssqlDatabaseException), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except (pymssql.Error, _mssql.MssqlDatabaseException) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
return None
def execute(self, query):
@@ -62,10 +63,10 @@ class Connector(GenericConnector):
try:
self.cursor.execute(utf8encode(query))
retVal = True
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except pymssql.InternalError, msg:
raise SqlmapConnectionException(msg)
except (pymssql.OperationalError, pymssql.ProgrammingError) as ex:
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) '%s'" % getSafeExString(ex).replace("\n", " "))
except pymssql.InternalError as ex:
raise SqlmapConnectionException(getSafeExString(ex))
return retVal
+1 -1
View File
@@ -128,7 +128,7 @@ class Enumeration(GenericEnumeration):
for db in dbs:
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
dbs = filter(None, dbs)
dbs = [_ for _ in dbs if _]
infoMsg = "fetching tables for database"
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
+2 -2
View File
@@ -52,8 +52,8 @@ class Connector:
self.cursor.close()
if self.connector:
self.connector.close()
except Exception, msg:
logger.debug(msg)
except Exception as ex:
logger.debug(ex)
finally:
self.closed()
+7 -5
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import re
import sys
@@ -70,7 +72,7 @@ class Custom:
output = NULL
except SqlmapNoneDataException, ex:
except SqlmapNoneDataException as ex:
logger.warn(ex)
return output
@@ -90,11 +92,11 @@ class Custom:
query = getUnicode(query, encoding=sys.stdin.encoding)
query = query.strip("; ")
except KeyboardInterrupt:
print
print()
errMsg = "user aborted"
logger.error(errMsg)
except EOFError:
print
print()
errMsg = "exit"
logger.error(errMsg)
break
@@ -128,8 +130,8 @@ class Custom:
snippet = getSQLSnippet(Backend.getDbms(), filename)
if snippet and all(query.strip().upper().startswith("SELECT") for query in filter(None, snippet.split(';' if ';' in snippet else '\n'))):
for query in filter(None, snippet.split(';' if ';' in snippet else '\n')):
if snippet and all(query.strip().upper().startswith("SELECT") for query in (_ for _ in snippet.split(';' if ';' in snippet else '\n') if _)):
for query in (_ for _ in snippet.split(';' if ';' in snippet else '\n') if _):
query = query.strip()
if query:
conf.dumper.query(query, self.sqlQuery(query))
+4 -4
View File
@@ -179,7 +179,7 @@ class Databases:
kb.data.cachedDbs.sort()
if kb.data.cachedDbs:
kb.data.cachedDbs = filter(None, list(set(flattenValue(kb.data.cachedDbs))))
kb.data.cachedDbs = [_ for _ in set(flattenValue(kb.data.cachedDbs)) if _]
return kb.data.cachedDbs
@@ -285,7 +285,7 @@ class Databases:
values = inject.getValue(query, blind=False, time=False)
if not isNoneValue(values):
values = filter(None, arrayizeValue(values))
values = [_ for _ in arrayizeValue(values) if _]
if len(values) > 0 and not isListLike(values[0]):
values = [(dbs[0], _) for _ in values]
@@ -415,7 +415,7 @@ class Databases:
kb.data.cachedTables[db] = sorted(tables) if tables else tables
if kb.data.cachedTables:
for db in kb.data.cachedTables.keys():
for db in kb.data.cachedTables:
kb.data.cachedTables[db] = list(set(kb.data.cachedTables[db]))
return kb.data.cachedTables
@@ -462,7 +462,7 @@ class Databases:
for col in colList:
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
colList = filter(None, colList)
colList = [_ for _ in colList if _]
if conf.tbl:
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2, DBMS.HSQLDB, DBMS.H2):
+6 -6
View File
@@ -139,7 +139,7 @@ class Entries:
continue
columns = kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)]
colList = sorted(filter(None, columns.keys()))
colList = sorted(column for column in columns if column)
if conf.exclude:
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
@@ -444,13 +444,13 @@ class Entries:
"db": safeSQLIdentificatorNaming(conf.db)}
try:
attackDumpedTable()
except (IOError, OSError), ex:
except (IOError, OSError) as ex:
errMsg = "an error occurred while attacking "
errMsg += "table dump ('%s')" % getSafeExString(ex)
logger.critical(errMsg)
conf.dumper.dbTableValues(kb.data.dumpedTable)
except SqlmapConnectionException, ex:
except SqlmapConnectionException as ex:
errMsg = "connection exception detected in dumping phase "
errMsg += "('%s')" % getSafeExString(ex)
logger.critical(errMsg)
@@ -517,7 +517,7 @@ class Entries:
choice = readInput(message, default='a')
if not choice or choice in ('a', 'A'):
dumpFromDbs = dbs.keys()
dumpFromDbs = list(dbs.keys())
elif choice in ('q', 'Q'):
return
else:
@@ -553,7 +553,7 @@ class Entries:
continue
conf.tbl = table
colList = filter(None, sorted(columns))
colList = [_ for _ in columns if _]
if conf.exclude:
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
@@ -584,7 +584,7 @@ class Entries:
choice = readInput(message, default='a')
if not choice or choice.lower() == 'a':
dumpFromDbs = tables.keys()
dumpFromDbs = list(tables.keys())
elif choice.lower() == 'q':
return
else:
+2 -2
View File
@@ -273,7 +273,7 @@ class Search:
dbName = "SQLite" if Backend.isDbms(DBMS.SQLITE) else "Firebird"
foundTbls["%s%s" % (dbName, METADB_SUFFIX)] = []
for db in foundTbls.keys():
for db in foundTbls:
db = safeSQLIdentificatorNaming(db)
infoMsg = "fetching number of table"
@@ -326,7 +326,7 @@ class Search:
foundTbl = safeSQLIdentificatorNaming(foundTbl, True)
foundTbls[db].append(foundTbl)
for db in foundTbls.keys():
for db in list(foundTbls.keys()):
if isNoneValue(foundTbls[db]):
del foundTbls[db]
+1 -1
View File
@@ -140,7 +140,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous):
try:
with open(filename, "wb") as f:
f.write("1")
except IOError, ex:
except IOError as ex:
errMsg = "there has been a file opening/writing error "
errMsg += "for filename '%s' ('%s')" % (filename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
+2 -2
View File
@@ -171,7 +171,7 @@ class Users:
else:
users = []
users = filter(None, users)
users = [_ for _ in users if _]
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
if Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
@@ -370,7 +370,7 @@ class Users:
else:
users = []
users = filter(None, users)
users = [_ for _ in users if _]
# Set containing the list of DBMS administrators
areAdmins = set()
+15 -8
View File
@@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
try:
import sys
@@ -51,6 +53,7 @@ try:
from lib.core.data import kb
from lib.core.common import unhandledExceptionMessage
from lib.core.common import MKSTEMP_PREFIX
from lib.core.common import setColor
from lib.core.exception import SqlmapBaseException
from lib.core.exception import SqlmapShellQuitException
from lib.core.exception import SqlmapSilentQuitException
@@ -188,10 +191,10 @@ def main():
raise SystemExit
except KeyboardInterrupt:
print
print()
except EOFError:
print
print()
errMsg = "exit"
logger.error(errMsg)
@@ -200,7 +203,7 @@ def main():
pass
except:
print
print()
errMsg = unhandledExceptionMessage()
excMsg = traceback.format_exc()
valid = checkIntegrity()
@@ -210,13 +213,13 @@ def main():
errMsg += "You should retrieve the latest development version from official GitHub "
errMsg += "repository at '%s'" % GIT_PAGE
logger.critical(errMsg)
print
print()
dataToStdout(excMsg)
raise SystemExit
elif any(_ in excMsg for _ in ("tamper/", "waf/")):
logger.critical(errMsg)
print
print()
dataToStdout(excMsg)
raise SystemExit
@@ -230,11 +233,16 @@ def main():
logger.critical(errMsg)
raise SystemExit
elif any(_ in excMsg for _ in ("No space left", "Disk quota exceeded")):
elif any(_ in excMsg for _ in ("No space left", "Disk quota exceeded", "Disk full while accessing")):
errMsg = "no space left on output device"
logger.critical(errMsg)
raise SystemExit
elif any(_ in excMsg for _ in ("The paging file is too small",)):
errMsg = "no space left for paging file"
logger.critical(errMsg)
raise SystemExit
elif all(_ in excMsg for _ in ("No such file", "_'", "self.get_prog_name()")):
errMsg = "corrupted installation detected ('%s'). " % excMsg.strip().split('\n')[-1]
errMsg += "You should retrieve the latest development version from official GitHub "
@@ -332,8 +340,7 @@ def main():
logger.critical("%s\n%s" % (errMsg, excMsg))
else:
logger.critical(errMsg)
kb.stickyLevel = logging.CRITICAL
dataToStdout(excMsg)
dataToStdout("%s\n" % setColor(excMsg.strip(), level=logging.CRITICAL))
createGithubIssue(errMsg, excMsg)
finally:
+6 -6
View File
@@ -370,7 +370,7 @@ class PageElement(object):
g = generator()
while True:
try:
i = g.next()
i = next(g)
except StopIteration:
break
if i:
@@ -470,7 +470,7 @@ class NavigableString(unicode, PageElement):
if attr == 'string':
return self
else:
raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, attr))
def __unicode__(self):
return str(self).decode(DEFAULT_OUTPUT_ENCODING)
@@ -668,7 +668,7 @@ class Tag(PageElement):
return self.find(tag[:-3])
elif tag.find('__') != 0:
return self.find(tag)
raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__, tag)
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__, tag))
def __eq__(self, other):
"""Returns true iff this tag has the same name, the same attributes,
@@ -974,8 +974,8 @@ class SoupStrainer:
if self._matches(markup, self.text):
found = markup
else:
raise Exception, "I don't know how to match against a %s" \
% markup.__class__
raise Exception("I don't know how to match against a %s" \
% markup.__class__)
return found
def _matches(self, markup, matchAgainst):
@@ -1836,7 +1836,7 @@ class UnicodeDammit:
u = self._toUnicode(markup, proposed)
self.markup = u
self.originalEncoding = proposed
except Exception, e:
except Exception as e:
# print "That didn't work!"
# print e
return None
+3 -3
View File
@@ -1100,7 +1100,7 @@ def _ParseFileEx(file, base_uri,
data = file.read(CHUNK)
try:
fp.feed(data)
except ParseError, e:
except ParseError as e:
e.base_uri = base_uri
raise
if len(data) != CHUNK: break
@@ -1141,7 +1141,7 @@ def _ParseFileEx(file, base_uri,
for form in forms:
try:
form.fixup()
except AttributeError, ex:
except AttributeError as ex:
if not any(_ in str(ex) for _ in ("is disabled", "is readonly")):
raise
return forms
@@ -2902,7 +2902,7 @@ class HTMLForm:
control = self.find_control(name)
try:
control.value = value
except AttributeError, e:
except AttributeError as e:
raise ValueError(str(e))
def get_value(self,
+1 -1
View File
@@ -180,7 +180,7 @@ class AnsiToWin32(object):
def _write(self, text, retry=5):
try:
self.wrapped.write(text)
except IOError, err:
except IOError as err:
if not (err.errno == 0 and retry > 0):
raise
self._write(text, retry-1)
+3 -3
View File
@@ -695,7 +695,7 @@ class XmlTokenizer:
self.final = len(data) < size
try:
self.parser.Parse(data, self.final)
except xml.parsers.expat.ExpatError, e:
except xml.parsers.expat.ExpatError as e:
#if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS:
if e.code == 3:
pass
@@ -732,7 +732,7 @@ class XmlParser(Parser):
self.consume()
def consume(self):
self.token = self.tokenizer.next()
self.token = next(self.tokenizer)
def match_element_start(self, name):
return self.token.type == XML_ELEMENT_START and self.token.name_or_data == name
@@ -1719,7 +1719,7 @@ class XPerfParser(Parser):
lineterminator = '\r\n',
quoting = csv.QUOTE_NONE)
it = iter(reader)
row = reader.next()
row = next(reader)
self.parse_header(row)
for row in it:
self.parse_row(row)
+4 -4
View File
@@ -238,7 +238,7 @@ class KeepAliveHandler:
self._cm.add(host, h, 0)
self._start_transaction(h, req)
r = h.getresponse()
except (socket.error, httplib.HTTPException), err:
except (socket.error, httplib.HTTPException) as err:
raise urllib2.URLError(err)
if DEBUG: DEBUG.info("STATUS: %s, %s", r.status, r.reason)
@@ -323,7 +323,7 @@ class KeepAliveHandler:
h.putrequest(req.get_method() or 'GET', req.selector, skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
else:
h.putrequest(req.get_method() or 'GET', req.get_selector(), skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
except (socket.error, httplib.HTTPException), err:
except (socket.error, httplib.HTTPException) as err:
raise urllib2.URLError(err)
if not req.headers.has_key('Connection'):
@@ -495,7 +495,7 @@ def error_handler(url):
fo.close()
try: status, reason = fo.status, fo.reason
except AttributeError: status, reason = None, None
except IOError, e:
except IOError as e:
print " EXCEPTION: %s" % e
raise
else:
@@ -613,7 +613,7 @@ def test_timeout(url):
def test(url, N=10):
print "checking error hander (do this on a non-200)"
try: error_handler(url)
except IOError, e:
except IOError as e:
print "exiting - exception will prevent further tests"
sys.exit()
print
+1 -1
View File
@@ -59,7 +59,7 @@ class MultipartPostHandler(urllib2.BaseHandler):
v_vars.append((key, value))
except TypeError:
systype, value, traceback = sys.exc_info()
raise SqlmapDataException, "not a valid non-string sequence or mapping object", traceback
raise SqlmapDataException("not a valid non-string sequence or mapping object '%s'" % traceback)
if len(v_files) == 0:
data = urllib.urlencode(v_vars, doseq)
+3 -2
View File
@@ -609,7 +609,7 @@ class _OrderedDict(dict):
TypeError: pop expected at most 2 arguments, got 3
"""
if len(args) > 1:
raise TypeError, ('pop expected at most 2 arguments, got %s' %
raise TypeError('pop expected at most 2 arguments, got %s' %
(len(args) + 1))
if key in self:
val = self[key]
@@ -621,7 +621,7 @@ class _OrderedDict(dict):
raise KeyError(key)
return val
def popitem(self, i=-1):
def popitem(self, last=True):
"""
Delete and return an item specified by index, not a random one as in
dict. The index is -1 by default (the last item).
@@ -643,6 +643,7 @@ class _OrderedDict(dict):
if not self._sequence:
raise KeyError('popitem(): dictionary is empty')
try:
i = -1 if last else 0
key = self._sequence[i]
except IndexError:
raise IndexError('popitem(): index %s not valid' % i)
+2 -2
View File
@@ -364,7 +364,7 @@ class MutableSet(Set):
"""Return the popped value. Raise KeyError if empty."""
it = iter(self)
try:
value = it.next()
value = next(it)
except StopIteration:
raise KeyError
self.discard(value)
@@ -453,7 +453,7 @@ class OrderedSet(MutableSet):
def pop(self, last=True):
if not self:
raise KeyError('set is empty')
key = reversed(self).next() if last else iter(self).next()
key = next(reversed(self)) if last else next(iter(self))
self.discard(key)
return key
+1 -1
View File
@@ -62,7 +62,7 @@ class OrderedSet(MutableSet):
def pop(self, last=True):
if not self:
raise KeyError('set is empty')
key = reversed(self).next() if last else iter(self).next()
key = next(reversed(self)) if last else next(iter(self))
self.discard(key)
return key
+2 -2
View File
@@ -897,7 +897,7 @@ class Parser:
def __init__(self, lexer):
self.lexer = lexer
self.lookahead = self.lexer.next()
self.lookahead = next(self.lexer)
def match(self, type):
if self.lookahead.type != type:
@@ -913,7 +913,7 @@ class Parser:
def consume(self):
token = self.lookahead
self.lookahead = self.lexer.next()
self.lookahead = next(self.lexer)
return token
+139 -130
View File
@@ -1,139 +1,141 @@
7ad922bcc16462a101862b1b0b15182f COMMITMENT
3d37032b2bd62ee37bd61c5b7ad31ab4 extra/beep/beep.py
fb6be55d21a70765e35549af2484f762 extra/beep/__init__.py
ed51a485d1badc99267f0d136bfb2a12 extra/cloak/cloak.py
8b4237aae3b82c325e0b34f6adfa0bc3 extra/cloak/cloak.py
fb6be55d21a70765e35549af2484f762 extra/cloak/__init__.py
6baecbea87de0a56f99e59bfe982ebc5 extra/dbgtool/dbgtool.py
1046e46c8923ec5afe4f6f1ca3ee55bb extra/dbgtool/dbgtool.py
fb6be55d21a70765e35549af2484f762 extra/dbgtool/__init__.py
acba8b5dc93db0fe6b2b04ff0138c33c extra/icmpsh/icmpsh.exe_
708e9fd35dabcbfcd10e91bbc14f091f extra/icmpsh/icmpsh_m.py
216a0e04bef7053e6aa35ca98907007e extra/icmpsh/icmpsh_m.py
2d020d2bdcee1170805f48839fdb89df extra/icmpsh/__init__.py
fb6be55d21a70765e35549af2484f762 extra/__init__.py
ff90cb0366f7cefbdd6e573e27e6238c extra/runcmd/runcmd.exe_
fb6be55d21a70765e35549af2484f762 extra/safe2bin/__init__.py
f372fef397ba41ea54334c16ebe646b2 extra/safe2bin/safe2bin.py
c26cfad6b77b44a1317cd058b4477ce0 extra/safe2bin/safe2bin.py
d229479d02d21b29f209143cb0547780 extra/shellcodeexec/linux/shellcodeexec.x32_
2fe2f94eebc62f7614f0391a8a90104f extra/shellcodeexec/linux/shellcodeexec.x64_
c55b400b72acc43e0e59c87dd8bb8d75 extra/shellcodeexec/windows/shellcodeexec.x32.exe_
d1bf28af13f1017f4007f29ea86afd25 extra/shutils/duplicates.py
e4805169a081b834ca51a60a150c7247 extra/shutils/newlines.py
71b9d4357c31db013ecda27433830090 extra/shutils/pylint.py
11492e9b5f183c289b98442437675c1f extra/shutils/regressiontest.py
a32e12410e0f86c1d035db6daae84680 extra/shutils/duplicates.py
1cf0ecf81a0483c3de78ac683445ac7a extra/shutils/newlines.py
9626f1f72dc96dbdecb1ea7404811902 extra/shutils/pylint.py
80f989adc6d4fa999b414c0787a06c1b extra/shutils/regressiontest.py
fb6be55d21a70765e35549af2484f762 extra/sqlharvest/__init__.py
53d5dcba047f1285e32b9e88d2803ebf extra/sqlharvest/sqlharvest.py
4f82e97b09cc530cb9a92472d0835cea extra/sqlharvest/sqlharvest.py
fb6be55d21a70765e35549af2484f762 extra/wafdetectify/__init__.py
be1d8f7b74ad64226c61b1a74251f8ff extra/wafdetectify/wafdetectify.py
d0f2b424f5b2b06f26cdd7076d61be6e lib/controller/action.py
32959690fd69f4131cbb8abc051114e9 lib/controller/checks.py
3c18f0b1d1b9fda682201a264f170b31 lib/controller/controller.py
e97a9d34fef5761a8eab6432ce3c7c53 lib/controller/handler.py
aec73042403993076f478da48066a79e extra/wafdetectify/wafdetectify.py
ec782b9cdb8d857a80b6ecf0f32db7f4 lib/controller/action.py
d392dbccdb59ac36530c1182675a2609 lib/controller/checks.py
b37a93767459162b30798bd9732a12a3 lib/controller/controller.py
c1da277517c7ec4c23e953a51b51e203 lib/controller/handler.py
fb6be55d21a70765e35549af2484f762 lib/controller/__init__.py
6da66134fec9d81492e5b7c7241fdbd9 lib/core/agent.py
fdabbf8dda7277e5f4e3d0a6252cffb6 lib/core/bigarray.py
61e6d5e091588bf8e33fb1d92f23868a lib/core/common.py
ed7874be0d2d3802f3d20184f2b280d5 lib/core/agent.py
a932126e7d80e545c5d44af178d0bc0c lib/core/bigarray.py
abbe98412255c4856ef30a15da8136a2 lib/core/common.py
de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py
abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py
db60c6ebb63b72ed119e304b359fc1a6 lib/core/datatype.py
b7c912e2af7a3354f6d7c04f556a80b2 lib/core/decorators.py
e1f7758f433202c50426efde5eb96768 lib/core/datatype.py
1646402a733e564f05025e848b323cf9 lib/core/decorators.py
5f4680b769ae07f22157bd832c97cf8f lib/core/defaults.py
9dfc69ba47209a4ceca494dde9ee8183 lib/core/dicts.py
040895bafa05783ca1a2e6c74d6de2c6 lib/core/dump.py
13ca1a870fa0b01b9593f25e9e93ed9c lib/core/dump.py
5c91145204092b995ed1ac641e9e291d lib/core/enums.py
84ef8f32e4582fcc294dc14e1997131d lib/core/exception.py
fb6be55d21a70765e35549af2484f762 lib/core/__init__.py
18c896b157b03af716542e5fe9233ef9 lib/core/log.py
fa9f24e88c81a6cef52da3dd5e637010 lib/core/optiondict.py
83d9f55dad3915ff66ce7f2f21452bc2 lib/core/option.py
9357506018d15f30cffb99a0005d7f1c lib/core/option.py
fe370021c6bc99daf44b2bfc0d1effb3 lib/core/patch.py
0f1d79ada721cf6def611b21b03d68af lib/core/profiling.py
4b12aa67fbf6c973d12e54cf9cb54ea0 lib/core/profiling.py
5e2c16a8e2daee22dd545df13386e7a3 lib/core/readlineng.py
9a7d68d5fa01561500423791f15cc676 lib/core/replication.py
7d8a22c582ad201f65b73225e4456170 lib/core/replication.py
3179d34f371e0295dd4604568fb30bcd lib/core/revision.py
d6269c55789f78cf707e09a0f5b45443 lib/core/session.py
c799d8dee38e2da35b8aff0638f21129 lib/core/settings.py
a8a7501d1e6b21669b858a62e921d191 lib/core/shell.py
5dc606fdf0afefd4b305169c21ab2612 lib/core/subprocessng.py
eec3080ba5baca44c6de4595f1c92a0d lib/core/target.py
2f87870562ac9a79a5105a0e20fdbf9a lib/core/testing.py
5ebd996b2a77449df90320847e30a073 lib/core/threads.py
6b0f9c399579d0b7fdc90a4653d16424 lib/core/settings.py
4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py
10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py
9c7b5c6397fb3da33e7a4d7876d159c6 lib/core/target.py
7857b24b7865ccb4a05283faa596974d lib/core/testing.py
e9788d2992f842cf91ab67389bf4372a lib/core/threads.py
2c263c8610667fdc593c50a35ab20f57 lib/core/unescaper.py
5bd7cd6553a4a1c85cbaaddc268108e4 lib/core/update.py
5232b05d5c42a0e5a5a2d5952c6c39a5 lib/core/wordlist.py
54e9cd1968adea11283d44631f0ca400 lib/core/update.py
5b3f08208be0579356f78ce5805d37b2 lib/core/wordlist.py
fb6be55d21a70765e35549af2484f762 lib/__init__.py
4881480d0c1778053908904e04570dc3 lib/parse/banner.py
65a5b384bc3d545b366b344eddeb0805 lib/parse/cmdline.py
85e44fc7673a661305909a85ed24c5ae lib/parse/configfile.py
9b33e52f697d6e915c7a10153562ce89 lib/parse/handler.py
87a1d50411e74cd0afb2d1bed30f59d4 lib/parse/cmdline.py
06ccbccb63255c8f1c35950a4c8a6f6b lib/parse/configfile.py
d34df646508c2dceb25205e1316673d1 lib/parse/handler.py
43deb2400e269e602e916efaec7c0903 lib/parse/headers.py
77e802323ffa718dd9c27512656c0a70 lib/parse/html.py
fb6be55d21a70765e35549af2484f762 lib/parse/__init__.py
92b55cf4246ae7ff6651ac8deb4a0ac5 lib/parse/payloads.py
adcecd2d6a8667b22872a563eb83eac0 lib/parse/payloads.py
993104046c7d97120613409ef7780c76 lib/parse/sitemap.py
e4ea70bcd461f5176867dcd89d372386 lib/request/basicauthhandler.py
6076c01e84b589adb97cac421a7d5251 lib/request/basic.py
97b7577fdfe3d8537fe9ea3a070d0507 lib/request/basic.py
fc25d951217077fe655ed2a3a81552ae lib/request/comparison.py
3b76bfadb74c069b17d73d2aba241005 lib/request/connect.py
2fde12a95133b26699e26a5c56311c38 lib/request/connect.py
7cba86090b02558f04c6692cef66e772 lib/request/direct.py
0a5cc34a7bbe709684ce32b4b46afd32 lib/request/dns.py
7bab2719ef2a6f1ddd838fa2335ae635 lib/request/httpshandler.py
2b7509ba38a667c61cefff036ec4ca6f lib/request/dns.py
ceac6b3bf1f726f8ff43c6814e9d7281 lib/request/httpshandler.py
fb6be55d21a70765e35549af2484f762 lib/request/__init__.py
00720f9eddf42f4fefa083fba40f69ed lib/request/inject.py
338f39808f63af8d4f4afe9e7b0665a2 lib/request/inject.py
52a067bd2fe91ea9395269a684380cbb lib/request/methodrequest.py
321786eeb43821106e41fc72bd4f9901 lib/request/pkihandler.py
ac482ec52227daf48f523827dd67078f lib/request/pkihandler.py
16ff6e078819fe517b1fc0ae3cbc1aa8 lib/request/rangehandler.py
e79048c2a08c1a47efd5652f59c4417d lib/request/redirecthandler.py
921db487a5879b219af1216d7eaccf74 lib/request/redirecthandler.py
1e60edebdb3997055616d12f4a932375 lib/request/templates.py
d0059dbb1e928871747a8893b41ce268 lib/takeover/abstraction.py
eafa28e4beb2b7492dfc8036033ac824 lib/takeover/abstraction.py
ac9efea51eba120b667b4b73536d7f1c lib/takeover/icmpsh.py
fb6be55d21a70765e35549af2484f762 lib/takeover/__init__.py
093301eaeac3cd19374f2e389e873b18 lib/takeover/metasploit.py
d55029a4c048e345fbb07a8f91604d83 lib/takeover/metasploit.py
6b5b841d445b7b973c2e033edfb01b16 lib/takeover/registry.py
ad038ac567f97a4b940b7987792d64a4 lib/takeover/udf.py
915a3fbd557fb136bd0e16c46d993be3 lib/takeover/web.py
1aadcdc058bb813d09ad23d26ea2a6b5 lib/takeover/xp_cmdshell.py
034490840639b5ca2bc97af4cb14f449 lib/techniques/blind/inference.py
96f120e4299baaea4defd902afc85979 lib/techniques/blind/inference.py
fb6be55d21a70765e35549af2484f762 lib/techniques/blind/__init__.py
fb6be55d21a70765e35549af2484f762 lib/techniques/dns/__init__.py
ea48db4c48276d7d0e71aa467c0c523f lib/techniques/dns/test.py
437786cd2f9c3237614e3cac0220b2a6 lib/techniques/dns/use.py
13a80dfa26c53246d4a353c11c082d5d lib/techniques/dns/use.py
fb6be55d21a70765e35549af2484f762 lib/techniques/error/__init__.py
c23a6f8e88242c84b54426ae7cd430a1 lib/techniques/error/use.py
7b58029a51b9bf989d18e5bb6e99635c lib/techniques/error/use.py
fb6be55d21a70765e35549af2484f762 lib/techniques/__init__.py
fb6be55d21a70765e35549af2484f762 lib/techniques/union/__init__.py
baa3946c23749d898f473dba0f4eecff lib/techniques/union/test.py
d32988e13713417286ab83a00856858e lib/techniques/union/use.py
bf5e2a2b265c0d8b9f054c94fb74dcb9 lib/utils/api.py
9d9a6148f10693aaab5fac1273d981d4 lib/techniques/union/test.py
e141fb96f2a136bafd6bb2350f02d33b lib/techniques/union/use.py
936e5cb1bc25c69f0716df1c2900f52a lib/utils/api.py
544dee96e782560fe4355cbf6ee19b8c lib/utils/brute.py
ac0780394af107b9a516463efc4de2e5 lib/utils/crawler.py
b27421eb57cea711050135f84be99258 lib/utils/crawler.py
da4bc159e6920f1f7e45c92c39941690 lib/utils/deps.py
f7c64515a3e4fcfe8266ca2be77be565 lib/utils/getch.py
0d497906b06eb82d14da676e9f9c98f5 lib/utils/har.py
1fc47aa8860f809d103048e4eb51cdd2 lib/utils/hashdb.py
e571f559826c08f05d060625b4e9dcdd lib/utils/hash.py
ce65061a15d7b609b36c672b8e824f78 lib/utils/hashdb.py
07412688758500c3b4e46ae7e28e9709 lib/utils/hash.py
17009289bb5c0dc0cceaa483113101e1 lib/utils/htmlentities.py
fb6be55d21a70765e35549af2484f762 lib/utils/__init__.py
2a40a6bd1779f7db5199f089411b1c1c lib/utils/pivotdumptable.py
5a8902fd6fa94ea73cf44952f9ed5a57 lib/utils/progress.py
a41136344768902f82b2855e88fd228d lib/utils/purge.py
b6e16ad8ea04e2c1ed65966fda1c66ac lib/utils/search.py
8d6b244ca3d6f99a9d6cd8c1856ccfeb lib/utils/sqlalchemy.py
a90c568a9b88eaea832a77581bd39d85 lib/utils/timeout.py
833b05c72c9fa60b0a25b0a26f8f31fb lib/utils/pivotdumptable.py
25bbebf0178b106e83ca5e95b51b43f6 lib/utils/progress.py
b79654e49850937ab2dc8e0d73625cab lib/utils/purge.py
503637fbdabaad5bc7f87dfcfbea4dd3 lib/utils/search.py
272a538a3d36186113191f4c543bb34b lib/utils/sqlalchemy.py
68f90f633d812ca428d2f15f016b2d96 lib/utils/timeout.py
164f830baad3e13b226ee57d44d69dfa lib/utils/versioncheck.py
1e5d24f1c629476bdf43363d2c8d8397 lib/utils/xrange.py
ab877805fe12bbcbb06b9eccfabdc4ed plugins/dbms/access/connector.py
a5007113e3cda726e1d131b99b927284 lib/utils/xrange.py
28da82c0afa4d8a0e9848f7bd8e994b7 LICENSE
b8656f4785d0945e68257107a171f945 plugins/dbms/access/connector.py
b0e4f4aed8504f97d4044620d3a7d27d plugins/dbms/access/enumeration.py
58d664d680087596965f95b482157320 plugins/dbms/access/filesystem.py
50e2991ae3f0a1eaf49fd10dcd041d92 plugins/dbms/access/fingerprint.py
bd8faded88ef80cde33b747d8181192d plugins/dbms/access/__init__.py
f36a8b05ea1a25254e03dc3bd44b1261 plugins/dbms/access/syntax.py
1a4e639d2a946792401cf5367ef661a5 plugins/dbms/access/takeover.py
b4bf4ef5189705945ca77424a7f42ee7 plugins/dbms/db2/connector.py
8f30dffb6cc7738adb5e83c2c6efb30f plugins/dbms/db2/connector.py
0f2e682ced8f91b1ec8bdf08c925b5a4 plugins/dbms/db2/enumeration.py
1ac13df2e0f04f312f522e9d8c13b692 plugins/dbms/db2/filesystem.py
e003fe19474305af522d8d6c6680db17 plugins/dbms/db2/fingerprint.py
f2fb5a3763f69cde1b1d520f8bd6a17a plugins/dbms/db2/__init__.py
61b06dce1b9a0a2f9962266a9c9495a5 plugins/dbms/db2/syntax.py
fcbd61e7ac30eb4c8f09ffd341fa27bb plugins/dbms/db2/takeover.py
e2d7c937e875e9d6f5e2c5612120b515 plugins/dbms/firebird/connector.py
105b3dc94af3fdc22e90637ca9851da5 plugins/dbms/firebird/connector.py
f43ca05279e8fce4f02e4948d4af8fda plugins/dbms/firebird/enumeration.py
15a3a49824324c4cca444e6e63f84273 plugins/dbms/firebird/filesystem.py
6b505575b98694fd8e6a19870305db18 plugins/dbms/firebird/fingerprint.py
@@ -147,14 +149,14 @@ eb7adf57e6e6cdb058435f4fa017e985 plugins/dbms/h2/fingerprint.py
4d838e712aaee541eb07278a3f4a2d70 plugins/dbms/h2/__init__.py
5a1e5c46053ec1be5f536cec644949b5 plugins/dbms/h2/syntax.py
5afbe4ae5ab3fe5176b75ac3c5a16fae plugins/dbms/h2/takeover.py
4bdbb0059d22e6a22fe2542f120d4b0b plugins/dbms/hsqldb/connector.py
13ed609d378459b40f44f094beb55a5c plugins/dbms/hsqldb/connector.py
cfc9923fe399f1735fb2befd81ff12be plugins/dbms/hsqldb/enumeration.py
e4366df5a32c32f33be348e880714999 plugins/dbms/hsqldb/filesystem.py
5d5c38e0961c5a4dade43da7149f2a28 plugins/dbms/hsqldb/fingerprint.py
5221fe018709e60663cae7c5d784ad60 plugins/dbms/hsqldb/__init__.py
5a1e5c46053ec1be5f536cec644949b5 plugins/dbms/hsqldb/syntax.py
e77d9be343fe7820a594d7b02f8d0b55 plugins/dbms/hsqldb/takeover.py
e7293692829fbacb63cd9f353b719ea8 plugins/dbms/informix/connector.py
f2bf868a83538168a3384904e2264419 plugins/dbms/informix/connector.py
4af6786b459ddbb666c5c765bf2a1158 plugins/dbms/informix/enumeration.py
1ac13df2e0f04f312f522e9d8c13b692 plugins/dbms/informix/filesystem.py
ed2bdb4eb574066521e88241a21f4bf7 plugins/dbms/informix/fingerprint.py
@@ -163,67 +165,67 @@ ed2bdb4eb574066521e88241a21f4bf7 plugins/dbms/informix/fingerprint.py
fcbd61e7ac30eb4c8f09ffd341fa27bb plugins/dbms/informix/takeover.py
fb6be55d21a70765e35549af2484f762 plugins/dbms/__init__.py
ad0b369b6b81a427abede09784db91c5 plugins/dbms/maxdb/connector.py
ea186b97a394b61d82ecf7ed22b0cff6 plugins/dbms/maxdb/enumeration.py
c96d31697b0ea9b81a8ae19b00e220f5 plugins/dbms/maxdb/enumeration.py
7886148c3d6114d43aa1d78b0512fe12 plugins/dbms/maxdb/filesystem.py
691c86dc54cf3cc69b0f5a5ea5fe9a3c plugins/dbms/maxdb/fingerprint.py
8ad820fdfd2454363279eda7a9a08e6e plugins/dbms/maxdb/__init__.py
8fe248263926639acf41db3179db13d0 plugins/dbms/maxdb/syntax.py
479ce664674859d0e61c5221f9e835fd plugins/dbms/maxdb/takeover.py
ac7f2849d59829c3a1e67c76841071fd plugins/dbms/mssqlserver/connector.py
69bfc53a409e79511802f668439bf4be plugins/dbms/mssqlserver/enumeration.py
6ef95017815eb5d2d0f5645a6f5c7a79 plugins/dbms/mssqlserver/connector.py
2f61dfdc00b780d015a8d3b8e9a23d8d plugins/dbms/mssqlserver/enumeration.py
bb02bdf47c71ed93d28d20b98ea0f8c6 plugins/dbms/mssqlserver/filesystem.py
bcabbf98e72bf3c6e971b56d8da60261 plugins/dbms/mssqlserver/fingerprint.py
6bffd484ef47111dd8a6e46e127ab5c7 plugins/dbms/mssqlserver/__init__.py
fae49b96d1422171b8f8c79f42aa56c9 plugins/dbms/mssqlserver/syntax.py
a5aa91bd7248d4f7ad508cf69f45696d plugins/dbms/mssqlserver/takeover.py
078a5399bd14d1416e2ae6fcd0445159 plugins/dbms/mysql/connector.py
dbd6121fcc92249ee0c023ee28e30274 plugins/dbms/mysql/connector.py
a94bde2f4dcf3a5f166302d07ea32907 plugins/dbms/mysql/enumeration.py
81c762ceba0892d0d6d78d70f513d20a plugins/dbms/mysql/filesystem.py
fd79ec2504b6bada7d2da233a549af53 plugins/dbms/mysql/fingerprint.py
040835bde6be85ebc1a6667dcd08940e plugins/dbms/mysql/__init__.py
dd6bd1d3d561755b96e953ede16cb8fc plugins/dbms/mysql/syntax.py
6c91ef5b5a6cd29cef4bd9bc3c369454 plugins/dbms/mysql/takeover.py
fba38967a03e30a162660dd3685a46f2 plugins/dbms/oracle/connector.py
82ed71cf0e9283859b61c88325255eb2 plugins/dbms/oracle/connector.py
3266e81eb4a3c083d27c7a255be38893 plugins/dbms/oracle/enumeration.py
5bdd5288c8303ea21a5f8409332e32a1 plugins/dbms/oracle/filesystem.py
8813f44f3b67fc98024199c7b8398811 plugins/dbms/oracle/fingerprint.py
c7bb3f112aad2ea7ea92e036e9aab6a7 plugins/dbms/oracle/__init__.py
2676a1544b454f276c64f5147f03ce02 plugins/dbms/oracle/syntax.py
8da7c9ee0a0e692097757dfc2b5fefe0 plugins/dbms/oracle/takeover.py
e5e202429e9eee431c9dd39737b4b95c plugins/dbms/postgresql/connector.py
393a17dc8cb982ebb27665ead6b84bf1 plugins/dbms/postgresql/connector.py
86f0e0c9c4bc155c93277e879e3c3311 plugins/dbms/postgresql/enumeration.py
d68b5a9d6e608f15fbe2c520613ece4a plugins/dbms/postgresql/filesystem.py
2af014c49f103cb27bc547cc12641e2b plugins/dbms/postgresql/fingerprint.py
fb018fd23dcebdb36dddd22ac92efa2c plugins/dbms/postgresql/__init__.py
290ea28e1215565d9d12ede3422a4dcf plugins/dbms/postgresql/syntax.py
339bc65824b5c946ec40a12cd0257df1 plugins/dbms/postgresql/takeover.py
d2391dfe74f053eb5f31b0efad3fdda0 plugins/dbms/sqlite/connector.py
014968f7b28abe3ca8e533843a017453 plugins/dbms/sqlite/connector.py
6a0784e3ce46b6aa23dde813c6bc177f plugins/dbms/sqlite/enumeration.py
3c0adec05071fbe655a9c2c7afe52721 plugins/dbms/sqlite/filesystem.py
4d00b64bbfb2572a4a3a3330f255cc54 plugins/dbms/sqlite/fingerprint.py
582165c3e31ec5bf919db015c2e9bb2b plugins/dbms/sqlite/__init__.py
1ca5b1d7c64686827e80988933c397fa plugins/dbms/sqlite/syntax.py
224835bf71e99bac6e50b689afac5122 plugins/dbms/sqlite/takeover.py
492e2ad85f1a3a0feb2f010cb6c84eb1 plugins/dbms/sybase/connector.py
37a4e529dfb6bf3387c22e66cd9966f7 plugins/dbms/sybase/enumeration.py
1f726d02ce4c709c0a3d327be947c72b plugins/dbms/sybase/connector.py
ac1cef8f0d14be9ea71e6627e25a9c60 plugins/dbms/sybase/enumeration.py
9f16fb52a70e5fb01876f1bc5f5ef532 plugins/dbms/sybase/filesystem.py
69c104c5a2ff3e2c88a41205bb96d812 plugins/dbms/sybase/fingerprint.py
2fae8e5d100fc9fb70769e483c29e8fb plugins/dbms/sybase/__init__.py
ec3f406591fc9472f5750bd40993e72e plugins/dbms/sybase/syntax.py
369476221b3059106410de05766227e0 plugins/dbms/sybase/takeover.py
147f6af265f6b5412bbd7aaebef95881 plugins/generic/connector.py
e492c91101cecd66c9f6a630eab85368 plugins/generic/custom.py
a3fd48c7094fca6692be8b1ae5e29cea plugins/generic/databases.py
6283b356e6055bb9071f00cdf66dea24 plugins/generic/entries.py
312020bc31ffb0bc6077f62e6fff6e73 plugins/generic/connector.py
d749b7f7b4bcf1f646290dec739f1e6d plugins/generic/custom.py
791db3be35714c9a2e55a7abe9127da4 plugins/generic/databases.py
4cf8eb3719c980c54a92f838a999d090 plugins/generic/entries.py
f3624debb8ae6fbcfb5f1b7f1d0743d1 plugins/generic/enumeration.py
cda119b7b0d1afeb60f912009cdb0cf5 plugins/generic/filesystem.py
65e75cd3c2c7acffa6ac13b086e0f383 plugins/generic/fingerprint.py
fb6be55d21a70765e35549af2484f762 plugins/generic/__init__.py
de1928d6865547764ae9a896da4bf1d4 plugins/generic/misc.py
8bc2b5dfbc4c644ed95adfe8099ee067 plugins/generic/search.py
c95bf3dec22cc638100efef99e2ccc3c plugins/generic/search.py
1989f6cbed217f4222dc2dce72992d91 plugins/generic/syntax.py
d152384fffebfa010188707bf683cd3c plugins/generic/takeover.py
a4b9f764140e89279e3d0dace99bfa5f plugins/generic/users.py
44c388ea08d4296e2bf2706e19cbe64a plugins/generic/takeover.py
f57914512ae22521b988b5094f1a0d6f plugins/generic/users.py
fb6be55d21a70765e35549af2484f762 plugins/__init__.py
5dc693e22f5d020c5c568d7325bd4226 shell/backdoors/backdoor.asp_
158bfa168128393dde8d6ed11fe9a1b8 shell/backdoors/backdoor.aspx_
@@ -234,7 +236,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_
0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_
2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_
41522f8ad02ac133ca0aeaab374c36a8 sqlmapapi.py
67607879bc78f039b9c9f3be6380d253 sqlmap.py
76998d373c6aef8d36d617a9b21d6eaf sqlmap.py
772fb3dd15edc9d4055ab9f9dee0c203 tamper/0x2char.py
3d89a5c4c33d4d1d9303f5e3bd11f0ae tamper/apostrophemask.py
1fd0eec63970728c1e6628b2e4c21d81 tamper/apostrophenullencode.py
@@ -294,7 +296,7 @@ fc571c746951a5306591e04f70ddc46e tamper/versionedmorekeywords.py
d39ce1f99e268dc7f92b602656f49461 tamper/xforwardedfor.py
b1c02296b4e3b0ebaa58b9dcd914cbf4 thirdparty/ansistrm/ansistrm.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/ansistrm/__init__.py
8e775c25bc9e84891ad6fcb4f0005c23 thirdparty/beautifulsoup/beautifulsoup.py
7abd52c4381afd8ac07d5978c8897c2b thirdparty/beautifulsoup/beautifulsoup.py
cb2e1fe7c404dff41a2ae9132828f532 thirdparty/beautifulsoup/__init__.py
ff54a1d98f0ab01ba7b58b068d2ebd26 thirdparty/bottle/bottle.py
4528e6a7bb9341c36c425faf40ef32c3 thirdparty/bottle/__init__.py
@@ -336,30 +338,30 @@ ee25f2a03587e2c283eab0b36c9e5783 thirdparty/chardet/sbcsgroupprober.py
c9349824f2647962175d321cc0c52134 thirdparty/chardet/sjisprober.py
bcae4c645a737d3f0e7c96a66528ca4a thirdparty/chardet/universaldetector.py
6f8b3e25472c02fb45a75215a175991f thirdparty/chardet/utf8prober.py
3c1b0d627e98643b317244ecfd240bb5 thirdparty/clientform/clientform.py
1dd9a97cef4c8e7da7082c1f0518a19b thirdparty/clientform/clientform.py
722281d87fb13ec22555480f8f4c715b thirdparty/clientform/__init__.py
0b625ccefa6b066f79d3cbb3639267e6 thirdparty/colorama/ansi.py
93bb7f06c8300a91b533ea55e8aead43 thirdparty/colorama/ansitowin32.py
7ec474bef2432a1b45001bb87f2ab25f thirdparty/colorama/ansitowin32.py
ed4d76c08741d34ac79f6488663345f7 thirdparty/colorama/initialise.py
c0707ca77ccb4a2c0f12b4085057193c thirdparty/colorama/__init__.py
ad3d022d4591aee80f7391248d722413 thirdparty/colorama/win32.py
cdd682cbf77137ef4253b77a95ed9bd8 thirdparty/colorama/winterm.py
be7eac2e6cfb45c5e297ec5eee66e747 thirdparty/fcrypt/fcrypt.py
e00542d22ffa8d8ac894c210f38454be thirdparty/fcrypt/__init__.py
2f94ddd6ada38e4091e819568e7c4b7c thirdparty/gprof2dot/gprof2dot.py
5bf76c1e6f4674cec65d89814d989304 thirdparty/gprof2dot/gprof2dot.py
855372c870a23d46683f8aa39d75f6a1 thirdparty/gprof2dot/__init__.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/__init__.py
e3b18f925d125bd17c7e7a7ec0b4b85f thirdparty/keepalive/__init__.py
e0c6a936506bffeed53ce106ec15942d thirdparty/keepalive/keepalive.py
c7e8085d9db7a798540b3bad4546dd4a thirdparty/keepalive/keepalive.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/magic/__init__.py
bf318e0abbe6b2e1a167a233db7f744f thirdparty/magic/magic.py
d41d8cd98f00b204e9800998ecf8427e thirdparty/multipart/__init__.py
03c8abc17b228e59bcfda1f11a9137e0 thirdparty/multipart/multipartpost.py
82432cb4ef575aa16900ba221cc1dc98 thirdparty/multipart/multipartpost.py
3e502b04f3849afbb7f0e13b5fd2b5c1 thirdparty/odict/__init__.py
127fe54fdb9b13fdac93c8fc9c9cad5e thirdparty/odict/odict.py
08801ea0ba9ae22885275ef65d3ee9dc thirdparty/oset/_abc.py
74048dca0470bc78af73f0aafccfd069 thirdparty/odict/odict.py
0105f1734f326704d2d68839084ca661 thirdparty/oset/_abc.py
54a861de0f08bb80c2e8846579ec83bd thirdparty/oset/__init__.py
179f0c584ef3fb39437bdb6e15d9c867 thirdparty/oset/pyoset.py
6c79e6d14e031beebe6de127b53c7c93 thirdparty/oset/pyoset.py
94a4abc0fdac64ef0661b82aff68d791 thirdparty/prettyprint/__init__.py
ff80a22ee858f5331b0c088efa98b3ff thirdparty/prettyprint/prettyprint.py
5c70f8e5f7353aedc6d8d21d4fb72b37 thirdparty/pydes/__init__.py
@@ -371,7 +373,7 @@ d97198005a387a9d23916c616620ef7f thirdparty/termcolor/termcolor.py
bf55909ad163b58236e44b86e8441b26 thirdparty/wininetpton/__init__.py
a44e7cf30f2189b2fbdb635b310cdc0c thirdparty/wininetpton/win_inet_pton.py
855372c870a23d46683f8aa39d75f6a1 thirdparty/xdot/__init__.py
593473084228b63a12318d812e50f1e2 thirdparty/xdot/xdot.py
fb6c71a25d5a93bf20ab99fe4e31e0dd thirdparty/xdot/xdot.py
08c706478fad0acba049d0e32cbb6411 udf/mysql/linux/32/lib_mysqludf_sys.so_
1501fa7150239b18acc0f4a9db2ebc0d udf/mysql/linux/64/lib_mysqludf_sys.so_
70d83edb90c4a20bd95eb62f71c99bd0 udf/mysql/windows/32/lib_mysqludf_sys.dll_
@@ -396,76 +398,83 @@ a6b9c964f7c7d7012f8f434bbd84a041 udf/postgresql/windows/32/8.2/lib_postgresqlud
d9006810684baf01ea33281d21522519 udf/postgresql/windows/32/8.3/lib_postgresqludf_sys.dll_
ca3ab78d6ed53b7f2c07ed2530d47efd udf/postgresql/windows/32/8.4/lib_postgresqludf_sys.dll_
0d3fe0293573a4453463a0fa5a081de1 udf/postgresql/windows/32/9.0/lib_postgresqludf_sys.dll_
129c2436cf3e0dd9ba0429b2f45a0113 waf/360.py
d6f06b1463501392e7e578d511ffb4d8 waf/360.py
2d63c46bed78aec2966a363d5db800fd waf/aesecure.py
2add09865acdb6edc40d326446ac6e40 waf/airlock.py
94eec6c5d02357596292d36a8533f08f waf/anquanbao.py
b6bc83ae9ea69cf96e9389bde8250c7c waf/airlock.py
34b8ec9f438d7daa56aa016e6c09fadb waf/anquanbao.py
7ab1a7cd51a02899592f4f755d36a02e waf/approach.py
425f2599f57ab81b4fff67e6b442cccc waf/armor.py
fac23fc2e564edaf90a4346f3ee525b0 waf/asm.py
46a1d30bb52048c2092593acfa71bd52 waf/asm.py
9dbec5d674ed4c762ffc9bc3ab402739 waf/aws.py
29b14801171574a3d92a30542a32be54 waf/baidu.py
4fd9a8e3aac364fe5509b23e7eb5a448 waf/barracuda.py
2bb132ecea25e947e7e82e32e7dd6b3a waf/bigip.py
742f8c9b7f3a858e11dfd2ce3df65c6e waf/binarysec.py
ef8c5db49ad9973b59d6b9b65b001714 waf/blockdos.py
e57a22864477ad23ae6a3d308f9b5410 waf/barracuda.py
941714dfea605d59cb1544e5c376ac58 waf/bekchy.py
1712d76bd4adb705f3317ff5908acdcd waf/bitninja.py
2608fbe2c80fae99bb09db1f93d80cdd waf/bluedon.py
8385218d8a1863dbfd4274db36880dfe waf/cerber.py
5ae64cad95b7f904c350cc81230c3bd1 waf/chinacache.py
a05edf8f2962dfff0457b7a4fd5e169c waf/ciscoacexml.py
af079de99a8ec6988d28aa4c0aa32cf9 waf/cloudbric.py
8fec83056c8728076ab17ab3a2ebbe7b waf/cloudflare.py
5672c1ae038dcfc523a6d82d9875025c waf/cloudfront.py
9ae3dfb7c03da53fb67c6c3cb56b4827 waf/cloudfront.py
847ee97f6e0f8aeec61afd3e0c91543b waf/comodo.py
f7571543ccb671a63a8139e375d6a4f2 waf/crawlprotect.py
f20b14ca9f7c2442fd1e9432d933a75b waf/datapower.py
e49bb75985f60556b4481dc085f3c62b waf/denyall.py
dbe50bbcb1b4664d6cebfcca63e75125 waf/distil.py
2e8bf326975edcb4d627493c46c6807c waf/dosarrest.py
4ed76fdf2add2405bb6157ac025e01b9 waf/crawlprotect.py
4254527ec80588f5289f56c7b52c4b30 waf/distil.py
886c6502a6a2aae49921efed8d439f7b waf/dotdefender.py
a8412619d7f26ed6bc9e0b20a57b2324 waf/edgecast.py
17e7ac56629b25a9ea8cfe01c3604745 waf/expressionengine.py
5df01dde939c0d22bc163730873e9854 waf/expressionengine.py
588d2f9a8f201e120e74e508564cb487 waf/fortiweb.py
0e9eb20967d2dde941cca8c663a63e1f waf/generic.py
2aa7775dac8df4a3cdb736fdf51dc9cb waf/hyperguard.py
1adbd0c470d1bbcec370722f05094255 waf/incapsula.py
447f6d63b6f691a852ca198afaaac4a6 waf/generic.py
4ea580dd1b9679bd733866976ad5d81e waf/godaddy.py
27385b15477031a3aff25df601a1ff51 waf/greywizard.py
256a7ea2c1cd2745fe788cf8f6123f8a waf/imunify360.py
f4e3fb185b92483832d14b532f467b35 waf/incapsula.py
fb6be55d21a70765e35549af2484f762 waf/__init__.py
a3ee375714987acccc26d1b07c2e8af7 waf/isaserver.py
e6994165497cef25d7a785cd3d4a3c64 waf/janusec.py
ce9cf35919a92d65347bb74ca0c5c86f waf/jiasule.py
f44ed04eeb4287c11ce277703ec7d72d waf/knownsec.py
d50d82bec48814eb5b699d302dbdae9a waf/kona.py
10b1c6891494b780d1966e47fca2b58a waf/modsecurity.py
8c3977c543ca4ec6d4231f604217cf94 waf/kona.py
d4f36e44f496f4d51baa3241eabc60fd waf/malcare.py
509af267f45485f3cb1c839fa040ff07 waf/modsecurity.py
78af8e791207db9723a14bddeb7524af waf/naxsi.py
504ade4d32bdbbd2932eebb07f57c3eb waf/netcontinuum.py
47ef4146cac17e3244bbc1a93fb51942 waf/netscaler.py
84e9c68b6ecffafb5ec8cd96acaf62b9 waf/newdefend.py
69fc40e85751279e9018d643742db04e waf/nsfocus.py
7ff3c93f2c77a984ebbf217c7c38a796 waf/paloalto.py
8004b57e9b8e19060aae5b82ecb87472 waf/netscaler.py
96e1902b7e4297173d519b00c86f6a02 waf/newdefend.py
d03dfe93a14c966b88f5baf59ce2b091 waf/ninjafirewall.py
a59aff03a5b3fb40ea0feb3489677040 waf/onmessageshield.py
532b6f8de357a9b88a313944e1756538 waf/paloalto.py
f9de9375ffd0447ba93b215493d327a1 waf/perimeterx.py
2979bb64c24256a83625d75a385dde9b waf/profense.py
8de0d46738335a4e498c4ac9038ac3c3 waf/proventia.py
ac60456fe7af4eb501d448910e98ee4b waf/radware.py
dba6a3b52851d2d7a0a1ab83a51caa5a waf/reblaze.py
1315066be1abb4f1d34290239be0af14 waf/reblaze.py
987389e4f403b7615d6d8006420a6260 waf/requestvalidationmode.py
2a7b234e903d13b3c21d6c17e05d1c46 waf/safe3.py
4382cb217354d816580ee07178d0a8c7 waf/safedog.py
8dae5619edafaaceccf1c4eb051c7d22 waf/rsfirewall.py
d2d9718de217dd07d9e66b2e6ad61380 waf/safe3.py
213062db202a6eb0939a6674f96be551 waf/safedog.py
34440ee94fcff88b4158e86635176547 waf/secureentry.py
ac0728ddb7a15b46b0eabd78cd661f8c waf/secureiis.py
d425f890541a81cc11b0905842194274 waf/securesphere.py
ba37e1c37fa0e3688873f74183a9cb9c waf/senginx.py
4d79866c7cff0d7650a22d0a85126c05 waf/sitelock.py
2602a8baed4da643e606a379e4dc75db waf/shieldsecurity.py
fc21ce1e6e597e44818c03d9cb859e83 waf/siteground.py
332f27cfa02abca513719851850c782e waf/siteguard.py
c842d298e61a87b32668c8402a0d87b5 waf/sitelock.py
a840fcd2bb042694f9aab2859e7c9b30 waf/sonicwall.py
45683bfe7a428f47745416c727a789bd waf/sophos.py
a0aa5997d0d5db18920840220dc4ad36 waf/stingray.py
ed1ecabfa8396e70494b0a3d70a22eb1 waf/squarespace.py
8ace2ad70a4bba8825c8538e349839da waf/stackpath.py
74bd52941b606d15f1a6cdc7b52f761c waf/sucuri.py
205beb7ed5e70119f8700a9e295b6a4a waf/tencent.py
ef6f83952ce6b5a7bbb19f9b903af2b6 waf/teros.py
ba0fb1e6b815446b9d6f30950900fc80 waf/trafficshield.py
1c15216824f96e23a76591ac29eb6d7d waf/urlmaster.py
876c746d96193071271cb8b7e00e1422 waf/urlscan.py
45f28286ffd89200d4c9b6d88a7a518f waf/uspses.py
2d9d9fa8359a9f721e4b977d3da52410 waf/varnish.py
80314083009c87d32bf32d84e8bbb7be waf/varnish.py
455bb16f552e7943e0a5cf35e83a74ea waf/virusdie.py
67df54343a85fe053226e2a5483b2c64 waf/wallarm.py
6aad5ef252bf428e9bbebe650c0cf67e waf/watchguard.py
c8dcaa89f6cde684a578fdc2e9ab2bb8 waf/webappsecure.py
114000c53115fa8f4dd9b1b9122ec32a waf/watchguard.py
a7b8c4c3d1463409e0e204932f0ddff0 waf/webknight.py
16e421475ff62b203298e669edca7b40 waf/wordfence.py
e16122cb40e5f3a66cba359cfb672bd2 waf/yundun.py
ac9e4e3ced77012ed97284634a9ffc74 waf/wordfence.py
e69f77220558564785f0b3c961782a93 waf/yundun.py
a560bee3e948b97af2c88805933dcaad waf/yunsuo.py
c8b6517da2c8a28d474956e3a6b8c1ed waf/zenedge.py
e68f399aeaa5b516f043af88dd4871a0 xml/banner/generic.xml
+1 -1
View File
@@ -2604,4 +2604,4 @@ login_count
# Misc
u_pass
u_pass
+2 -3
View File
@@ -5,8 +5,6 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "360 Web Application Firewall (360)"
@@ -16,8 +14,9 @@ def detect(get_page):
for vector in WAF_ATTACK_VECTORS:
page, headers, code = get_page(get=vector)
retval = re.search(r"wangzhan\.360\.cn", headers.get("X-Powered-By-360wzb", ""), re.I) is not None
retval = headers.get("X-Powered-By-360wzb") is not None
retval |= code == 493 and "/wzws-waf-cgi/" in (page or "")
retval |= all(_ in (page or "") for _ in ("eventID", "If you are the Webmaster", "<title>493</title>"))
if retval:
break
+2 -1
View File
@@ -16,8 +16,9 @@ def detect(get_page):
retval = False
for vector in WAF_ATTACK_VECTORS:
_, headers, _ = get_page(get=vector)
page, headers, _ = get_page(get=vector)
retval = re.search(r"\AAL[_-]?(SESS|LB)", headers.get(HTTP_HEADER.SET_COOKIE, ""), re.I) is not None
retval |= all(_ in (page or "") for _ in ("The server detected a syntax error in your request", "Check your request and all parameters", "Bad Request", "Your request ID was"))
if retval:
break
+1 -4
View File
@@ -5,8 +5,6 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "Anquanbao Web Application Firewall (Anquanbao)"
@@ -16,8 +14,7 @@ def detect(get_page):
for vector in WAF_ATTACK_VECTORS:
page, headers, code = get_page(get=vector)
retval = re.search(r"MISS", headers.get("X-Powered-By-Anquanbao", ""), re.I) is not None
retval |= code == 405 and any(_ in (page or "") for _ in ("/aqb_cc/error/", "hidden_intercept_time"))
retval = code == 405 and any(_ in (page or "") for _ in ("/aqb_cc/error/", "hidden_intercept_time"))
if retval:
break

Some files were not shown because too many files have changed in this diff Show More