diff --git a/extra/shutils/newlines.py b/extra/shutils/newlines.py new file mode 100644 index 000000000..5fd91f969 --- /dev/null +++ b/extra/shutils/newlines.py @@ -0,0 +1,31 @@ +#! /usr/bin/env python + +# Runs pylint on all python scripts found in a directory tree +# Reference: http://rowinggolfer.blogspot.com/2009/08/pylint-recursively.html + +import os +import re +import sys + +def check(filepath): + if filepath.endswith(".py"): + content = open(filepath, "rb").read() + #if re.search(r"\r?\n\r?\n", content): + if "\n\n\n" in content: + index = content.find("\n\n\n") + 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" + BASE_DIRECTORY = os.getcwd() + + 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 + for name in files: + filepath = os.path.join(root, name) + check(filepath) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 510c022a9..d1a26ade3 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -1562,7 +1562,6 @@ def checkConnection(suppressOutput=False): else: kb.errorIsNone = True - threadData = getCurrentThreadData() if kb.redirectChoice == REDIRECTION.YES and threadData.lastRedirectURL and threadData.lastRedirectURL[0] == threadData.lastRequestUID: diff --git a/lib/core/settings.py b/lib/core/settings.py index 6bbc45864..ee4adaa4c 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.2.5.0" +VERSION = "1.2.5.1" 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) diff --git a/lib/parse/headers.py b/lib/parse/headers.py index 1b3c225f3..1f42b1717 100644 --- a/lib/parse/headers.py +++ b/lib/parse/headers.py @@ -13,7 +13,6 @@ from lib.core.data import kb from lib.core.data import paths from lib.parse.handler import FingerprintHandler - def headersParser(headers): """ This function calls a class that parses the input HTTP headers to diff --git a/lib/request/connect.py b/lib/request/connect.py index 92c3f3509..2d6e5dfd0 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -120,7 +120,6 @@ from lib.request.methodrequest import MethodRequest from thirdparty.odict.odict import OrderedDict from thirdparty.socks.socks import ProxyError - class Connect(object): """ This class defines methods used to perform HTTP requests diff --git a/lib/takeover/abstraction.py b/lib/takeover/abstraction.py index eb653c989..490c8c298 100644 --- a/lib/takeover/abstraction.py +++ b/lib/takeover/abstraction.py @@ -27,7 +27,6 @@ from lib.takeover.udf import UDF from lib.takeover.web import Web from lib.takeover.xp_cmdshell import XP_cmdshell - class Abstraction(Web, UDF, XP_cmdshell): """ This class defines an abstraction layer for OS takeover functionalities diff --git a/lib/takeover/web.py b/lib/takeover/web.py index a907bc149..8f5b5616d 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -53,7 +53,6 @@ from lib.core.settings import VIEWSTATE_REGEX from lib.request.connect import Connect as Request from thirdparty.oset.pyoset import oset - class Web: """ This class defines web-oriented OS takeover functionalities for diff --git a/lib/techniques/dns/test.py b/lib/techniques/dns/test.py index 3910e1302..7a580e6e5 100644 --- a/lib/techniques/dns/test.py +++ b/lib/techniques/dns/test.py @@ -14,7 +14,6 @@ from lib.core.dicts import FROM_DUMMY_TABLE from lib.core.exception import SqlmapNotVulnerableException from lib.techniques.dns.use import dnsUse - def dnsTest(payload): logger.info("testing for data retrieval through DNS channel") diff --git a/lib/techniques/dns/use.py b/lib/techniques/dns/use.py index 42914f166..3cf607b54 100644 --- a/lib/techniques/dns/use.py +++ b/lib/techniques/dns/use.py @@ -33,7 +33,6 @@ from lib.core.settings import PARTIAL_VALUE_MARKER from lib.core.unescaper import unescaper from lib.request.connect import Connect as Request - def dnsUse(payload, expression): """ Retrieve the output of a SQL query taking advantage of the DNS diff --git a/lib/utils/api.py b/lib/utils/api.py index 967340fc4..52ee0f442 100644 --- a/lib/utils/api.py +++ b/lib/utils/api.py @@ -104,9 +104,7 @@ class Database(object): def init(self): self.execute("CREATE TABLE logs(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, time TEXT, level TEXT, message TEXT)") - self.execute("CREATE TABLE data(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, status INTEGER, content_type INTEGER, value TEXT)") - self.execute("CREATE TABLE errors(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, error TEXT)") class Task(object): @@ -199,7 +197,6 @@ class Task(object): def engine_has_terminated(self): return isinstance(self.engine_get_returncode(), int) - # Wrapper functions for sqlmap engine class StdDbOut(object): def __init__(self, taskid, messagetype="stdout"): @@ -573,7 +570,6 @@ def scan_data(taskid): logger.debug("[%s] Retrieved scan data and error messages" % taskid) return jsonize({"success": True, "data": json_data_message, "error": json_errors_message}) - # Functions to handle scans' logs @get("/scan//log//") def scan_log_limited(taskid, start, end): @@ -601,7 +597,6 @@ def scan_log_limited(taskid, start, end): logger.debug("[%s] Retrieved scan log messages subset" % taskid) return jsonize({"success": True, "log": json_log_messages}) - @get("/scan//log") def scan_log(taskid): """ @@ -621,7 +616,6 @@ def scan_log(taskid): logger.debug("[%s] Retrieved scan log messages" % taskid) return jsonize({"success": True, "log": json_log_messages}) - # Function to handle files inside the output directory @get("/download///") def download(taskid, target, filename): @@ -648,7 +642,6 @@ def download(taskid, target, filename): logger.warning("[%s] File does not exist %s" % (taskid, target)) return jsonize({"success": False, "message": "File does not exist"}) - def server(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, adapter=RESTAPI_DEFAULT_ADAPTER, username=None, password=None): """ REST-JSON API server diff --git a/lib/utils/getch.py b/lib/utils/getch.py index 65043421e..d2c204ac4 100644 --- a/lib/utils/getch.py +++ b/lib/utils/getch.py @@ -22,7 +22,6 @@ class _Getch(object): def __call__(self): return self.impl() - class _GetchUnix(object): def __init__(self): __import__("tty") @@ -41,7 +40,6 @@ class _GetchUnix(object): termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) return ch - class _GetchWindows(object): def __init__(self): __import__("msvcrt") @@ -50,7 +48,6 @@ class _GetchWindows(object): import msvcrt return msvcrt.getch() - class _GetchMacCarbon(object): """ A function which returns the current ASCII key that is down; @@ -79,5 +76,4 @@ class _GetchMacCarbon(object): (what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1] return chr(msg & 0x000000FF) - getch = _Getch() diff --git a/lib/utils/search.py b/lib/utils/search.py index 8c49b534e..e2cca24b9 100644 --- a/lib/utils/search.py +++ b/lib/utils/search.py @@ -36,7 +36,6 @@ from lib.core.settings import UNICODE_ENCODING from lib.request.basic import decodePage from thirdparty.socks import socks - def _search(dork): """ This method performs the effective search on Google providing diff --git a/plugins/dbms/db2/enumeration.py b/plugins/dbms/db2/enumeration.py index b6b64ac0b..e79d281a8 100644 --- a/plugins/dbms/db2/enumeration.py +++ b/plugins/dbms/db2/enumeration.py @@ -5,7 +5,6 @@ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/) See the file 'LICENSE' for copying permission """ - from lib.core.data import logger from plugins.generic.enumeration import Enumeration as GenericEnumeration diff --git a/plugins/dbms/db2/fingerprint.py b/plugins/dbms/db2/fingerprint.py index ed532a57b..6a584b8a9 100644 --- a/plugins/dbms/db2/fingerprint.py +++ b/plugins/dbms/db2/fingerprint.py @@ -5,7 +5,6 @@ Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/) See the file 'LICENSE' for copying permission """ - from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf diff --git a/plugins/dbms/mssqlserver/__init__.py b/plugins/dbms/mssqlserver/__init__.py index 202d6193c..02a23e967 100644 --- a/plugins/dbms/mssqlserver/__init__.py +++ b/plugins/dbms/mssqlserver/__init__.py @@ -15,7 +15,6 @@ from plugins.dbms.mssqlserver.syntax import Syntax from plugins.dbms.mssqlserver.takeover import Takeover from plugins.generic.misc import Miscellaneous - class MSSQLServerMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover): """ This class defines Microsoft SQL Server methods diff --git a/plugins/dbms/sqlite/connector.py b/plugins/dbms/sqlite/connector.py index ae2722a9a..f214b39a3 100644 --- a/plugins/dbms/sqlite/connector.py +++ b/plugins/dbms/sqlite/connector.py @@ -19,7 +19,6 @@ from lib.core.exception import SqlmapConnectionException from lib.core.exception import SqlmapMissingDependence from plugins.generic.connector import Connector as GenericConnector - class Connector(GenericConnector): """ Homepage: http://pysqlite.googlecode.com/ and http://packages.ubuntu.com/quantal/python-sqlite diff --git a/sqlmap.py b/sqlmap.py index 49dadc228..4593e715b 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -108,7 +108,6 @@ def checkEnvironment(): for _ in ("SqlmapBaseException", "SqlmapShellQuitException", "SqlmapSilentQuitException", "SqlmapUserQuitException"): globals()[_] = getattr(sys.modules["lib.core.exception"], _) - def main(): """ Main function of sqlmap when running from command line. diff --git a/txt/checksum.md5 b/txt/checksum.md5 index e503c6e6b..87a490555 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -16,12 +16,13 @@ d229479d02d21b29f209143cb0547780 extra/shellcodeexec/linux/shellcodeexec.x32_ 2fe2f94eebc62f7614f0391a8a90104f extra/shellcodeexec/linux/shellcodeexec.x64_ c55b400b72acc43e0e59c87dd8bb8d75 extra/shellcodeexec/windows/shellcodeexec.x32.exe_ 220745c50d375dad7aefebf8ca3611ef extra/shutils/duplicates.py +1f33abe1a67493909d29a35ca72ecedb extra/shutils/newlines.py 71b9d4357c31db013ecda27433830090 extra/shutils/pylint.py c88d66597f4aab719bde4542b0a1a6e0 extra/shutils/regressiontest.py 1e5532ede194ac9c083891c2f02bca93 extra/sqlharvest/__init__.py b3e60ea4e18a65c48515d04aab28ff68 extra/sqlharvest/sqlharvest.py 0f581182871148b0456a691ae85b04c0 lib/controller/action.py -aea19b45c6154035a689954719c753dc lib/controller/checks.py +a0ae21cc46b8f5fd0afe0a173ceaab70 lib/controller/checks.py c414cecdb0472c92cf50ed5b01e4438c lib/controller/controller.py c7443613a0a2505b1faec931cee2a6ef lib/controller/handler.py 1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py @@ -46,7 +47,7 @@ c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py -1b801d825811ee4362e07e568e8a928e lib/core/settings.py +0f03fed8767ab10c9bf9789d4deb0bde lib/core/settings.py 0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py 6306284edcccc185b2df085438572b0d lib/core/target.py @@ -60,7 +61,7 @@ e772deb63270375e685fa5a7b775c382 lib/core/wordlist.py 5e46fac7f824ba8ab8003a1cd47d8af3 lib/parse/cmdline.py fb2e2f05dde98caeac6ccf3e67192177 lib/parse/configfile.py 3794ff139869f5ae8e81cfdbe5714f56 lib/parse/handler.py -aaad2a0d80f05eaebe52c71519b3dfc7 lib/parse/headers.py +6bab53ea9d75bc9bb8169d3e8f3f149f lib/parse/headers.py 33f21b11b7963062df8fa2292229df80 lib/parse/html.py 1e5532ede194ac9c083891c2f02bca93 lib/parse/__init__.py ec4e56bbb1349176b2a22e0b99ba6a55 lib/parse/payloads.py @@ -68,7 +69,7 @@ ec4e56bbb1349176b2a22e0b99ba6a55 lib/parse/payloads.py 30eed3a92a04ed2c29770e1b10d39dc0 lib/request/basicauthhandler.py 596988f14408cde1a2d3b5c9f231873a lib/request/basic.py c0cabedead14b8a23353b606672cff42 lib/request/comparison.py -5b7f216827207c085df96bb56ed5e600 lib/request/connect.py +e9bbba4a133effeae86d146286f9116b lib/request/connect.py dd4598675027fae99f2e2475b05986da lib/request/direct.py 2044fce3f4ffa268fcfaaf63241b1e64 lib/request/dns.py eee965d781546d05f36cfd14af050913 lib/request/httpshandler.py @@ -79,30 +80,30 @@ aaf956c1e9855836c3f372e29d481393 lib/request/methodrequest.py aa7cb67139bbc57d67a728fd2abf80ed lib/request/rangehandler.py aa809d825b33bea76a63ecd97cf7792c lib/request/redirecthandler.py 7f12d8f3b6665ed7053954bba70ff718 lib/request/templates.py -8d31425f36a7a9c093eb9bef44589593 lib/takeover/abstraction.py +747f9941a68361bd779ec760f71568e9 lib/takeover/abstraction.py acc1db3667bf910b809eb279b60595eb lib/takeover/icmpsh.py 1e5532ede194ac9c083891c2f02bca93 lib/takeover/__init__.py 46ff5840b29531412bcaa05dac190413 lib/takeover/metasploit.py fb9e34d558293b5d6b9727f440712886 lib/takeover/registry.py 48575dde7bb867b7937769f569a98309 lib/takeover/udf.py -4584ac6ee5c13d4d395f0a7a21d8478c lib/takeover/web.py +2665fa7eedb19a1b10ffe949999b75f1 lib/takeover/web.py f1decf0a987bd3a4bc757212cbe6a6c8 lib/takeover/xp_cmdshell.py 2543e14cc7f6e239b49dd40f41bc34fa lib/techniques/blind/inference.py 1e5532ede194ac9c083891c2f02bca93 lib/techniques/blind/__init__.py 1e5532ede194ac9c083891c2f02bca93 lib/techniques/dns/__init__.py -855355a1a216f6b267a5f089028f1cd8 lib/techniques/dns/test.py -733f3419ff2ea23f75bc24e36f4746d9 lib/techniques/dns/use.py +799faf9008527d2e9da9d923e50f685a lib/techniques/dns/test.py +bad83c6386adf345fbc982bdafbe3b93 lib/techniques/dns/use.py 1e5532ede194ac9c083891c2f02bca93 lib/techniques/error/__init__.py f999f2e88dea9ac8831eb2f468478b5f lib/techniques/error/use.py 1e5532ede194ac9c083891c2f02bca93 lib/techniques/__init__.py 1e5532ede194ac9c083891c2f02bca93 lib/techniques/union/__init__.py a36be917cf86a5ee407c83d74567f324 lib/techniques/union/test.py 11ecf2effbe9f40b361843d546c3c521 lib/techniques/union/use.py -c552f8d924d962a26f2ded250bcea3b8 lib/utils/api.py +8d99c07416df40350ff8836d9d79ebb5 lib/utils/api.py 37dfb641358669f62c2acedff241348b lib/utils/brute.py 31b1e7eb489eac837db6a2bc1dcb7da7 lib/utils/crawler.py de9620f03231d8329ee8434884b6bacd lib/utils/deps.py -635ed692ab141d428d0957b71b25c1aa lib/utils/getch.py +f7af65aa47329d021e2b2cc8521b42a4 lib/utils/getch.py 7af29f61302c8693cd6436d4b69e22d3 lib/utils/har.py 062e4e8fc43ac54305a75ddd0d482f81 lib/utils/hashdb.py cc1cfe36057f1d9bbdcba1bcc03359f9 lib/utils/hash.py @@ -111,7 +112,7 @@ cc1cfe36057f1d9bbdcba1bcc03359f9 lib/utils/hash.py 010d8327239d33af4ce9f25683cfc012 lib/utils/pivotdumptable.py 5cb78b0e60fd7fd84502d62cf85d2064 lib/utils/progress.py 0ec5cec9d93d5ffd1eaeda6e942ecadf lib/utils/purge.py -2e3e7213f50b52fc4d5a014a2ff8d163 lib/utils/search.py +2c5a655c8e94cbe2664ee497752ac1f2 lib/utils/search.py 236a8d9e596602b53f8e0aa09c30c0ef lib/utils/sqlalchemy.py dcc25183c6bd85b172c87cfcbc305ab6 lib/utils/timeout.py 3d230e342a6c8d60ac7c68c556fbba9b lib/utils/versioncheck.py @@ -124,9 +125,9 @@ e657b1b7a295a38ac9ce515158164f00 plugins/dbms/access/__init__.py 77686d7c7e287d5db0a9a87f2c7d4902 plugins/dbms/access/syntax.py 2f1d8706b51497623b2b59c07b552bdc plugins/dbms/access/takeover.py ead470b613e52e718a3062b63b518272 plugins/dbms/db2/connector.py -0884e475c98701f8e698150aa122fb76 plugins/dbms/db2/enumeration.py +4deeda463003ab71e7d2f34a263b5bbf plugins/dbms/db2/enumeration.py da9dccd1f9ec2cf1e53295125dd983a0 plugins/dbms/db2/filesystem.py -ba492b2aaa6432b5548c5a8fa5eec435 plugins/dbms/db2/fingerprint.py +b54dbf44590a5cbefb2b4f8e9a01a383 plugins/dbms/db2/fingerprint.py 95b35cbd859bbced44e7f8fd84486d75 plugins/dbms/db2/__init__.py 82d96d8fcfd565129580260040555623 plugins/dbms/db2/syntax.py 25f0fb28e9defcab48a2e946fbb7550a plugins/dbms/db2/takeover.py @@ -163,7 +164,7 @@ bf7842bb291e2297c3c8d1023eb3e550 plugins/dbms/maxdb/takeover.py f1f1541a54faf67440179fa521f99849 plugins/dbms/mssqlserver/enumeration.py 177e1d55d28ed3190bc0079b8126c6be plugins/dbms/mssqlserver/filesystem.py 51eb413ac62408965be20a812f2412c8 plugins/dbms/mssqlserver/fingerprint.py -affef90b1442285da7e89e46603c502e plugins/dbms/mssqlserver/__init__.py +f25c50a95e5390ecd32be5a011637349 plugins/dbms/mssqlserver/__init__.py 612be1929108e7b4512a49a4a3837bbc plugins/dbms/mssqlserver/syntax.py 08fe8ac7acdfc0e3168b5b069a7c73bf plugins/dbms/mssqlserver/takeover.py f6e1f3f09f32b9cb2ca11c016d373423 plugins/dbms/mysql/connector.py @@ -187,7 +188,7 @@ c8bb829d45752b98e6a03817b92e0fe5 plugins/dbms/postgresql/filesystem.py 470860d3e85d11a67f2220bffaa415e7 plugins/dbms/postgresql/__init__.py 20e6f48f496348be45f3402ebc265dbb plugins/dbms/postgresql/syntax.py 1287acf330da86a93c8e64aff46e3b65 plugins/dbms/postgresql/takeover.py -3009438ba259ca159c5ce9799f27dec1 plugins/dbms/sqlite/connector.py +80a2083a4fb7809d310c3d5ecc94e3c5 plugins/dbms/sqlite/connector.py 5194556e6b1575b1349f8ccfd773952b plugins/dbms/sqlite/enumeration.py 90fa97b84998a01dba7cc8c3329a1223 plugins/dbms/sqlite/filesystem.py ed52c198f3346ceabdef676e9f5d3c0f plugins/dbms/sqlite/fingerprint.py @@ -224,7 +225,7 @@ ec2ba8c757ac96425dcd2b97970edd3a shell/stagers/stager.asp_ 0c48ddb1feb7e38a951ef05a0d48e032 shell/stagers/stager.jsp_ 2f9e459a4cf6a58680978cdce5ff7971 shell/stagers/stager.php_ 4eaeef94314956e4517e5310a28d579a sqlmapapi.py -5d1d27e7237584c4499ee9a3e698e384 sqlmap.py +e585626909b2de432f1fb71e0944b130 sqlmap.py 4c3b8a7daa4bff52e01d4168be0eedbe tamper/apostrophemask.py 4115a55b8aba464723d645b7d3156b6e tamper/apostrophenullencode.py d7e9a979eff4d7315d804a181e66fc93 tamper/appendnullbyte.py