mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-31 07:57:47 +03:00 
			
		
		
		
	Couple of trivial refactorings
This commit is contained in:
		
							parent
							
								
									2cba4e2d78
								
							
						
					
					
						commit
						dad4879200
					
				|  | @ -1213,9 +1213,9 @@ def randomStr(length=4, lowercase=False, alphabet=None, seed=None): | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     if seed is not None: |     if seed is not None: | ||||||
|         _ = getCurrentThreadData().random |         _random = getCurrentThreadData().random | ||||||
|         _.seed(seed) |         _random.seed(seed) | ||||||
|         choice = _.choice |         choice = _random.choice | ||||||
|     else: |     else: | ||||||
|         choice = random.choice |         choice = random.choice | ||||||
| 
 | 
 | ||||||
|  | @ -1247,10 +1247,12 @@ def getHeader(headers, key): | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|     retVal = None |     retVal = None | ||||||
|     for _ in (headers or {}): | 
 | ||||||
|         if _.upper() == key.upper(): |     for header in (headers or {}): | ||||||
|             retVal = headers[_] |         if header.upper() == key.upper(): | ||||||
|  |             retVal = headers[header] | ||||||
|             break |             break | ||||||
|  | 
 | ||||||
|     return retVal |     return retVal | ||||||
| 
 | 
 | ||||||
| def checkPipedInput(): | def checkPipedInput(): | ||||||
|  | @ -1431,6 +1433,7 @@ def setPaths(rootPath): | ||||||
|             checkFile(path) |             checkFile(path) | ||||||
| 
 | 
 | ||||||
|     if IS_WIN: |     if IS_WIN: | ||||||
|  |         # Reference: https://pureinfotech.com/list-environment-variables-windows-10/ | ||||||
|         if os.getenv("LOCALAPPDATA"): |         if os.getenv("LOCALAPPDATA"): | ||||||
|             paths.SQLMAP_HOME_PATH = os.path.expandvars("%LOCALAPPDATA%\\sqlmap") |             paths.SQLMAP_HOME_PATH = os.path.expandvars("%LOCALAPPDATA%\\sqlmap") | ||||||
|         elif os.getenv("USERPROFILE"): |         elif os.getenv("USERPROFILE"): | ||||||
|  | @ -1444,7 +1447,7 @@ def setPaths(rootPath): | ||||||
|     paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") |     paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") | ||||||
|     paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") |     paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") | ||||||
| 
 | 
 | ||||||
|     # history files |     # History files | ||||||
|     paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(paths.SQLMAP_HOME_PATH, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) |     paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(paths.SQLMAP_HOME_PATH, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) | ||||||
|     paths.API_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "api.hst") |     paths.API_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "api.hst") | ||||||
|     paths.OS_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "os.hst") |     paths.OS_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "os.hst") | ||||||
|  | @ -1601,7 +1604,7 @@ def parseTargetUrl(): | ||||||
|     originalUrl = conf.url |     originalUrl = conf.url | ||||||
| 
 | 
 | ||||||
|     if re.search(r"\[.+\]", conf.url) and not socket.has_ipv6: |     if re.search(r"\[.+\]", conf.url) and not socket.has_ipv6: | ||||||
|         errMsg = "IPv6 addressing is not supported " |         errMsg = "IPv6 communication is not supported " | ||||||
|         errMsg += "on this platform" |         errMsg += "on this platform" | ||||||
|         raise SqlmapGenericException(errMsg) |         raise SqlmapGenericException(errMsg) | ||||||
| 
 | 
 | ||||||
|  | @ -1658,7 +1661,7 @@ def parseTargetUrl(): | ||||||
|         conf.port = 80 |         conf.port = 80 | ||||||
| 
 | 
 | ||||||
|     if conf.port < 1 or conf.port > 65535: |     if conf.port < 1 or conf.port > 65535: | ||||||
|         errMsg = "invalid target URL's port (%d)" % conf.port |         errMsg = "invalid target URL port (%d)" % conf.port | ||||||
|         raise SqlmapSyntaxException(errMsg) |         raise SqlmapSyntaxException(errMsg) | ||||||
| 
 | 
 | ||||||
|     conf.url = getUnicode("%s://%s:%d%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, conf.port, conf.path)) |     conf.url = getUnicode("%s://%s:%d%s" % (conf.scheme, ("[%s]" % conf.hostname) if conf.ipv6 else conf.hostname, conf.port, conf.path)) | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ from lib.core.enums import OS | ||||||
| from thirdparty.six import unichr as _unichr | from thirdparty.six import unichr as _unichr | ||||||
| 
 | 
 | ||||||
| # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | ||||||
| VERSION = "1.4.3.12" | VERSION = "1.4.4.0" | ||||||
| TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" | TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" | ||||||
| TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} | TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} | ||||||
| VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) | VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user