From 7c88e32f9d965fdba0fae9ccea2dca61c786675d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 3 Feb 2010 16:16:34 +0000 Subject: [PATCH] bug fix for 404 program termination during shell upload attempt --- lib/request/connect.py | 3 ++- lib/takeover/web.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/request/connect.py b/lib/request/connect.py index d12f5a69c..57695e0f5 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -70,6 +70,7 @@ class Connect: direct = kwargs.get('direct', False) multipart = kwargs.get('multipart', False) silent = kwargs.get('silent', False) + raise404 = kwargs.get('raise404', True) page = "" cookieStr = "" @@ -168,7 +169,7 @@ class Connect: exceptionMsg = "not authorized, try to provide right HTTP " exceptionMsg += "authentication type and valid credentials" raise sqlmapConnectionException, exceptionMsg - elif e.code == 404: + elif e.code == 404 and raise404: exceptionMsg = "page not found" raise sqlmapConnectionException, exceptionMsg else: diff --git a/lib/takeover/web.py b/lib/takeover/web.py index c8c66769e..75baf0c25 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -181,7 +181,7 @@ class Web: self.webBaseUrl = "%s://%s:%d%s" % (conf.scheme, conf.hostname, conf.port, requestDir) self.webUploaderUrl = "%s/%s" % (self.webBaseUrl, uploaderName) self.webUploaderUrl = self.webUploaderUrl.replace("./", "/").replace("\\", "/") - uplPage, _ = Request.getPage(url=self.webUploaderUrl, direct=True) + uplPage, _ = Request.getPage(url=self.webUploaderUrl, direct=True, raise404=False) if "sqlmap file uploader" not in uplPage: warnMsg = "unable to upload the uploader "