mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-10 09:49:06 +00:00
Some refactoring
This commit is contained in:
@@ -23,6 +23,7 @@ import random
|
||||
import re
|
||||
import socket
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
@@ -37,8 +38,6 @@ from StringIO import StringIO
|
||||
from difflib import SequenceMatcher
|
||||
from math import sqrt
|
||||
from optparse import OptionValueError
|
||||
from subprocess import PIPE
|
||||
from subprocess import Popen as execute
|
||||
from xml.dom import minidom
|
||||
from xml.sax import parse
|
||||
from xml.sax import SAXParseException
|
||||
@@ -1889,7 +1888,7 @@ def getConsoleWidth(default=80):
|
||||
FNULL = open(os.devnull, 'w')
|
||||
except IOError:
|
||||
FNULL = None
|
||||
process = execute("stty size", shell=True, stdout=PIPE, stderr=FNULL or PIPE)
|
||||
process = subprocess.Popen("stty size", shell=True, stdout=subprocess.PIPE, stderr=FNULL or subprocess.PIPE)
|
||||
stdout, _ = process.communicate()
|
||||
items = stdout.split()
|
||||
|
||||
|
||||
@@ -1335,17 +1335,17 @@ def _setHTTPAuthentication():
|
||||
debugMsg = "setting the HTTP authentication type and credentials"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
aTypeLower = conf.authType.lower()
|
||||
authType = conf.authType.lower()
|
||||
|
||||
if aTypeLower in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST):
|
||||
if authType in (AUTH_TYPE.BASIC, AUTH_TYPE.DIGEST):
|
||||
regExp = "^(.*?):(.*?)$"
|
||||
errMsg = "HTTP %s authentication credentials " % aTypeLower
|
||||
errMsg = "HTTP %s authentication credentials " % authType
|
||||
errMsg += "value must be in format 'username:password'"
|
||||
elif aTypeLower == AUTH_TYPE.NTLM:
|
||||
elif authType == AUTH_TYPE.NTLM:
|
||||
regExp = "^(.*\\\\.*):(.*?)$"
|
||||
errMsg = "HTTP NTLM authentication credentials value must "
|
||||
errMsg += "be in format 'DOMAIN\username:password'"
|
||||
elif aTypeLower == AUTH_TYPE.PKI:
|
||||
elif authType == AUTH_TYPE.PKI:
|
||||
errMsg = "HTTP PKI authentication require "
|
||||
errMsg += "usage of option `--auth-pki`"
|
||||
raise SqlmapSyntaxException(errMsg)
|
||||
@@ -1362,13 +1362,13 @@ def _setHTTPAuthentication():
|
||||
|
||||
_setAuthCred()
|
||||
|
||||
if aTypeLower == AUTH_TYPE.BASIC:
|
||||
if authType == AUTH_TYPE.BASIC:
|
||||
authHandler = SmartHTTPBasicAuthHandler(kb.passwordMgr)
|
||||
|
||||
elif aTypeLower == AUTH_TYPE.DIGEST:
|
||||
elif authType == AUTH_TYPE.DIGEST:
|
||||
authHandler = urllib2.HTTPDigestAuthHandler(kb.passwordMgr)
|
||||
|
||||
elif aTypeLower == AUTH_TYPE.NTLM:
|
||||
elif authType == AUTH_TYPE.NTLM:
|
||||
try:
|
||||
from ntlm import HTTPNtlmAuthHandler
|
||||
except ImportError:
|
||||
|
||||
@@ -7,9 +7,7 @@ See the file 'doc/COPYING' for copying permission
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from subprocess import PIPE
|
||||
from subprocess import Popen as execute
|
||||
import subprocess
|
||||
|
||||
def getRevisionNumber():
|
||||
"""
|
||||
@@ -46,7 +44,7 @@ def getRevisionNumber():
|
||||
break
|
||||
|
||||
if not retVal:
|
||||
process = execute("git rev-parse --verify HEAD", shell=True, stdout=PIPE, stderr=PIPE)
|
||||
process = subprocess.Popen("git rev-parse --verify HEAD", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, _ = process.communicate()
|
||||
match = re.search(r"(?i)[0-9a-f]{32}", stdout or "")
|
||||
retVal = match.group(0) if match else None
|
||||
|
||||
@@ -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.0.12.10"
|
||||
VERSION = "1.0.12.11"
|
||||
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)
|
||||
@@ -527,7 +527,7 @@ UNION_CHAR_REGEX = r"\A\w+\Z"
|
||||
UNENCODED_ORIGINAL_VALUE = "original"
|
||||
|
||||
# Common column names containing usernames (used for hash cracking in some cases)
|
||||
COMMON_USER_COLUMNS = ("login", "user", "username", "user_name", "user_login", "benutzername", "benutzer", "utilisateur", "usager", "consommateur", "utente", "utilizzatore", "usufrutuario", "korisnik", "usuario", "consumidor")
|
||||
COMMON_USER_COLUMNS = ("login", "user", "username", "user_name", "user_login", "benutzername", "benutzer", "utilisateur", "usager", "consommateur", "utente", "utilizzatore", "usufrutuario", "korisnik", "usuario", "consumidor", "client", "cuser")
|
||||
|
||||
# Default delimiter in GET/POST values
|
||||
DEFAULT_GET_POST_DELIMITER = '&'
|
||||
|
||||
@@ -8,11 +8,9 @@ See the file 'doc/COPYING' for copying permission
|
||||
import locale
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from subprocess import PIPE
|
||||
from subprocess import Popen as execute
|
||||
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.common import pollProcess
|
||||
@@ -44,7 +42,7 @@ def update():
|
||||
dataToStdout("\r[%s] [INFO] update in progress " % time.strftime("%X"))
|
||||
|
||||
try:
|
||||
process = execute("git checkout . && git pull %s HEAD" % GIT_REPOSITORY, shell=True, stdout=PIPE, stderr=PIPE, cwd=paths.SQLMAP_ROOT_PATH.encode(locale.getpreferredencoding())) # Reference: http://blog.stastnarodina.com/honza-en/spot/python-unicodeencodeerror/
|
||||
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(locale.getpreferredencoding())) # Reference: http://blog.stastnarodina.com/honza-en/spot/python-unicodeencodeerror/
|
||||
pollProcess(process, True)
|
||||
stdout, stderr = process.communicate()
|
||||
success = not process.returncode
|
||||
|
||||
Reference in New Issue
Block a user