mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 09:57:38 +03:00 
			
		
		
		
	Fix for crawler and redirection case
This commit is contained in:
		
							parent
							
								
									09e7f4f697
								
							
						
					
					
						commit
						ebe8ee3500
					
				| 
						 | 
					@ -49,6 +49,7 @@ class _ThreadData(threading.local):
 | 
				
			||||||
        self.lastQueryDuration = 0
 | 
					        self.lastQueryDuration = 0
 | 
				
			||||||
        self.lastRequestMsg = None
 | 
					        self.lastRequestMsg = None
 | 
				
			||||||
        self.lastRequestUID = 0
 | 
					        self.lastRequestUID = 0
 | 
				
			||||||
 | 
					        self.lastRedirectURL = None
 | 
				
			||||||
        self.resumed = False
 | 
					        self.resumed = False
 | 
				
			||||||
        self.retriesCount = 0
 | 
					        self.retriesCount = 0
 | 
				
			||||||
        self.seqMatcher = difflib.SequenceMatcher(None)
 | 
					        self.seqMatcher = difflib.SequenceMatcher(None)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,9 +117,10 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            result = fp
 | 
					            result = fp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        threadData.lastRedirectURL = (threadData.lastRequestUID, redurl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result.redcode = code
 | 
					        result.redcode = code
 | 
				
			||||||
        result.redurl = redurl
 | 
					        result.redurl = redurl
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return result
 | 
					        return result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    http_error_301 = http_error_303 = http_error_307 = http_error_302
 | 
					    http_error_301 = http_error_303 = http_error_307 = http_error_302
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +72,8 @@ def crawl(target):
 | 
				
			||||||
                            href = tag.get("href") if hasattr(tag, "get") else tag.group("href")
 | 
					                            href = tag.get("href") if hasattr(tag, "get") else tag.group("href")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            if href:
 | 
					                            if href:
 | 
				
			||||||
 | 
					                                if threadData.lastRedirectURL and threadData.lastRedirectURL[0] == threadData.lastRequestUID:
 | 
				
			||||||
 | 
					                                    current = threadData.lastRedirectURL[1]
 | 
				
			||||||
                                url = urlparse.urljoin(current, href)
 | 
					                                url = urlparse.urljoin(current, href)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                # flag to know if we are dealing with the same target host
 | 
					                                # flag to know if we are dealing with the same target host
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user