mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
fix mandatorily depend of websocket #1198
This commit is contained in:
parent
811f5c11c6
commit
bbfdb02a0e
|
@ -2137,6 +2137,16 @@ def _setTorSocksProxySettings():
|
||||||
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if conf.torType == PROXY_TYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, LOCALHOST, conf.torPort or DEFAULT_TOR_SOCKS_PORT)
|
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if conf.torType == PROXY_TYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, LOCALHOST, conf.torPort or DEFAULT_TOR_SOCKS_PORT)
|
||||||
socks.wrapmodule(urllib2)
|
socks.wrapmodule(urllib2)
|
||||||
|
|
||||||
|
def _checkWebSocket():
|
||||||
|
infoMsg = "checking URL is WebSocket or not"
|
||||||
|
logger.debug(infoMsg)
|
||||||
|
if conf.url and (conf.url.startswith("ws:/") or conf.url.startswith("wss:/")):
|
||||||
|
try:
|
||||||
|
from websocket import ABNF
|
||||||
|
except ImportError:
|
||||||
|
errMsg = "it seems that python 'websocket-client' third-party library not be installed. "
|
||||||
|
raise SqlmapMissingDependence(errMsg)
|
||||||
|
|
||||||
def _checkTor():
|
def _checkTor():
|
||||||
if not conf.checkTor:
|
if not conf.checkTor:
|
||||||
return
|
return
|
||||||
|
@ -2383,6 +2393,7 @@ def init():
|
||||||
_setWafFunctions()
|
_setWafFunctions()
|
||||||
_setTrafficOutputFP()
|
_setTrafficOutputFP()
|
||||||
_resolveCrossReferences()
|
_resolveCrossReferences()
|
||||||
|
_checkWebSocket()
|
||||||
|
|
||||||
parseTargetUrl()
|
parseTargetUrl()
|
||||||
parseTargetDirect()
|
parseTargetDirect()
|
||||||
|
|
|
@ -18,7 +18,13 @@ import time
|
||||||
import traceback
|
import traceback
|
||||||
import urllib2
|
import urllib2
|
||||||
import urlparse
|
import urlparse
|
||||||
import websocket
|
|
||||||
|
try:
|
||||||
|
import websocket
|
||||||
|
from websocket import WebSocketException
|
||||||
|
except ImportError:
|
||||||
|
class WebSocketException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
from extra.safe2bin.safe2bin import safecharencode
|
from extra.safe2bin.safe2bin import safecharencode
|
||||||
from lib.core.agent import agent
|
from lib.core.agent import agent
|
||||||
|
@ -551,7 +557,7 @@ class Connect(object):
|
||||||
debugMsg = "got HTTP error code: %d (%s)" % (code, status)
|
debugMsg = "got HTTP error code: %d (%s)" % (code, status)
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
except (urllib2.URLError, socket.error, socket.timeout, httplib.BadStatusLine, httplib.IncompleteRead, struct.error, ProxyError, SqlmapCompressionException, websocket.WebSocketException), e:
|
except (urllib2.URLError, socket.error, socket.timeout, httplib.BadStatusLine, httplib.IncompleteRead, struct.error, ProxyError, SqlmapCompressionException, WebSocketException), e:
|
||||||
tbMsg = traceback.format_exc()
|
tbMsg = traceback.format_exc()
|
||||||
|
|
||||||
if "no host given" in tbMsg:
|
if "no host given" in tbMsg:
|
||||||
|
|
|
@ -78,6 +78,17 @@ def checkDependencies():
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
missing_libraries.add('python-ntlm')
|
missing_libraries.add('python-ntlm')
|
||||||
|
|
||||||
|
try:
|
||||||
|
from websocket import ABNF
|
||||||
|
debugMsg = "'python websocket-client' library is found"
|
||||||
|
logger.debug(debugMsg)
|
||||||
|
except ImportError:
|
||||||
|
warnMsg = "sqlmap requires 'python websocket-client' third-party library for "
|
||||||
|
warnMsg += "if you plan to attack a web application behind websocket. "
|
||||||
|
warnMsg += "Download from https://pypi.python.org/pypi/websocket-client/"
|
||||||
|
logger.warn(warnMsg)
|
||||||
|
missing_libraries.add('websocket-client')
|
||||||
|
|
||||||
if IS_WIN:
|
if IS_WIN:
|
||||||
try:
|
try:
|
||||||
import pyreadline
|
import pyreadline
|
||||||
|
|
Loading…
Reference in New Issue
Block a user