sqlmap/lib/core/enums.py

392 lines
11 KiB
Python
Raw Normal View History

2019-05-08 13:47:52 +03:00
#!/usr/bin/env python
"""
2019-01-05 23:38:52 +03:00
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
2017-10-11 15:50:46 +03:00
See the file 'LICENSE' for copying permission
"""
2019-05-29 17:42:04 +03:00
class PRIORITY(object):
2011-04-30 17:20:05 +04:00
LOWEST = -100
LOWER = -50
LOW = -10
NORMAL = 0
HIGH = 10
HIGHER = 50
HIGHEST = 100
2019-05-29 17:42:04 +03:00
class SORT_ORDER(object):
2011-04-30 17:20:05 +04:00
FIRST = 0
SECOND = 1
THIRD = 2
FOURTH = 3
FIFTH = 4
LAST = 100
2011-01-13 14:24:03 +03:00
2018-02-06 12:27:10 +03:00
# Reference: https://docs.python.org/2/library/logging.html#logging-levels
2019-05-29 17:42:04 +03:00
class LOGGING_LEVELS(object):
2018-02-06 12:27:10 +03:00
NOTSET = 0
DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
CRITICAL = 50
2019-05-29 17:42:04 +03:00
class DBMS(object):
2011-04-30 17:20:05 +04:00
ACCESS = "Microsoft Access"
2013-01-04 02:57:07 +04:00
DB2 = "IBM DB2"
2011-02-04 18:57:53 +03:00
FIREBIRD = "Firebird"
2011-04-30 17:20:05 +04:00
MAXDB = "SAP MaxDB"
MSSQL = "Microsoft SQL Server"
MYSQL = "MySQL"
ORACLE = "Oracle"
PGSQL = "PostgreSQL"
SQLITE = "SQLite"
SYBASE = "Sybase"
2013-07-01 15:01:53 +04:00
HSQLDB = "HSQLDB"
2018-10-16 13:23:07 +03:00
H2 = "H2"
INFORMIX = "Informix"
2012-02-15 18:05:50 +04:00
2019-05-29 17:42:04 +03:00
class DBMS_DIRECTORY_NAME(object):
2012-02-15 18:05:50 +04:00
ACCESS = "access"
DB2 = "db2"
FIREBIRD = "firebird"
MAXDB = "maxdb"
MSSQL = "mssqlserver"
MYSQL = "mysql"
ORACLE = "oracle"
PGSQL = "postgresql"
SQLITE = "sqlite"
SYBASE = "sybase"
HSQLDB = "hsqldb"
2018-10-16 13:23:07 +03:00
H2 = "h2"
INFORMIX = "informix"
2019-05-29 17:42:04 +03:00
class CUSTOM_LOGGING(object):
2011-12-26 16:24:39 +04:00
PAYLOAD = 9
TRAFFIC_OUT = 8
TRAFFIC_IN = 7
2019-05-29 17:42:04 +03:00
class OS(object):
2011-04-30 17:20:05 +04:00
LINUX = "Linux"
WINDOWS = "Windows"
2019-05-29 17:42:04 +03:00
class PLACE(object):
2011-04-30 17:20:05 +04:00
GET = "GET"
POST = "POST"
URI = "URI"
COOKIE = "Cookie"
2012-07-26 14:26:57 +04:00
USER_AGENT = "User-Agent"
2011-02-12 02:07:03 +03:00
REFERER = "Referer"
HOST = "Host"
CUSTOM_POST = "(custom) POST"
2013-01-13 19:22:43 +04:00
CUSTOM_HEADER = "(custom) HEADER"
2010-11-08 12:44:32 +03:00
2019-05-29 17:42:04 +03:00
class POST_HINT(object):
2012-10-04 13:25:44 +04:00
SOAP = "SOAP"
JSON = "JSON"
JSON_LIKE = "JSON-like"
2012-10-16 14:32:58 +04:00
MULTIPART = "MULTIPART"
XML = "XML (generic)"
2014-10-09 17:21:26 +04:00
ARRAY_LIKE = "Array-like"
2012-10-04 13:25:44 +04:00
2019-05-29 17:42:04 +03:00
class HTTPMETHOD(object):
2011-04-30 17:20:05 +04:00
GET = "GET"
POST = "POST"
HEAD = "HEAD"
2013-04-10 18:43:57 +04:00
PUT = "PUT"
2015-11-16 17:32:28 +03:00
DELETE = "DELETE"
2013-04-10 18:43:57 +04:00
TRACE = "TRACE"
OPTIONS = "OPTIONS"
CONNECT = "CONNECT"
PATCH = "PATCH"
2010-11-08 12:49:57 +03:00
2019-05-29 17:42:04 +03:00
class NULLCONNECTION(object):
2011-04-30 17:20:05 +04:00
HEAD = "HEAD"
RANGE = "Range"
2013-05-17 17:04:25 +04:00
SKIP_READ = "skip-read"
2019-05-29 17:42:04 +03:00
class REFLECTIVE_COUNTER(object):
2011-05-30 13:46:32 +04:00
MISS = "MISS"
HIT = "HIT"
2019-05-29 17:42:04 +03:00
class CHARSET_TYPE(object):
2012-09-07 12:09:00 +04:00
BINARY = 1
DIGITS = 2
HEXADECIMAL = 3
ALPHA = 4
ALPHANUM = 5
2019-05-29 17:42:04 +03:00
class HEURISTIC_TEST(object):
2012-09-07 12:09:00 +04:00
CASTED = 1
NEGATIVE = 2
POSITIVE = 3
2019-05-29 17:42:04 +03:00
class HASH(object):
2011-04-30 17:20:05 +04:00
MYSQL = r'(?i)\A\*[0-9a-f]{40}\Z'
2011-12-27 16:31:29 +04:00
MYSQL_OLD = r'(?i)\A(?![0-9]+\Z)[0-9a-f]{16}\Z'
2011-04-30 17:20:05 +04:00
POSTGRES = r'(?i)\Amd5[0-9a-f]{32}\Z'
MSSQL = r'(?i)\A0x0100[0-9a-f]{8}[0-9a-f]{40}\Z'
MSSQL_OLD = r'(?i)\A0x0100[0-9a-f]{8}[0-9a-f]{80}\Z'
MSSQL_NEW = r'(?i)\A0x0200[0-9a-f]{8}[0-9a-f]{128}\Z'
2011-04-30 17:20:05 +04:00
ORACLE = r'(?i)\As:[0-9a-f]{60}\Z'
2017-10-17 11:38:33 +03:00
ORACLE_OLD = r'(?i)\A[0-9a-f]{16}\Z'
2019-08-26 18:27:32 +03:00
MD5_GENERIC = r'(?i)\A(0x)?[0-9a-f]{32}\Z'
SHA1_GENERIC = r'(?i)\A(0x)?[0-9a-f]{40}\Z'
SHA224_GENERIC = r'(?i)\A[0-9a-f]{56}\Z'
2019-08-26 18:27:32 +03:00
SHA256_GENERIC = r'(?i)\A(0x)?[0-9a-f]{64}\Z'
SHA384_GENERIC = r'(?i)\A[0-9a-f]{96}\Z'
2019-08-26 18:27:32 +03:00
SHA512_GENERIC = r'(?i)\A(0x)?[0-9a-f]{128}\Z'
CRYPT_GENERIC = r'\A(?!\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\Z)(?![0-9]+\Z)[./0-9A-Za-z]{13}\Z'
JOOMLA = r'\A[0-9a-f]{32}:\w{32}\Z'
WORDPRESS = r'\A\$P\$[./0-9a-zA-Z]{31}\Z'
APACHE_MD5_CRYPT = r'\A\$apr1\$.{1,8}\$[./a-zA-Z0-9]+\Z'
UNIX_MD5_CRYPT = r'\A\$1\$.{1,8}\$[./a-zA-Z0-9]+\Z'
APACHE_SHA1 = r'\A\{SHA\}[a-zA-Z0-9+/]+={0,2}\Z'
VBULLETIN = r'\A[0-9a-fA-F]{32}:.{30}\Z'
VBULLETIN_OLD = r'\A[0-9a-fA-F]{32}:.{3}\Z'
SSHA = r'\A\{SSHA\}[a-zA-Z0-9+/]+={0,2}\Z'
SSHA256 = r'\A\{SSHA256\}[a-zA-Z0-9+/]+={0,2}\Z'
SSHA512 = r'\A\{SSHA512\}[a-zA-Z0-9+/]+={0,2}\Z'
DJANGO_MD5 = r'\Amd5\$[^$]+\$[0-9a-f]{32}\Z'
DJANGO_SHA1 = r'\Asha1\$[^$]+\$[0-9a-f]{40}\Z'
MD5_BASE64 = r'\A[a-zA-Z0-9+/]{22}==\Z'
SHA1_BASE64 = r'\A[a-zA-Z0-9+/]{27}=\Z'
SHA256_BASE64 = r'\A[a-zA-Z0-9+/]{43}=\Z'
SHA512_BASE64 = r'\A[a-zA-Z0-9+/]{86}==\Z'
# Reference: http://www.zytrax.com/tech/web/mobile_ids.html
2019-05-29 17:42:04 +03:00
class MOBILES(object):
2019-03-02 03:28:58 +03:00
BLACKBERRY = ("BlackBerry Z10", "Mozilla/5.0 (BB10; Kbd) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.3.3.2205 Mobile Safari/537.35+")
GALAXY = ("Samsung Galaxy S7", "Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36")
2012-10-30 13:30:22 +04:00
HP = ("HP iPAQ 6365", "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)")
2019-03-02 03:28:58 +03:00
HTC = ("HTC 10", "Mozilla/5.0 (Linux; Android 8.0.0; HTC 10 Build/OPR1.170623.027) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36")
HUAWEI = ("Huawei P8", "Mozilla/5.0 (Linux; Android 4.4.4; HUAWEI H891L Build/HuaweiH891L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36")
IPHONE = ("Apple iPhone 8", "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1")
LUMIA = ("Microsoft Lumia 950", "Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Mobile Safari/537.36 Edge/15.14977")
2012-10-30 13:30:22 +04:00
NEXUS = ("Google Nexus 7", "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
NOKIA = ("Nokia N97", "Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/10.0.012; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) WicKed/7.1.12344")
2019-03-02 03:28:58 +03:00
PIXEL = ("Google Pixel", "Mozilla/5.0 (Linux; Android 8.0.0; Pixel Build/OPR3.170623.013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36")
XIAOMI = ("Xiaomi Mi 3", "Mozilla/5.0 (Linux; U; Android 4.4.4; en-gb; MI 3W Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36 XiaoMi/MiuiBrowser/2.1.1")
2011-04-29 23:27:23 +04:00
2019-05-29 17:42:04 +03:00
class PROXY_TYPE(object):
2011-12-16 03:19:55 +04:00
HTTP = "HTTP"
HTTPS = "HTTPS"
2011-12-16 03:19:55 +04:00
SOCKS4 = "SOCKS4"
SOCKS5 = "SOCKS5"
2019-05-29 17:42:04 +03:00
class REGISTRY_OPERATION(object):
2014-04-06 20:19:54 +04:00
READ = "read"
ADD = "add"
DELETE = "delete"
2019-05-29 17:42:04 +03:00
class DUMP_FORMAT(object):
2012-11-28 13:58:18 +04:00
CSV = "CSV"
HTML = "HTML"
SQLITE = "SQLITE"
2019-05-29 17:42:04 +03:00
class HTTP_HEADER(object):
ACCEPT = "Accept"
2011-11-29 23:17:07 +04:00
ACCEPT_CHARSET = "Accept-Charset"
2011-04-30 17:20:05 +04:00
ACCEPT_ENCODING = "Accept-Encoding"
2011-11-29 23:17:07 +04:00
ACCEPT_LANGUAGE = "Accept-Language"
2011-04-30 17:20:05 +04:00
AUTHORIZATION = "Authorization"
2011-11-29 23:17:07 +04:00
CACHE_CONTROL = "Cache-Control"
2011-04-30 17:20:05 +04:00
CONNECTION = "Connection"
CONTENT_ENCODING = "Content-Encoding"
CONTENT_LENGTH = "Content-Length"
CONTENT_RANGE = "Content-Range"
CONTENT_TYPE = "Content-Type"
COOKIE = "Cookie"
2015-12-30 14:41:56 +03:00
EXPIRES = "Expires"
HOST = "Host"
2015-12-30 14:41:56 +03:00
IF_MODIFIED_SINCE = "If-Modified-Since"
LAST_MODIFIED = "Last-Modified"
2014-12-04 12:06:15 +03:00
LOCATION = "Location"
2011-11-29 23:17:07 +04:00
PRAGMA = "Pragma"
PROXY_AUTHORIZATION = "Proxy-Authorization"
PROXY_CONNECTION = "Proxy-Connection"
2011-04-30 17:20:05 +04:00
RANGE = "Range"
REFERER = "Referer"
2017-01-16 16:29:23 +03:00
REFRESH = "Refresh" # Reference: http://stackoverflow.com/a/283794
SERVER = "Server"
2015-12-30 14:41:56 +03:00
SET_COOKIE = "Set-Cookie"
2013-02-22 00:34:26 +04:00
TRANSFER_ENCODING = "Transfer-Encoding"
2014-08-27 01:36:04 +04:00
URI = "URI"
2015-12-30 14:41:56 +03:00
USER_AGENT = "User-Agent"
2013-02-26 18:30:11 +04:00
VIA = "Via"
2015-12-19 19:50:12 +03:00
X_POWERED_BY = "X-Powered-By"
2017-10-01 19:45:02 +03:00
X_DATA_ORIGIN = "X-Data-Origin"
2011-03-11 23:16:34 +03:00
2019-05-29 17:42:04 +03:00
class EXPECTED(object):
2011-04-30 17:20:05 +04:00
BOOL = "bool"
INT = "int"
2010-12-10 15:30:36 +03:00
2019-05-29 17:42:04 +03:00
class OPTION_TYPE(object):
2014-04-25 11:17:10 +04:00
BOOLEAN = "boolean"
INTEGER = "integer"
FLOAT = "float"
STRING = "string"
2019-05-29 17:42:04 +03:00
class HASHDB_KEYS(object):
DBMS = "DBMS"
2016-05-14 16:05:50 +03:00
DBMS_FORK = "DBMS_FORK"
CHECK_WAF_RESULT = "CHECK_WAF_RESULT"
2019-03-25 13:42:16 +03:00
CHECK_NULL_CONNECTION_RESULT = "CHECK_NULL_CONNECTION_RESULT"
CONF_TMP_PATH = "CONF_TMP_PATH"
2011-12-28 17:50:03 +04:00
KB_ABS_FILE_PATHS = "KB_ABS_FILE_PATHS"
KB_BRUTE_COLUMNS = "KB_BRUTE_COLUMNS"
KB_BRUTE_TABLES = "KB_BRUTE_TABLES"
KB_CHARS = "KB_CHARS"
2012-02-28 18:04:13 +04:00
KB_DYNAMIC_MARKINGS = "KB_DYNAMIC_MARKINGS"
KB_INJECTIONS = "KB_INJECTIONS"
2015-08-26 16:26:16 +03:00
KB_ERROR_CHUNK_LENGTH = "KB_ERROR_CHUNK_LENGTH"
KB_XP_CMDSHELL_AVAILABLE = "KB_XP_CMDSHELL_AVAILABLE"
OS = "OS"
2011-12-28 17:50:03 +04:00
2019-05-29 17:42:04 +03:00
class REDIRECTION(object):
2019-08-30 15:43:56 +03:00
YES = 'Y'
NO = 'N'
2019-05-29 17:42:04 +03:00
class PAYLOAD(object):
SQLINJECTION = {
1: "boolean-based blind",
2: "error-based",
3: "inline query",
4: "stacked queries",
2019-03-12 13:05:27 +03:00
5: "time-based blind",
6: "UNION query",
}
PARAMETER = {
1: "Unescaped numeric",
2: "Single quoted string",
3: "LIKE single quoted string",
4: "Double quoted string",
5: "LIKE double quoted string",
2018-09-30 00:10:03 +03:00
6: "Identifier (e.g. column name)",
}
RISK = {
0: "No risk",
1: "Low risk",
2: "Medium risk",
3: "High risk",
}
CLAUSE = {
0: "Always",
1: "WHERE",
2: "GROUP BY",
3: "ORDER BY",
4: "LIMIT",
5: "OFFSET",
6: "TOP",
7: "Table name",
8: "Column name",
2018-09-30 00:10:03 +03:00
9: "Pre-WHERE (non-query)",
}
2010-12-06 18:50:19 +03:00
2019-05-29 17:42:04 +03:00
class METHOD(object):
2011-04-30 17:20:05 +04:00
COMPARISON = "comparison"
GREP = "grep"
TIME = "time"
UNION = "union"
2010-12-08 16:04:48 +03:00
2019-05-29 17:42:04 +03:00
class TECHNIQUE(object):
2010-12-08 16:04:48 +03:00
BOOLEAN = 1
ERROR = 2
2015-02-20 21:31:47 +03:00
QUERY = 3
2010-12-08 16:04:48 +03:00
STACKED = 4
TIME = 5
2015-02-20 21:31:47 +03:00
UNION = 6
2011-02-02 16:34:09 +03:00
2019-05-29 17:42:04 +03:00
class WHERE(object):
2011-02-02 16:34:09 +03:00
ORIGINAL = 1
NEGATIVE = 2
REPLACE = 3
2012-10-05 12:24:09 +04:00
2019-05-29 17:42:04 +03:00
class WIZARD(object):
2012-10-05 12:24:09 +04:00
BASIC = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba")
INTERMEDIATE = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getUsers", "getDbs", "getTables", "getSchema", "excludeSysDbs")
2012-10-05 12:24:09 +04:00
ALL = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getHostname", "getUsers", "getPasswordHashes", "getPrivileges", "getRoles", "dumpAll")
2012-10-09 17:19:47 +04:00
2019-05-29 17:42:04 +03:00
class ADJUST_TIME_DELAY(object):
2012-10-09 17:19:47 +04:00
DISABLE = -1
NO = 0
YES = 1
2012-10-29 13:48:49 +04:00
2019-05-29 17:42:04 +03:00
class WEB_PLATFORM(object):
2012-10-29 13:48:49 +04:00
PHP = "php"
ASP = "asp"
ASPX = "aspx"
JSP = "jsp"
2019-05-29 17:42:04 +03:00
class CONTENT_TYPE(object):
2017-02-06 13:14:45 +03:00
TARGET = 0
TECHNIQUES = 1
DBMS_FINGERPRINT = 2
BANNER = 3
CURRENT_USER = 4
CURRENT_DB = 5
HOSTNAME = 6
IS_DBA = 7
USERS = 8
PASSWORDS = 9
PRIVILEGES = 10
ROLES = 11
DBS = 12
TABLES = 13
COLUMNS = 14
SCHEMA = 15
COUNT = 16
DUMP_TABLE = 17
SEARCH = 18
SQL_QUERY = 19
COMMON_TABLES = 20
COMMON_COLUMNS = 21
FILE_READ = 22
FILE_WRITE = 23
OS_CMD = 24
REG_READ = 25
2019-05-29 16:52:33 +03:00
STATEMENTS = 26
2019-05-29 17:42:04 +03:00
class CONTENT_STATUS(object):
IN_PROGRESS = 0
COMPLETE = 1
2019-05-29 17:42:04 +03:00
class AUTH_TYPE(object):
BASIC = "basic"
DIGEST = "digest"
NTLM = "ntlm"
PKI = "pki"
2014-09-16 11:07:31 +04:00
2019-05-29 17:42:04 +03:00
class AUTOCOMPLETE_TYPE(object):
2014-09-16 11:07:31 +04:00
SQL = 0
OS = 1
2014-09-16 16:12:43 +04:00
SQLMAP = 2
2018-06-21 00:04:58 +03:00
API = 3
2016-05-06 14:06:59 +03:00
2019-05-29 17:42:04 +03:00
class NOTE(object):
2016-05-06 14:06:59 +03:00
FALSE_POSITIVE_OR_UNEXPLOITABLE = "false positive or unexploitable"
2016-05-31 14:02:26 +03:00
2019-05-29 17:42:04 +03:00
class MKSTEMP_PREFIX(object):
2016-05-31 14:02:26 +03:00
HASHES = "sqlmaphashes-"
CRAWLER = "sqlmapcrawler-"
IPC = "sqlmapipc-"
2017-04-10 15:50:17 +03:00
CONFIG = "sqlmapconfig-"
2016-05-31 14:02:26 +03:00
TESTING = "sqlmaptesting-"
RESULTS = "sqlmapresults-"
COOKIE_JAR = "sqlmapcookiejar-"
BIG_ARRAY = "sqlmapbigarray-"
2017-07-26 01:24:13 +03:00
SPECIFIC_RESPONSE = "sqlmapresponse-"
2019-03-04 17:24:12 +03:00
PREPROCESS = "sqlmappreprocess-"
2019-05-29 17:42:04 +03:00
class TIMEOUT_STATE(object):
NORMAL = 0
EXCEPTION = 1
TIMEOUT = 2
2018-10-26 13:08:04 +03:00
2019-05-29 17:42:04 +03:00
class HINT(object):
2018-10-26 13:08:04 +03:00
PREPEND = 0
2019-03-02 03:28:58 +03:00
APPEND = 1