mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 09:57:38 +03:00 
			
		
		
		
	minor improvement
This commit is contained in:
		
							parent
							
								
									65b2b0ad87
								
							
						
					
					
						commit
						4fa24ec704
					
				| 
						 | 
					@ -141,7 +141,7 @@ def cmdLineParser():
 | 
				
			||||||
                           help="Test requests between two visits to a given safe url")
 | 
					                           help="Test requests between two visits to a given safe url")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        request.add_option("--eval", dest="evalCode",
 | 
					        request.add_option("--eval", dest="evalCode",
 | 
				
			||||||
                           help="Evaluate provided Python code before the request (e.g. \"import hashlib;id2=hashlib.md5(str(id)).hexdigest()\")")
 | 
					                           help="Evaluate provided Python code before the request (e.g. \"import hashlib;id2=hashlib.md5(id).hexdigest()\")")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Optimization options
 | 
					        # Optimization options
 | 
				
			||||||
        optimization = OptionGroup(parser, "Optimization", "These "
 | 
					        optimization = OptionGroup(parser, "Optimization", "These "
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -605,13 +605,15 @@ class Connect:
 | 
				
			||||||
                            cookie = _randomizeParameter(cookie, randomParameter)
 | 
					                            cookie = _randomizeParameter(cookie, randomParameter)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if conf.evalCode:
 | 
					        if conf.evalCode:
 | 
				
			||||||
 | 
					            delimiter = conf.pDel or "&"
 | 
				
			||||||
            variables = {}
 | 
					            variables = {}
 | 
				
			||||||
            originals = {}
 | 
					            originals = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if get:
 | 
					            for item in filter(None, (get, post)):
 | 
				
			||||||
                executeCode(get.replace("&", ";"), variables)
 | 
					                for part in item.split(delimiter):
 | 
				
			||||||
            if post:
 | 
					                    if '=' in part:
 | 
				
			||||||
                executeCode(post.replace("&", ";"), variables)
 | 
					                        name, value = part.split('=', 1)
 | 
				
			||||||
 | 
					                        executeCode("%s='%s'" % (name, value), variables)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            originals.update(variables)
 | 
					            originals.update(variables)
 | 
				
			||||||
            executeCode(conf.evalCode, variables)
 | 
					            executeCode(conf.evalCode, variables)
 | 
				
			||||||
| 
						 | 
					@ -621,13 +623,13 @@ class Connect:
 | 
				
			||||||
                    if isinstance(value, (basestring, int)):
 | 
					                    if isinstance(value, (basestring, int)):
 | 
				
			||||||
                        value = unicode(value)
 | 
					                        value = unicode(value)
 | 
				
			||||||
                        if '%s=' % name in (get or ""):
 | 
					                        if '%s=' % name in (get or ""):
 | 
				
			||||||
                            get = re.sub("(%s=)([^&]+)" % name, "\g<1>%s" % value, get)
 | 
					                            get = re.sub("((\A|\W)%s=)([^%s]+)" % (name, delimiter), "\g<1>%s" % value, get)
 | 
				
			||||||
                        elif '%s=' % name in (post or ""):
 | 
					                        elif '%s=' % name in (post or ""):
 | 
				
			||||||
                            post = re.sub("(%s=)([^&]+)" % name, "\g<1>%s" % value, post)
 | 
					                            post = re.sub("((\A|\W)%s=)([^%s]+)" % (name, delimiter), "\g<1>%s" % value, post)
 | 
				
			||||||
                        elif post:
 | 
					                        elif post:
 | 
				
			||||||
                            post += "&%s=%s" % (name, value)
 | 
					                            post += "%s%s=%s" % (delimiter, name, value)
 | 
				
			||||||
                        else:
 | 
					                        else:
 | 
				
			||||||
                            get += "&%s=%s" % (name, value)
 | 
					                            get += "%s%s=%s" % (delimiter, name, value)
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
        get = urlencode(get, limit=True)
 | 
					        get = urlencode(get, limit=True)
 | 
				
			||||||
        if post and place != PLACE.POST and hasattr(post, UNENCODED_ORIGINAL_VALUE):
 | 
					        if post and place != PLACE.POST and hasattr(post, UNENCODED_ORIGINAL_VALUE):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -131,7 +131,7 @@ safUrl =
 | 
				
			||||||
saFreq = 0
 | 
					saFreq = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Evaluate provided Python code before the request
 | 
					# Evaluate provided Python code before the request
 | 
				
			||||||
# Example: import hashlib;id2=hashlib.md5(str(id)).hexdigest()
 | 
					# Example: import hashlib;id2=hashlib.md5(id).hexdigest()
 | 
				
			||||||
evalCode = 
 | 
					evalCode = 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user