From c93e26526950bc1817b9bb6a600ac1133e68c194 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 1 Mar 2010 10:33:36 +0000 Subject: [PATCH] fix for that banner fetching issue reported by Daniel Huckmann --- lib/parse/banner.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/parse/banner.py b/lib/parse/banner.py index c739db506..af53bd7f6 100644 --- a/lib/parse/banner.py +++ b/lib/parse/banner.py @@ -45,6 +45,7 @@ class MSSQLBannerHandler(ContentHandler): self.__inServicePack = False self.__release = None self.__version = "" + self.__versionAlt = None self.__servicePack = "" self.__info = info @@ -74,17 +75,23 @@ class MSSQLBannerHandler(ContentHandler): def endElement(self, name): if name == "signature": - if re.search(" %s[\.\ ]+" % self.__version, self.__banner): - self.__feedInfo("dbmsRelease", self.__release) - self.__feedInfo("dbmsVersion", self.__version) - self.__feedInfo("dbmsServicePack", self.__servicePack) + for version in (self.__version, self.__versionAlt): + if version and re.search(" %s[\.\ ]+" % version, self.__banner): + self.__feedInfo("dbmsRelease", self.__release) + self.__feedInfo("dbmsVersion", self.__version) + self.__feedInfo("dbmsServicePack", self.__servicePack) + break self.__version = "" + self.__versionAlt = None self.__servicePack = "" elif name == "version": self.__inVersion = False self.__version = self.__version.replace(" ", "") + + match = re.search(r"\A(?P\d+)\.00\.(?P\d+)\Z", self.__version) + self.__versionAlt = "%s.0.%s.0" % (match.group('major'), match.group('build')) if match else None elif name == "servicepack": self.__inServicePack = False