(completion=None)
| 55 | readline.clear_history() |
| 56 | |
| 57 | def saveHistory(completion=None): |
| 58 | try: |
| 59 | if not readlineAvailable(): |
| 60 | return |
| 61 | |
| 62 | if completion == AUTOCOMPLETE_TYPE.SQL: |
| 63 | historyPath = paths.SQL_SHELL_HISTORY |
| 64 | elif completion == AUTOCOMPLETE_TYPE.OS: |
| 65 | historyPath = paths.OS_SHELL_HISTORY |
| 66 | elif completion == AUTOCOMPLETE_TYPE.API: |
| 67 | historyPath = paths.API_SHELL_HISTORY |
| 68 | else: |
| 69 | historyPath = paths.SQLMAP_SHELL_HISTORY |
| 70 | |
| 71 | try: |
| 72 | with open(historyPath, "w+"): |
| 73 | pass |
| 74 | except: |
| 75 | pass |
| 76 | |
| 77 | readline.set_history_length(MAX_HISTORY_LENGTH) |
| 78 | try: |
| 79 | readline.write_history_file(historyPath) |
| 80 | except IOError as ex: |
| 81 | warnMsg = "there was a problem writing the history file '%s' (%s)" % (historyPath, getSafeExString(ex)) |
| 82 | logger.warning(warnMsg) |
| 83 | except KeyboardInterrupt: |
| 84 | pass |
| 85 | |
| 86 | def loadHistory(completion=None): |
| 87 | if not readlineAvailable(): |
no test coverage detected
searching dependent graphs…