mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
implemented DNS caching mechanism
This commit is contained in:
parent
ae4ea0af45
commit
b288e5ef57
|
@ -334,6 +334,7 @@ Andres Riancho <andres.riancho@gmail.com>
|
|||
for reporting a bug and suggesting some features
|
||||
for including sqlmap in his great web application audit and attack
|
||||
framework, w3af, http://w3af.sourceforge.net
|
||||
for suggesting a way for handling DNS caching
|
||||
|
||||
Antonio Riva <antonio.riva@gmail.com>
|
||||
for reporting a bug when running with python 2.5
|
||||
|
@ -367,6 +368,9 @@ Sven Schluter <sschlueter@netzwerk.cc>
|
|||
for providing with a patch for waiting a number of seconds between
|
||||
each HTTP request
|
||||
|
||||
Ryan Sears <rdsears@mtu.edu>
|
||||
for suggesting an enhancement
|
||||
|
||||
Uemit Seren <uemit.seren@gmail.com>
|
||||
for reporting a minor adjustment when running with python 2.6
|
||||
|
||||
|
|
|
@ -759,6 +759,22 @@ def __setThreads():
|
|||
if not isinstance(conf.threads, int) or conf.threads <= 0:
|
||||
conf.threads = 1
|
||||
|
||||
def __setDNSCache():
|
||||
"""
|
||||
Makes a cached version of socket._getaddrinfo to avoid subsequent DNS requests.
|
||||
"""
|
||||
|
||||
def _getaddrinfo(*args, **kwargs):
|
||||
if args in kb.cache:
|
||||
return kb.cache[args]
|
||||
else:
|
||||
kb.cache[args] = socket._getaddrinfo(*args, **kwargs)
|
||||
return kb.cache[args]
|
||||
|
||||
if socket.getaddrinfo != _getaddrinfo:
|
||||
socket._getaddrinfo = socket.getaddrinfo
|
||||
socket.getaddrinfo = _getaddrinfo
|
||||
|
||||
def __setHTTPProxy():
|
||||
"""
|
||||
Check and set the HTTP proxy to pass by all HTTP requests.
|
||||
|
@ -1553,6 +1569,7 @@ def init(inputOptions=advancedDict(), overrideOptions=False):
|
|||
__setHTTPMethod()
|
||||
__setHTTPAuthentication()
|
||||
__setHTTPProxy()
|
||||
__setDNSCache()
|
||||
__setSafeUrl()
|
||||
__setGoogleDorking()
|
||||
__urllib2Opener()
|
||||
|
|
Loading…
Reference in New Issue
Block a user