MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / adjust

Method adjust

lib/core/wordlist.py:42–66  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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:

Callers 3

__init__Method · 0.95
__next__Method · 0.95
rewindMethod · 0.95

Calls 6

closeFPMethod · 0.95
isZipFileFunction · 0.90
getSafeExStringFunction · 0.90
SqlmapDataExceptionClass · 0.90
openMethod · 0.80

Tested by

no test coverage detected