mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-01 00:17:25 +03:00 
			
		
		
		
	code refactoring
This commit is contained in:
		
							parent
							
								
									7877a931d5
								
							
						
					
					
						commit
						f9f076ba97
					
				|  | @ -1259,8 +1259,8 @@ def getConsoleWidth(default=80): | ||||||
| 
 | 
 | ||||||
|     return width if width else default |     return width if width else default | ||||||
| 
 | 
 | ||||||
| def clearConsoleLine(): | def clearConsoleLine(forceOutput=False): | ||||||
|     dataToStdout("\r%s\r" % (" " * (getConsoleWidth() - 1))) |     dataToStdout("\r%s\r" % (" " * (getConsoleWidth() - 1)), forceOutput) | ||||||
| 
 | 
 | ||||||
| def parseXmlFile(xmlFile, handler): | def parseXmlFile(xmlFile, handler): | ||||||
|     stream = StringIO(readCachedFileContent(xmlFile)) |     stream = StringIO(readCachedFileContent(xmlFile)) | ||||||
|  |  | ||||||
|  | @ -17,9 +17,9 @@ import tempfile | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
| from lib.controller.controller import start | from lib.controller.controller import start | ||||||
|  | from lib.core.common import clearConsoleLine | ||||||
| from lib.core.common import dataToStdout | from lib.core.common import dataToStdout | ||||||
| from lib.core.common import getCompiledRegex | from lib.core.common import getCompiledRegex | ||||||
| from lib.core.common import getConsoleWidth |  | ||||||
| from lib.core.common import readXmlFile | from lib.core.common import readXmlFile | ||||||
| from lib.core.data import conf | from lib.core.data import conf | ||||||
| from lib.core.data import logger | from lib.core.data import logger | ||||||
|  | @ -65,7 +65,7 @@ def smokeTest(): | ||||||
|             status = '%d/%d (%d%s) ' % (count, length, round(100.0*count/length), '%') |             status = '%d/%d (%d%s) ' % (count, length, round(100.0*count/length), '%') | ||||||
|             dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) |             dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) | ||||||
| 
 | 
 | ||||||
|     dataToStdout("\r%s\r" % (" "*(getConsoleWidth()-1))) |     clearConsoleLine() | ||||||
|     if retVal: |     if retVal: | ||||||
|         logger.info("smoke test final result: PASSED") |         logger.info("smoke test final result: PASSED") | ||||||
|     else: |     else: | ||||||
|  |  | ||||||
|  | @ -10,8 +10,8 @@ See the file 'doc/COPYING' for copying permission | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
| from lib.core.agent import agent | from lib.core.agent import agent | ||||||
|  | from lib.core.common import clearConsoleLine | ||||||
| from lib.core.common import dataToStdout | from lib.core.common import dataToStdout | ||||||
| from lib.core.common import getConsoleWidth |  | ||||||
| from lib.core.common import getFileItems | from lib.core.common import getFileItems | ||||||
| from lib.core.common import popValue | from lib.core.common import popValue | ||||||
| from lib.core.common import pushValue | from lib.core.common import pushValue | ||||||
|  | @ -42,8 +42,8 @@ def tableExists(tableFile): | ||||||
|         result = Request.queryPage(agent.payload(newValue=query)) |         result = Request.queryPage(agent.payload(newValue=query)) | ||||||
| 
 | 
 | ||||||
|         if result: |         if result: | ||||||
|             infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), table) |             clearConsoleLine(True) | ||||||
|             infoMsg = "%s%s\n" % (infoMsg, " "*(getConsoleWidth()-1-len(infoMsg))) |             infoMsg = "\r[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), table) | ||||||
|             dataToStdout(infoMsg, True) |             dataToStdout(infoMsg, True) | ||||||
|             retVal.append(table) |             retVal.append(table) | ||||||
| 
 | 
 | ||||||
|  | @ -53,7 +53,7 @@ def tableExists(tableFile): | ||||||
| 
 | 
 | ||||||
|     conf.verbose = popValue() |     conf.verbose = popValue() | ||||||
| 
 | 
 | ||||||
|     dataToStdout("\n", True) |     clearConsoleLine(True) | ||||||
| 
 | 
 | ||||||
|     if not retVal: |     if not retVal: | ||||||
|         warnMsg = "no table found" |         warnMsg = "no table found" | ||||||
|  | @ -93,8 +93,8 @@ def columnExists(columnFile): | ||||||
|         result = Request.queryPage(agent.payload(newValue=query)) |         result = Request.queryPage(agent.payload(newValue=query)) | ||||||
| 
 | 
 | ||||||
|         if result: |         if result: | ||||||
|             infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), column) |             clearConsoleLine(True) | ||||||
|             infoMsg = "%s%s\n" % (infoMsg, " "*(getConsoleWidth()-1-len(infoMsg))) |             infoMsg = "\r[%s] [INFO] retrieved: %s\n" % (time.strftime("%X"), column) | ||||||
|             dataToStdout(infoMsg, True) |             dataToStdout(infoMsg, True) | ||||||
|             retVal.append(column) |             retVal.append(column) | ||||||
| 
 | 
 | ||||||
|  | @ -104,7 +104,7 @@ def columnExists(columnFile): | ||||||
| 
 | 
 | ||||||
|     conf.verbose = popValue() |     conf.verbose = popValue() | ||||||
| 
 | 
 | ||||||
|     dataToStdout("\n", True) |     clearConsoleLine(True) | ||||||
| 
 | 
 | ||||||
|     if not retVal: |     if not retVal: | ||||||
|         warnMsg = "no column found" |         warnMsg = "no column found" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user