mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
Patch for an Issue #1052
This commit is contained in:
parent
cf3b02ee04
commit
1ea2f5bfe2
|
@ -9,6 +9,7 @@ import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from lib.core.exception import SqlmapDataException
|
from lib.core.exception import SqlmapDataException
|
||||||
|
from lib.core.exception import SqlmapInstallationException
|
||||||
from lib.core.settings import UNICODE_ENCODING
|
from lib.core.settings import UNICODE_ENCODING
|
||||||
|
|
||||||
class Wordlist(object):
|
class Wordlist(object):
|
||||||
|
@ -21,6 +22,7 @@ class Wordlist(object):
|
||||||
self.fp = None
|
self.fp = None
|
||||||
self.index = 0
|
self.index = 0
|
||||||
self.counter = -1
|
self.counter = -1
|
||||||
|
self.current = None
|
||||||
self.iter = None
|
self.iter = None
|
||||||
self.custom = custom or []
|
self.custom = custom or []
|
||||||
self.proc_id = proc_id
|
self.proc_id = proc_id
|
||||||
|
@ -37,15 +39,15 @@ class Wordlist(object):
|
||||||
elif self.index == len(self.filenames):
|
elif self.index == len(self.filenames):
|
||||||
self.iter = iter(self.custom)
|
self.iter = iter(self.custom)
|
||||||
else:
|
else:
|
||||||
current = self.filenames[self.index]
|
self.current = self.filenames[self.index]
|
||||||
if os.path.splitext(current)[1].lower() == ".zip":
|
if os.path.splitext(self.current)[1].lower() == ".zip":
|
||||||
_ = zipfile.ZipFile(current, 'r')
|
_ = zipfile.ZipFile(self.current, 'r')
|
||||||
if len(_.namelist()) == 0:
|
if len(_.namelist()) == 0:
|
||||||
errMsg = "no file(s) inside '%s'" % current
|
errMsg = "no file(s) inside '%s'" % self.current
|
||||||
raise SqlmapDataException(errMsg)
|
raise SqlmapDataException(errMsg)
|
||||||
self.fp = _.open(_.namelist()[0])
|
self.fp = _.open(_.namelist()[0])
|
||||||
else:
|
else:
|
||||||
self.fp = open(current, 'r')
|
self.fp = open(self.current, 'r')
|
||||||
self.iter = iter(self.fp)
|
self.iter = iter(self.fp)
|
||||||
|
|
||||||
self.index += 1
|
self.index += 1
|
||||||
|
@ -61,6 +63,11 @@ class Wordlist(object):
|
||||||
self.counter += 1
|
self.counter += 1
|
||||||
try:
|
try:
|
||||||
retVal = self.iter.next().rstrip()
|
retVal = self.iter.next().rstrip()
|
||||||
|
except zipfile.error, ex:
|
||||||
|
errMsg = "something seems to be wrong with "
|
||||||
|
errMsg += "the file '%s' ('%s'). Please make " % (self.current, ex)
|
||||||
|
errMsg += "sure that you haven't made any changes to it"
|
||||||
|
raise SqlmapInstallationException, errMsg
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
self.adjust()
|
self.adjust()
|
||||||
retVal = self.iter.next().rstrip()
|
retVal = self.iter.next().rstrip()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user