(self)
| 40 | return self |
| 41 | |
| 42 | def adjust(self): |
| 43 | self.closeFP() |
| 44 | if self.index > len(self.filenames): |
| 45 | return # Note: https://stackoverflow.com/a/30217723 (PEP 479) |
| 46 | elif self.index == len(self.filenames): |
| 47 | self.iter = iter(self.custom) |
| 48 | else: |
| 49 | self.current = self.filenames[self.index] |
| 50 | if isZipFile(self.current): |
| 51 | try: |
| 52 | _ = zipfile.ZipFile(self.current, 'r') |
| 53 | except zipfile.error as ex: |
| 54 | errMsg = "something appears to be wrong with " |
| 55 | errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex)) |
| 56 | errMsg += "sure that you haven't made any changes to it" |
| 57 | raise SqlmapInstallationException(errMsg) |
| 58 | if len(_.namelist()) == 0: |
| 59 | errMsg = "no file(s) inside '%s'" % self.current |
| 60 | raise SqlmapDataException(errMsg) |
| 61 | self.fp = _.open(_.namelist()[0]) |
| 62 | else: |
| 63 | self.fp = open(self.current, "rb") |
| 64 | self.iter = iter(self.fp) |
| 65 | |
| 66 | self.index += 1 |
| 67 | |
| 68 | def closeFP(self): |
| 69 | if self.fp: |
no test coverage detected