mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 18:07:46 +03:00 
			
		
		
		
	Added warning message if both --proxy and --keep-alive are provided
This commit is contained in:
		
							parent
							
								
									d40a238335
								
							
						
					
					
						commit
						24428c1a1b
					
				| 
						 | 
					@ -96,9 +96,14 @@ def __urllib2Opener():
 | 
				
			||||||
        conf.cj = cookielib.LWPCookieJar()
 | 
					        conf.cj = cookielib.LWPCookieJar()
 | 
				
			||||||
        handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
 | 
					        handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Use Keep-Alive (persistent HTTP connection) only if a proxy is not set
 | 
					 | 
				
			||||||
    # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
 | 
					    # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
 | 
				
			||||||
    if conf.keepAlive and not conf.proxy:
 | 
					    if conf.keepAlive:
 | 
				
			||||||
 | 
					        if conf.proxy:
 | 
				
			||||||
 | 
					            warnMsg = "persistent HTTP(s) connections, Keep-Alive, has "
 | 
				
			||||||
 | 
					            warnMsg += "been disabled because of it's incompatibility "
 | 
				
			||||||
 | 
					            warnMsg += "with HTTP(s) proxy"
 | 
				
			||||||
 | 
					            logger.warn(warnMsg)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            handlers.append(keepAliveHandler)
 | 
					            handlers.append(keepAliveHandler)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    opener = urllib2.build_opener(*handlers)
 | 
					    opener = urllib2.build_opener(*handlers)
 | 
				
			||||||
| 
						 | 
					@ -289,9 +294,14 @@ def __setGoogleDorking():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    handlers = [ proxyHandler ]
 | 
					    handlers = [ proxyHandler ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Use Keep-Alive (persistent HTTP connection) only if a proxy is not set
 | 
					 | 
				
			||||||
    # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
 | 
					    # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
 | 
				
			||||||
    if conf.keepAlive and not conf.proxy:
 | 
					    if conf.keepAlive:
 | 
				
			||||||
 | 
					        if conf.proxy:
 | 
				
			||||||
 | 
					            warnMsg = "persistent HTTP(s) connections, Keep-Alive, has "
 | 
				
			||||||
 | 
					            warnMsg += "been disabled because of it's incompatibility "
 | 
				
			||||||
 | 
					            warnMsg += "with HTTP(s) proxy"
 | 
				
			||||||
 | 
					            logger.warn(warnMsg)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            handlers.append(keepAliveHandler)
 | 
					            handlers.append(keepAliveHandler)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    googleObj = Google(handlers)
 | 
					    googleObj = Google(handlers)
 | 
				
			||||||
| 
						 | 
					@ -545,6 +555,7 @@ def __setHTTPProxy():
 | 
				
			||||||
    if not conf.proxy:
 | 
					    if not conf.proxy:
 | 
				
			||||||
        if conf.hostname in ('localhost', '127.0.0.1') or conf.ignoreProxy:
 | 
					        if conf.hostname in ('localhost', '127.0.0.1') or conf.ignoreProxy:
 | 
				
			||||||
            proxyHandler = urllib2.ProxyHandler({})
 | 
					            proxyHandler = urllib2.ProxyHandler({})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    debugMsg = "setting the HTTP proxy to pass by all HTTP requests"
 | 
					    debugMsg = "setting the HTTP proxy to pass by all HTTP requests"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user