From 1ac7a24dec9a7a73ba25138aa76d2e60ae30873f Mon Sep 17 00:00:00 2001 From: "Mohammad Parishan ./" Date: Sun, 30 Dec 2018 23:45:13 -0800 Subject: [PATCH 01/46] resolve python error 'tuple parameter unpacking is not supported in python3' in '_find_delay_in_mutant' function ./ --- w3af/plugins/audit/redos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/audit/redos.py b/w3af/plugins/audit/redos.py index 4d5146d6f6..a621d5289e 100644 --- a/w3af/plugins/audit/redos.py +++ b/w3af/plugins/audit/redos.py @@ -59,7 +59,7 @@ def _generate_delay_tests(self, freq, debugging_id): for delay_obj in self.get_delays(): yield mutant, delay_obj, debugging_id - def _find_delay_in_mutant(self, (mutant, delay_obj, debugging_id)): + def _find_delay_in_mutant(self, mutant, delay_obj, debugging_id): """ Try to delay the response and save a vulnerability if successful From d25c7444476ae5d7e2319b46bb0d658bead0de1c Mon Sep 17 00:00:00 2001 From: "Mohammad Parishan ./" Date: Mon, 31 Dec 2018 00:09:40 -0800 Subject: [PATCH 02/46] Forget 'as' in Exception Syntax ./ --- w3af/plugins/audit/xxe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/audit/xxe.py b/w3af/plugins/audit/xxe.py index 8a4d7b40c7..98c41c35b0 100644 --- a/w3af/plugins/audit/xxe.py +++ b/w3af/plugins/audit/xxe.py @@ -242,7 +242,7 @@ def _parse_xml(self, original_value): try: xml_root = etree.fromstring(smart_str_ignore(original_value), parser=parser) - except Exception, e: + except Exception as e: msg = 'Failed to parse XML to inject XXE tests. Exception was: "%s"' om.out.debug(msg % e) return None From 39e7f8d30aad006163bb19846a2fd101a31c0ab1 Mon Sep 17 00:00:00 2001 From: "Mohammad Parishan ./" Date: Mon, 31 Dec 2018 00:20:28 -0800 Subject: [PATCH 03/46] Forget multiple file 'as' in Exception syntax ./ --- w3af/core/data/parsers/doc/open_api/main.py | 2 +- w3af/core/data/parsers/doc/open_api/specification.py | 2 +- w3af/core/data/parsers/pynarcissus/string_extractor.py | 2 +- w3af/core/data/parsers/tests/test_mp_document_parser.py | 2 +- w3af/core/ui/api/resources/error_handlers.py | 2 +- w3af/core/ui/api/resources/exceptions.py | 2 +- w3af/core/ui/api/utils/scans.py | 2 +- w3af/core/ui/gui/clusterGraph.py | 6 +++--- w3af/core/ui/gui/clusterTable.py | 2 +- w3af/core/ui/gui/helpers.py | 2 +- w3af/core/ui/gui/main.py | 2 +- w3af/core/ui/gui/pluginconfig.py | 2 +- w3af/core/ui/gui/reqResViewer.py | 8 ++++---- w3af/core/ui/gui/tabs/exploit/exploit_all.py | 8 ++++---- w3af/core/ui/gui/tabs/exploit/vuln_list.py | 6 +++--- w3af/core/ui/gui/tools/encdec.py | 2 +- w3af/core/ui/gui/wizard.py | 2 +- .../attack/db/sqlmap/extra/shutils/regressiontest.py | 4 ++-- w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py | 4 ++-- w3af/plugins/audit/deserialization/net/generator.py | 2 +- w3af/plugins/audit/frontpage.py | 4 ++-- w3af/plugins/audit/rfi.py | 6 +++--- w3af/plugins/audit/ssl_certificate.py | 6 +++--- w3af/plugins/grep/http_auth_detect.py | 2 +- w3af/plugins/grep/serialized_object.py | 2 +- w3af/plugins/grep/user_defined_regex.py | 2 +- 26 files changed, 43 insertions(+), 43 deletions(-) diff --git a/w3af/core/data/parsers/doc/open_api/main.py b/w3af/core/data/parsers/doc/open_api/main.py index d8a0785fae..e219dedf70 100644 --- a/w3af/core/data/parsers/doc/open_api/main.py +++ b/w3af/core/data/parsers/doc/open_api/main.py @@ -150,7 +150,7 @@ def parse(self): try: request_factory = RequestFactory(*data) fuzzable_request = request_factory.get_fuzzable_request(self.discover_fuzzable_headers) - except Exception, e: + except Exception as e: # # This is a strange situation because parsing of the OpenAPI # spec can fail awfully for one of the operations but succeed diff --git a/w3af/core/data/parsers/doc/open_api/specification.py b/w3af/core/data/parsers/doc/open_api/specification.py index eea58db091..29001ecef1 100644 --- a/w3af/core/data/parsers/doc/open_api/specification.py +++ b/w3af/core/data/parsers/doc/open_api/specification.py @@ -132,7 +132,7 @@ def _parse_spec_from_dict(self, spec_dict, retry=True): self.spec = Spec.from_dict(spec_dict, origin_url=url_string, config=config) - except Exception, e: + except Exception as e: msg = ('The document at "%s" is not a valid Open API specification.' ' The following exception was raised while parsing the dict' ' into a specification object: "%s"') diff --git a/w3af/core/data/parsers/pynarcissus/string_extractor.py b/w3af/core/data/parsers/pynarcissus/string_extractor.py index 8832ff150d..447d0c09dc 100644 --- a/w3af/core/data/parsers/pynarcissus/string_extractor.py +++ b/w3af/core/data/parsers/pynarcissus/string_extractor.py @@ -51,7 +51,7 @@ def __init__(self, js_source): try: root = parse(js_source) - except Exception, e: + except Exception as e: pass else: self.visit(root) diff --git a/w3af/core/data/parsers/tests/test_mp_document_parser.py b/w3af/core/data/parsers/tests/test_mp_document_parser.py index 717fa339eb..649547fc0a 100644 --- a/w3af/core/data/parsers/tests/test_mp_document_parser.py +++ b/w3af/core/data/parsers/tests/test_mp_document_parser.py @@ -66,7 +66,7 @@ def test_no_parser_for_images(self): try: self.mpdoc.get_document_parser_for(resp) - except Exception, e: + except Exception as e: self.assertEqual(str(e), 'There is no parser for images.') else: self.assertTrue(False, 'Expected exception!') diff --git a/w3af/core/ui/api/resources/error_handlers.py b/w3af/core/ui/api/resources/error_handlers.py index a3af0070b5..2defc94901 100644 --- a/w3af/core/ui/api/resources/error_handlers.py +++ b/w3af/core/ui/api/resources/error_handlers.py @@ -70,7 +70,7 @@ def error_500_handler(error): 'function_name': function_name, 'exception_type': error.__class__.__name__, 'please': new_issue}) - except Exception, e: + except Exception as e: # I don't want to fail in the exception handler response = jsonify({'code': 500, 'exception': str(error), diff --git a/w3af/core/ui/api/resources/exceptions.py b/w3af/core/ui/api/resources/exceptions.py index 6020ce62c7..07e260c94c 100644 --- a/w3af/core/ui/api/resources/exceptions.py +++ b/w3af/core/ui/api/resources/exceptions.py @@ -121,7 +121,7 @@ def exception_creator(scan_id): try: raise Exception('unittest') - except Exception, exception: + except Exception as exception: exec_info = sys.exc_info() enabled_plugins = '' diff --git a/w3af/core/ui/api/utils/scans.py b/w3af/core/ui/api/utils/scans.py index a90ee0ed55..73733c4fc6 100644 --- a/w3af/core/ui/api/utils/scans.py +++ b/w3af/core/ui/api/utils/scans.py @@ -68,7 +68,7 @@ def start_scan_helper(scan_info): # Start the scan! w3af_core.verify_environment() w3af_core.start() - except Exception, e: + except Exception as e: scan_info.exception = e try: w3af_core.stop() diff --git a/w3af/core/ui/gui/clusterGraph.py b/w3af/core/ui/gui/clusterGraph.py index f08958c774..a400319abb 100644 --- a/w3af/core/ui/gui/clusterGraph.py +++ b/w3af/core/ui/gui/clusterGraph.py @@ -183,7 +183,7 @@ def _launch_graph_generator(self, widget): window = clusterGraphWidget( self.w3af, self.data, distance_function=selected_function, custom_code=custom_code) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = str(w3) dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, msg) @@ -304,7 +304,7 @@ def __init__(self, w3af, response_list, distance_function=LEVENSHTEIN, try: callable_object = self._create_callable_object(custom_code) - except Exception, e: + except Exception as e: # TODO: instead of hiding..., which may consume memory... # why don't killing? self.hide() @@ -315,7 +315,7 @@ def __init__(self, w3af, response_list, distance_function=LEVENSHTEIN, try: dotcode = self._generateDotCode(response_list, distance_function=callable_object) - except Exception, e: + except Exception as e: # TODO: instead of hiding..., which may consume memory... # why don't killing? self.hide() diff --git a/w3af/core/ui/gui/clusterTable.py b/w3af/core/ui/gui/clusterTable.py index 1e146bbf14..ba87aebfba 100644 --- a/w3af/core/ui/gui/clusterTable.py +++ b/w3af/core/ui/gui/clusterTable.py @@ -392,7 +392,7 @@ def _getInfoForId(self, id): """ try: obj = [i for i in self._data if i.get_id() == int(id)][0] - except Exception, e: + except Exception as e: return '' else: msg = 'Code: %s\nMessage: %s' \ diff --git a/w3af/core/ui/gui/helpers.py b/w3af/core/ui/gui/helpers.py index 905c8d11a4..93366f1e57 100644 --- a/w3af/core/ui/gui/helpers.py +++ b/w3af/core/ui/gui/helpers.py @@ -203,7 +203,7 @@ def __call__(self, func, *args, **kwargs): """Apply the wrap.""" try: return func(*args, **kwargs) - except Exception, err: + except Exception as err: if isinstance(err, self.friendly): FriendlyExceptionDlg(str(err)) raise diff --git a/w3af/core/ui/gui/main.py b/w3af/core/ui/gui/main.py index 6f2301bdaa..b8e4de570b 100644 --- a/w3af/core/ui/gui/main.py +++ b/w3af/core/ui/gui/main.py @@ -222,7 +222,7 @@ def __init__(self, profile, do_upd): genconfigfile = os.path.join(get_home_dir(), "gui_config.pkl") try: self.generalconfig = shelve.open(genconfigfile) - except Exception, e: + except Exception as e: print ("WARNING: something bad happened when trying to open the" " general config! File: %s. Problem: %s" % (genconfigfile, e)) self.generalconfig = FakeShelve() diff --git a/w3af/core/ui/gui/pluginconfig.py b/w3af/core/ui/gui/pluginconfig.py index c213f0bab2..1e64f2ede7 100644 --- a/w3af/core/ui/gui/pluginconfig.py +++ b/w3af/core/ui/gui/pluginconfig.py @@ -421,7 +421,7 @@ def _finishedEditingPlugin(self, path, plugin_type, plugin_name): # Reload the plugin try: self.w3af.plugins.reload_modified_plugin(plugin_type, plugin_name) - except Exception, e: + except Exception as e: msg = 'The plugin you modified raised the following exception' msg += ' while trying to reload it: "%s",' % str(e) msg += ' please fix this issue before continuing or w3af will crash.' diff --git a/w3af/core/ui/gui/reqResViewer.py b/w3af/core/ui/gui/reqResViewer.py index 70e1c4530d..898f469cbd 100644 --- a/w3af/core/ui/gui/reqResViewer.py +++ b/w3af/core/ui/gui/reqResViewer.py @@ -438,7 +438,7 @@ def __init__(self, parent, w3af, editable, widgname='default'): try: rend = getRenderingView(w3af, self) self.add_view(rend) - except Exception, ex: + except Exception as ex: print ex def get_both_texts(self): @@ -510,7 +510,7 @@ def run(self): try: tmp_result = plugin.audit_return_vulns(self.request) plugin.end() - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) else: # @@ -530,7 +530,7 @@ def run(self): try: self.result = plugin.audit_return_vulns(self.request) plugin.end() - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) else: # @@ -542,7 +542,7 @@ def run(self): # We got here, everything is OK! self.ok = True - except Exception, e: + except Exception as e: self.exception = e # # This is for debugging errors in the audit button of the diff --git a/w3af/core/ui/gui/tabs/exploit/exploit_all.py b/w3af/core/ui/gui/tabs/exploit/exploit_all.py index 8025276173..6179741ee8 100644 --- a/w3af/core/ui/gui/tabs/exploit/exploit_all.py +++ b/w3af/core/ui/gui/tabs/exploit/exploit_all.py @@ -149,13 +149,13 @@ def _launch_exploit_all(dlg, w3af, enabled_plugins, stopOnFirst): try: can_exploit = exploit.can_exploit(vuln.get_id()) - except BaseFrameworkException, e: + except BaseFrameworkException as e: dlg.add_message(_("\nERROR: ")) dlg.add_message(str(e) + '\n') dlg.done() dlg.dialog_run() yield False - except ScanMustStopException, wmse: + except ScanMustStopException as wmse: dlg.add_message(_("\nERROR: ")) dlg.add_message(str(wmse) + '\n') dlg.done() @@ -172,11 +172,11 @@ def _launch_exploit_all(dlg, w3af, enabled_plugins, stopOnFirst): dlg.add_message(_("Exploiting...\n")) try: exploit.exploit() - except BaseFrameworkException, e: + except BaseFrameworkException as e: dlg.add_message(str(e) + '\n') yield True continue - except ScanMustStopException, wmse: + except ScanMustStopException as wmse: dlg.add_message(_("\nERROR:")) dlg.add_message(str(wmse) + '\n') dlg.done() diff --git a/w3af/core/ui/gui/tabs/exploit/vuln_list.py b/w3af/core/ui/gui/tabs/exploit/vuln_list.py index 1c01c946e7..a70fa925b9 100644 --- a/w3af/core/ui/gui/tabs/exploit/vuln_list.py +++ b/w3af/core/ui/gui/tabs/exploit/vuln_list.py @@ -232,7 +232,7 @@ def _launch_exploit(self, dlg, expl, vuln): try: can_exploit = expl.can_exploit(vuln_id_list) - except BaseFrameworkException, e: + except BaseFrameworkException as e: dlg.add_message(_("\nERROR: ")) dlg.add_message(str(e) + '\n') dlg.done() # set button to sensitive @@ -254,9 +254,9 @@ def _launch_exploit(self, dlg, expl, vuln): expl.exploit(vuln_id_list) # print the console messages to the dialog yield True - except NoVulnerabilityFoundException, e: + except NoVulnerabilityFoundException as e: dlg.add_message(str(e) + '\n') - except ExploitFailedException, e: + except ExploitFailedException as e: dlg.add_message(str(e) + '\n') else: dlg.add_message(_("Done\n")) diff --git a/w3af/core/ui/gui/tools/encdec.py b/w3af/core/ui/gui/tools/encdec.py index 7157d83e6a..250fcc7e8b 100644 --- a/w3af/core/ui/gui/tools/encdec.py +++ b/w3af/core/ui/gui/tools/encdec.py @@ -222,7 +222,7 @@ def run(self): try: self.result = self.func(self.text) self.ok = True - except Exception, e: + except Exception as e: self.exception = e self.ok = False finally: diff --git a/w3af/core/ui/gui/wizard.py b/w3af/core/ui/gui/wizard.py index 27919c3c34..a7cf4898f3 100644 --- a/w3af/core/ui/gui/wizard.py +++ b/w3af/core/ui/gui/wizard.py @@ -63,7 +63,7 @@ def save_options(self): # To get more info: try: opt.widg - except Exception, e: + except Exception as e: raise Exception(str(e) + ' || ' + opt.get_name()) # end of debugging code diff --git a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py index aa9c4bd418..1aad7327ad 100755 --- a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py +++ b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py @@ -56,7 +56,7 @@ def send_email(msg): s.sendmail(FROM, TO, msg.as_string()) s.quit() # Catch all for SMTP exceptions - except smtplib.SMTPException, e: + except smtplib.SMTPException as e: print "Failure to send email: %s" % str(e) def failure_email(msg): @@ -157,7 +157,7 @@ def main(): try: main() - except Exception, e: + except Exception as e: log_fd.write("An exception has occurred:\n%s" % str(traceback.format_exc())) log_fd.write("Regression test finished at %s\n\n" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py index a4e877e4a6..d606dbf07f 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py @@ -422,13 +422,13 @@ def dumpTable(self, foundData=None): "db": safeSQLIdentificatorNaming(conf.db)} try: attackDumpedTable() - except (IOError, OSError), ex: + except (IOError, OSError) as ex: errMsg = "an error occurred while attacking " errMsg += "table dump ('%s')" % getSafeExString(ex) logger.critical(errMsg) conf.dumper.dbTableValues(kb.data.dumpedTable) - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: errMsg = "connection exception detected in dumping phase " errMsg += "('%s')" % getSafeExString(ex) logger.critical(errMsg) diff --git a/w3af/plugins/audit/deserialization/net/generator.py b/w3af/plugins/audit/deserialization/net/generator.py index 2a337ed3d0..16ad02559b 100644 --- a/w3af/plugins/audit/deserialization/net/generator.py +++ b/w3af/plugins/audit/deserialization/net/generator.py @@ -92,7 +92,7 @@ def main(payloads): try: p1, o1 = get_payload_bin_for_command_len(payload, 1) p2, o2 = get_payload_bin_for_command_len(payload, 2) - except Exception, e: + except Exception as e: args = (payload, e) msg = 'Failed to create %s.json, exception: "%s"' print(msg % args) diff --git a/w3af/plugins/audit/frontpage.py b/w3af/plugins/audit/frontpage.py index 1e1f987a56..f1ce8b65bd 100644 --- a/w3af/plugins/audit/frontpage.py +++ b/w3af/plugins/audit/frontpage.py @@ -115,7 +115,7 @@ def _upload_file(self, domain_path, rand_file, debugging_id): res = self._uri_opener.POST(target_url, data=data, debugging_id=debugging_id) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.debug('Exception while uploading file using author.dll: %s' % e) return None else: @@ -139,7 +139,7 @@ def _verify_upload(self, domain_path, rand_file, upload_id, debugging_id): cache=False, grep=False, debugging_id=debugging_id) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.debug('Exception while verifying if the file that was uploaded' 'using author.dll was there: %s' % e) else: diff --git a/w3af/plugins/audit/rfi.py b/w3af/plugins/audit/rfi.py index 81339ad17f..90733962a4 100644 --- a/w3af/plugins/audit/rfi.py +++ b/w3af/plugins/audit/rfi.py @@ -246,7 +246,7 @@ def _local_test_inclusion(self, freq, orig_response, debugging_id): # Perform the real work self._test_inclusion(freq, rfi_data, orig_response, debugging_id) - except socket.error, se: + except socket.error as se: errorcode = se[0] if errorcode == errno.EADDRINUSE: # We can't use this address because it is already in use @@ -257,7 +257,7 @@ def _local_test_inclusion(self, freq, orig_response, debugging_id): 'rfi plugin. The address is already in use by another process.') om.out.error(msg) - except Exception, e: + except Exception as e: msg = 'An error occurred while running local web server for' \ ' the remote file inclusion (rfi) plugin: "%s"' om.out.error(msg % e) @@ -491,7 +491,7 @@ def do_GET(self): self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(self.RESPONSE_BODY) - except Exception, e: + except Exception as e: om.out.debug('[RFIWebHandler] Exception: "%s".' % e) finally: # Clean up diff --git a/w3af/plugins/audit/ssl_certificate.py b/w3af/plugins/audit/ssl_certificate.py index 950b074a14..a26bedb2be 100644 --- a/w3af/plugins/audit/ssl_certificate.py +++ b/w3af/plugins/audit/ssl_certificate.py @@ -95,7 +95,7 @@ def _analyze_ssl_cert(self, domain, port): try: cert, cert_der, cipher = self._get_ssl_cert(domain, port) - except Exception, e: + except Exception as e: om.out.debug('Failed to retrieve SSL certificate: "%s"' % e) else: self._cert_expiration_analysis(domain, port, cert, cert_der, cipher) @@ -281,7 +281,7 @@ def _ssl_connect_specific_protocol(self, # Raise SSL errors raise - except Exception, e: + except Exception as e: msg = 'Unhandled %s exception in _ssl_connect_specific_protocol(): "%s"' args = (e.__class__.__name__, e) om.out.debug(msg % args) @@ -296,7 +296,7 @@ def _ssl_connect_specific_protocol(self, try: ssl_sock.close() - except Exception, e: + except Exception as e: om.out.debug('Exception found while closing SSL socket: "%s"' % e) return result diff --git a/w3af/plugins/grep/http_auth_detect.py b/w3af/plugins/grep/http_auth_detect.py index 00c1f6751a..4c50fbb21a 100644 --- a/w3af/plugins/grep/http_auth_detect.py +++ b/w3af/plugins/grep/http_auth_detect.py @@ -96,7 +96,7 @@ def _find_auth_uri(self, response): url_list = [] try: document_parser = parser_cache.dpc.get_document_parser_for(response) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'Failed to find a suitable document parser. Exception: "%s"' om.out.debug(msg % e) else: diff --git a/w3af/plugins/grep/serialized_object.py b/w3af/plugins/grep/serialized_object.py index 7169897014..87cb10b0e2 100644 --- a/w3af/plugins/grep/serialized_object.py +++ b/w3af/plugins/grep/serialized_object.py @@ -131,7 +131,7 @@ def _analyze_param(self, request, response, parameter_name, parameter_value, """ try: match_object = serialized_object_re.search(parameter_value) - except Exception, e: + except Exception as e: args = (e, parameter_value) om.out.debug('An exception was found while trying to find a' ' serialized object in a parameter value. The exception' diff --git a/w3af/plugins/grep/user_defined_regex.py b/w3af/plugins/grep/user_defined_regex.py index b8a64f1d05..2bab183012 100644 --- a/w3af/plugins/grep/user_defined_regex.py +++ b/w3af/plugins/grep/user_defined_regex.py @@ -125,7 +125,7 @@ def set_options(self, options_list): try: f = file(self._regex_file_path) - except Exception, e: + except Exception as e: msg = 'Unable to open file "%s", error: "%s".' raise BaseFrameworkException(msg % (self._regex_file_path, e)) else: From 78d89ee7939ddb570308b9acfb72cbb302aaf526 Mon Sep 17 00:00:00 2001 From: "Mohammad Parishan ./" Date: Mon, 31 Dec 2018 00:24:37 -0800 Subject: [PATCH 04/46] Fix all of Exception syntax ./ --- .../controllers/auto_update/git_client.py | 2 +- .../controllers/auto_update/ui_wrapper.py | 2 +- .../core_helpers/consumers/audit.py | 8 +++---- .../core_helpers/consumers/auth.py | 2 +- .../core_helpers/consumers/bruteforce.py | 6 ++--- .../consumers/crawl_infrastructure.py | 8 +++---- .../core_helpers/consumers/grep.py | 6 ++--- .../core_helpers/consumers/seed.py | 2 +- .../consumers/tests/test_base_consumer.py | 4 ++-- .../core_helpers/exception_handler.py | 2 +- .../core/controllers/core_helpers/profiles.py | 4 ++-- .../core/controllers/core_helpers/strategy.py | 14 +++++------ .../tests/test_exception_handler.py | 10 ++++---- .../core/controllers/daemons/proxy/handler.py | 2 +- .../daemons/proxy/intercept_handler.py | 4 ++-- .../proxy/tests/test_intercept_proxy.py | 2 +- w3af/core/controllers/daemons/webserver.py | 4 ++-- .../easy_contribution/github_issues.py | 2 +- w3af/core/controllers/misc/decorators.py | 2 +- w3af/core/controllers/misc/factory.py | 4 ++-- .../controllers/output_manager/manager.py | 4 ++-- .../payload_transfer_factory.py | 2 +- w3af/core/controllers/plugins/audit_plugin.py | 2 +- .../plugins/tests/test_404_errors.py | 2 +- w3af/core/controllers/profiling/core_stats.py | 2 +- .../profiling/extract_http_from_log.py | 2 +- .../profiling/scan_log_analysis/main/watch.py | 2 +- .../test_multiple_instances.py | 2 +- w3af/core/controllers/threads/pool276.py | 2 +- .../threads/silent_joinable_queue.py | 2 +- w3af/core/controllers/threads/threadpool.py | 2 +- w3af/core/controllers/vdaemon/pe.py | 2 +- w3af/core/controllers/vdaemon/vdaemon.py | 6 ++--- .../w3afAgent/client/w3afAgentClient.py | 2 +- .../w3afAgent/server/w3afAgentServer.py | 2 +- .../controllers/w3afAgent/w3afAgentManager.py | 2 +- w3af/core/controllers/w3afCore.py | 4 ++-- w3af/core/data/db/dbms.py | 2 +- w3af/core/data/kb/exec_shell.py | 2 +- w3af/core/data/options/form_id_list_option.py | 2 +- w3af/core/data/options/input_file_option.py | 2 +- w3af/core/data/options/regex_option.py | 2 +- w3af/core/data/options/url_list_option.py | 2 +- w3af/core/data/options/url_option.py | 2 +- w3af/core/data/parsers/doc/sgml.py | 8 +++---- w3af/core/data/parsers/doc/wsdl.py | 2 +- w3af/core/data/parsers/mp_document_parser.py | 6 ++--- w3af/core/data/parsers/parser_cache.py | 6 ++--- w3af/core/data/profile/profile.py | 8 +++---- w3af/core/data/search_engines/google.py | 2 +- .../core/data/search_engines/search_engine.py | 4 ++-- w3af/core/data/url/extended_urllib.py | 6 ++--- .../data/url/handlers/cache_backend/db.py | 2 +- .../data/url/handlers/cache_backend/disk.py | 10 ++++---- .../url/handlers/keepalive/connections.py | 2 +- .../data/url/handlers/keepalive/handler.py | 6 ++--- .../core/data/url/tests/helpers/ssl_daemon.py | 2 +- w3af/core/data/url/tests/test_xurllib.py | 2 +- .../url/tests/test_xurllib_error_handling.py | 4 ++-- .../data/url/tests/test_xurllib_timeout.py | 4 ++-- w3af/core/ui/api/tests/test_exceptions.py | 2 +- w3af/core/ui/console/config.py | 6 ++--- w3af/core/ui/console/console_ui.py | 6 ++--- w3af/core/ui/console/exploit.py | 4 ++-- w3af/core/ui/console/io/console.py | 2 +- w3af/core/ui/console/io/unixctrl.py | 4 ++-- w3af/core/ui/console/kbMenu.py | 2 +- w3af/core/ui/console/plugins.py | 2 +- w3af/core/ui/gui/output/gtk_output.py | 2 +- w3af/core/ui/gui/rrviews/rendering.py | 2 +- w3af/core/ui/gui/tools/fuzzy_requests.py | 4 ++-- w3af/core/ui/gui/tools/helpers/fuzzygen.py | 2 +- .../ui/gui/tools/helpers/threaded_impact.py | 2 +- w3af/plugins/attack/dav.py | 2 +- .../attack/db/sqlmap/lib/controller/action.py | 6 ++--- .../attack/db/sqlmap/lib/controller/checks.py | 6 ++--- .../db/sqlmap/lib/controller/controller.py | 2 +- .../attack/db/sqlmap/lib/core/bigarray.py | 6 ++--- .../attack/db/sqlmap/lib/core/common.py | 8 +++---- .../plugins/attack/db/sqlmap/lib/core/dump.py | 4 ++-- .../attack/db/sqlmap/lib/core/option.py | 24 +++++++++---------- .../attack/db/sqlmap/lib/core/replication.py | 2 +- .../attack/db/sqlmap/lib/core/testing.py | 4 ++-- .../attack/db/sqlmap/lib/core/threads.py | 4 ++-- .../attack/db/sqlmap/lib/core/wordlist.py | 4 ++-- .../attack/db/sqlmap/lib/parse/configfile.py | 2 +- .../attack/db/sqlmap/lib/parse/payloads.py | 8 +++---- .../attack/db/sqlmap/lib/parse/sitemap.py | 2 +- .../attack/db/sqlmap/lib/request/connect.py | 8 +++---- .../plugins/attack/db/sqlmap/lib/utils/api.py | 4 ++-- .../attack/db/sqlmap/lib/utils/crawler.py | 4 ++-- .../attack/db/sqlmap/lib/utils/hash.py | 6 ++--- .../attack/db/sqlmap/lib/utils/hashdb.py | 4 ++-- .../db/sqlmap/lib/utils/pivotdumptable.py | 2 +- .../attack/db/sqlmap/lib/utils/search.py | 6 ++--- .../db/sqlmap/plugins/generic/custom.py | 2 +- .../thirdparty/beautifulsoup/beautifulsoup.py | 2 +- w3af/plugins/attack/local_file_reader.py | 10 ++++---- w3af/plugins/attack/os_commanding.py | 2 +- .../attack/payloads/payloads/php_sca.py | 2 +- w3af/plugins/attack/rfi.py | 6 ++--- w3af/plugins/attack/xpath.py | 10 ++++---- .../audit/deserialization/java/generator.py | 2 +- w3af/plugins/auth/detailed.py | 2 +- w3af/plugins/auth/generic.py | 2 +- w3af/plugins/crawl/dot_ds_store.py | 2 +- w3af/plugins/crawl/dwsync_xml.py | 4 ++-- w3af/plugins/crawl/find_dvcs.py | 4 ++-- w3af/plugins/crawl/ghdb.py | 6 ++--- w3af/plugins/crawl/import_results.py | 4 ++-- w3af/plugins/crawl/phishtank.py | 2 +- w3af/plugins/crawl/phishtank/update.py | 6 ++--- w3af/plugins/crawl/pykto.py | 4 ++-- w3af/plugins/crawl/spider_man.py | 2 +- w3af/plugins/crawl/url_fuzzer.py | 2 +- w3af/plugins/crawl/wordpress_fingerprint.py | 4 ++-- w3af/plugins/grep/clamav.py | 2 +- w3af/plugins/grep/retirejs.py | 4 ++-- .../infrastructure/favicon_identification.py | 2 +- w3af/plugins/infrastructure/finger_google.py | 2 +- w3af/plugins/infrastructure/hmap.py | 2 +- .../infrastructure/http_vs_https_dist.py | 2 +- w3af/plugins/infrastructure/oHmap/hmap.py | 12 +++++----- w3af/plugins/infrastructure/xssed_dot_com.py | 4 ++-- w3af/plugins/infrastructure/zone_h.py | 2 +- w3af/plugins/output/csv_file.py | 4 ++-- w3af/plugins/output/email_report.py | 2 +- w3af/plugins/output/export_requests.py | 2 +- w3af/plugins/output/json_file.py | 2 +- w3af/plugins/output/text_file.py | 8 +++---- w3af/plugins/output/xml_file.py | 2 +- .../tests/audit/test_deserialization.py | 12 +++++----- w3af/plugins/tests/audit/test_xxe.py | 10 ++++---- .../crawl/phpinfo/phpinfo-5.1.3-rc4dev.html | 4 ++-- .../tests/crawl/phpinfo/phpinfo-5.1.6.html | 2 +- w3af/plugins/tests/crawl/test_spider_man.py | 6 ++--- w3af/plugins/tests/helper.py | 2 +- w3af/plugins/tests/output/test_xml_file.py | 6 ++--- w3af/tests/waitfor-test-dependencies.py | 2 +- 139 files changed, 277 insertions(+), 277 deletions(-) diff --git a/w3af/core/controllers/auto_update/git_client.py b/w3af/core/controllers/auto_update/git_client.py index 77d57a7b7a..b446de0670 100644 --- a/w3af/core/controllers/auto_update/git_client.py +++ b/w3af/core/controllers/auto_update/git_client.py @@ -75,7 +75,7 @@ def pull(self): # or which exception would be raised. So I'm catching all and # verifying if there are conflicts in an exception and in the # case were no exceptions were raised - except Exception, e: + except Exception as e: self.handle_conflicts(latest_before_pull) msg = self.UPD_ERROR_MSG + ' The original exception was: "%s"' raise GitClientError(msg % e) diff --git a/w3af/core/controllers/auto_update/ui_wrapper.py b/w3af/core/controllers/auto_update/ui_wrapper.py index 20f62a9dfb..2504c0deee 100644 --- a/w3af/core/controllers/auto_update/ui_wrapper.py +++ b/w3af/core/controllers/auto_update/ui_wrapper.py @@ -63,7 +63,7 @@ def update(self): self._handle_update_output(resp) except KeyboardInterrupt: pass - except Exception, ex: + except Exception as ex: self._logger('An error occurred while updating: "%s"' % ex) # TODO: Please read https://github.com/andresriancho/w3af/issues/6 diff --git a/w3af/core/controllers/core_helpers/consumers/audit.py b/w3af/core/controllers/core_helpers/consumers/audit.py index 300bb7701d..c30026fccc 100644 --- a/w3af/core/controllers/core_helpers/consumers/audit.py +++ b/w3af/core/controllers/core_helpers/consumers/audit.py @@ -76,7 +76,7 @@ def _teardown(self): ' scan must stop exception was raised') self._log_end_took(msg_fmt, start_time, plugin) - except Exception, e: + except Exception as e: msg_fmt = ('Spent %.2f seconds running %s.end() until an' ' unhandled exception was found') self._log_end_took(msg_fmt, start_time, plugin) @@ -110,7 +110,7 @@ def _consume(self, fuzzable_request): """ try: orig_resp = self.get_original_response(fuzzable_request) - except Exception, e: + except Exception as e: self.handle_exception('audit', 'audit.get_original_response()', 'audit.get_original_response()', e) @@ -147,7 +147,7 @@ def _run_observers(self, fuzzable_request): try: for observer in self._observers: observer.audit(self, fuzzable_request) - except Exception, e: + except Exception as e: self.handle_exception('audit', 'audit._run_observers()', 'audit._run_observers()', e) @@ -175,7 +175,7 @@ def _audit(self, function_id, plugin, fuzzable_request, orig_resp, debugging_id) try: plugin.audit_with_copy(fuzzable_request, orig_resp, debugging_id) - except Exception, e: + except Exception as e: self.handle_exception('audit', plugin.get_name(), fuzzable_request, e) diff --git a/w3af/core/controllers/core_helpers/consumers/auth.py b/w3af/core/controllers/core_helpers/consumers/auth.py index 6a301d8498..5e74c970c7 100644 --- a/w3af/core/controllers/core_helpers/consumers/auth.py +++ b/w3af/core/controllers/core_helpers/consumers/auth.py @@ -110,7 +110,7 @@ def _login(self, function_id): try: if not plugin.is_logged(): plugin.login() - except Exception, e: + except Exception as e: self.handle_exception('auth', plugin.get_name(), None, e) took_line.send() diff --git a/w3af/core/controllers/core_helpers/consumers/bruteforce.py b/w3af/core/controllers/core_helpers/consumers/bruteforce.py index 6cce0fe4e0..0d95632cbe 100644 --- a/w3af/core/controllers/core_helpers/consumers/bruteforce.py +++ b/w3af/core/controllers/core_helpers/consumers/bruteforce.py @@ -70,7 +70,7 @@ def _teardown(self): ' scan must stop exception was raised.') self._log_end_took(msg_fmt, start_time, plugin) - except Exception, e: + except Exception as e: msg_fmt = ('Spent %.2f seconds running %s.end() until an' ' unhandled exception was found.') self._log_end_took(msg_fmt, start_time, plugin) @@ -92,7 +92,7 @@ def _run_observers(self, fuzzable_request): try: for observer in self._observers: observer.bruteforce(self, fuzzable_request) - except Exception, e: + except Exception as e: self.handle_exception('bruteforce', 'bruteforce._run_observers()', 'bruteforce._run_observers()', e) @@ -146,7 +146,7 @@ def _bruteforce(self, function_id, plugin, fuzzable_request): # TODO: Report progress to the core. try: new_frs = plugin.bruteforce_wrapper(fuzzable_request) - except Exception, e: + except Exception as e: self.handle_exception('bruteforce', plugin.get_name(), fuzzable_request, e) else: diff --git a/w3af/core/controllers/core_helpers/consumers/crawl_infrastructure.py b/w3af/core/controllers/core_helpers/consumers/crawl_infrastructure.py index c66cd29ccc..a5d49d400b 100644 --- a/w3af/core/controllers/core_helpers/consumers/crawl_infrastructure.py +++ b/w3af/core/controllers/core_helpers/consumers/crawl_infrastructure.py @@ -168,7 +168,7 @@ def _teardown(self, plugin=None): ' scan must stop exception was raised.') self._log_end_took(msg_fmt, start_time, plugin) - except Exception, e: + except Exception as e: msg_fmt = ('Spent %.2f seconds running %s.end() until an' ' unhandled exception was found.') self._log_end_took(msg_fmt, start_time, plugin) @@ -214,7 +214,7 @@ def _run_observers(self, fuzzable_request): try: for observer in self._observers: observer.crawl(self, fuzzable_request) - except Exception, e: + except Exception as e: self.handle_exception('CrawlInfrastructure', 'CrawlInfrastructure._run_observers()', 'CrawlInfrastructure._run_observers()', e) @@ -531,7 +531,7 @@ def _discover_worker(self, function_id, plugin, fuzzable_request): try: result = plugin.discover_wrapper(fuzzable_request) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'An exception was found while running "%s" with "%s": "%s".' om.out.error(msg % (plugin.get_name(), fuzzable_request), e) except RunOnce: @@ -539,7 +539,7 @@ def _discover_worker(self, function_id, plugin, fuzzable_request): # that is implemented by raising a RunOnce # exception self._remove_discovery_plugin(plugin) - except Exception, e: + except Exception as e: self.handle_exception(plugin.get_type(), plugin.get_name(), fuzzable_request, e) else: diff --git a/w3af/core/controllers/core_helpers/consumers/grep.py b/w3af/core/controllers/core_helpers/consumers/grep.py index 6660d94588..5c522f5389 100644 --- a/w3af/core/controllers/core_helpers/consumers/grep.py +++ b/w3af/core/controllers/core_helpers/consumers/grep.py @@ -85,7 +85,7 @@ def _teardown(self): try: plugin.end() - except Exception, e: + except Exception as e: msg = 'An exception was found while running %s.end(): "%s"' args = (plugin.get_name(), e) om.out.error(msg % args) @@ -170,7 +170,7 @@ def _inner_consume(self, request, response): try: plugin.grep_wrapper(request, response) - except Exception, e: + except Exception as e: self.handle_exception('grep', plugin.get_name(), request, e) else: took_line.send() @@ -183,7 +183,7 @@ def _run_observers(self, request, response): try: for observer in self._observers: observer.grep(self, request, response) - except Exception, e: + except Exception as e: self.handle_exception('grep', 'grep._run_observers()', 'grep._run_observers()', e) diff --git a/w3af/core/controllers/core_helpers/consumers/seed.py b/w3af/core/controllers/core_helpers/consumers/seed.py index 9084ed2c12..f0949eb195 100644 --- a/w3af/core/controllers/core_helpers/consumers/seed.py +++ b/w3af/core/controllers/core_helpers/consumers/seed.py @@ -90,7 +90,7 @@ def seed_output_queue(self, target_urls): except HTTPRequestException, hre: msg = 'The target URL: "%s" is unreachable. Exception: "%s".' om.out.error(msg % (url, hre)) - except Exception, e: + except Exception as e: msg = ('The target URL: "%s" is unreachable because of an' ' unhandled exception. Error description: "%s". See' ' debug output for more information.\n' diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py index 2bfb778751..f31ab7271d 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py @@ -39,7 +39,7 @@ def test_handle_exception(self): fr = FuzzableRequest(url) try: raise Exception() - except Exception, e: + except Exception as e: self.bc.handle_exception('audit', 'sqli', fr, e) exception_data = self.bc.out_queue.get() @@ -47,7 +47,7 @@ def test_handle_exception(self): self.assertTrue(exception_data.traceback is not None) self.assertEqual(exception_data.phase, 'audit') self.assertEqual(exception_data.plugin, 'sqli') - self.assertEqual(exception_data.exception, e) + self.assertEqual(exception_data.Exception as e) def test_terminate(self): self.bc.start() diff --git a/w3af/core/controllers/core_helpers/exception_handler.py b/w3af/core/controllers/core_helpers/exception_handler.py index 5cc75f97d4..2318e3e8ec 100644 --- a/w3af/core/controllers/core_helpers/exception_handler.py +++ b/w3af/core/controllers/core_helpers/exception_handler.py @@ -73,7 +73,7 @@ def handle_exception_data(self, exception_data): (_, _, exception_data.traceback), exception_data.enabled_plugins) - def handle(self, current_status, exception, exec_info, enabled_plugins): + def handle(self, current_status, Exception as exec_info, enabled_plugins): """ This method stores the current status and the exception for later processing. If there are already too many stored exceptions for this diff --git a/w3af/core/controllers/core_helpers/profiles.py b/w3af/core/controllers/core_helpers/profiles.py index c7fdcde244..eae933ae1d 100644 --- a/w3af/core/controllers/core_helpers/profiles.py +++ b/w3af/core/controllers/core_helpers/profiles.py @@ -143,7 +143,7 @@ def use_profile(self, profile_name, workdir=None): # Set the misc and http settings try: profile_misc_settings = profile_inst.get_misc_settings() - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('Setting the framework misc-settings raised an exception' ' due to unknown or invalid configuration parameters. %s') error_messages.append(msg % e) @@ -161,7 +161,7 @@ def use_profile(self, profile_name, workdir=None): try: http_settings = profile_inst.get_http_settings() - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('Setting the framework http-settings raised an exception' ' due to unknown or invalid configuration parameters. %s') error_messages.append(msg % e) diff --git a/w3af/core/controllers/core_helpers/strategy.py b/w3af/core/controllers/core_helpers/strategy.py index 30923ef3c7..37bb748efe 100644 --- a/w3af/core/controllers/core_helpers/strategy.py +++ b/w3af/core/controllers/core_helpers/strategy.py @@ -133,7 +133,7 @@ def start(self): self._fuzzable_request_router() - except Exception, e: + except Exception as e: om.out.debug('strategy.start() found exception "%s"' % e) exc_info = sys.exc_info() @@ -141,7 +141,7 @@ def start(self): try: # Terminate the consumers, exceptions at this level stop the scan self.terminate() - except Exception, e: + except Exception as e: msg = 'strategy.start() found exception while terminating workers "%s"' om.out.debug(msg % e) finally: @@ -197,7 +197,7 @@ def terminate(self): try: consumer_inst.terminate() - except Exception, e: + except Exception as e: msg = '%s consumer terminate() raised exception: "%s"' om.out.debug(msg % e) else: @@ -440,7 +440,7 @@ def verify_target_server_up(self): except ScanMustStopByUserRequest: # Not a real error, the user stopped the scan raise - except Exception, e: + except Exception as e: dbg = 'Exception found during verify_target_server_up: "%s"' om.out.debug(dbg % e) @@ -485,7 +485,7 @@ def alert_if_target_is_301_all(self): except ScanMustStopByUserRequest: # Not a real error, the user stopped the scan raise - except Exception, e: + except Exception as e: emsg = 'Exception found during alert_if_target_is_301_all(): "%s"' emsg %= e @@ -553,7 +553,7 @@ def _setup_404_detection(self): response = self._w3af_core.uri_opener.GET(url, cache=True) except ScanMustStopByUserRequest: raise - except Exception, e: + except Exception as e: msg = ('Failed to send HTTP request to the configured target' ' URL "%s", the original exception was: "%s" (%s).') args = (url, e, e.__class__.__name__) @@ -563,7 +563,7 @@ def _setup_404_detection(self): current_target_is_404 = is_404(response) except ScanMustStopByUserRequest: raise - except Exception, e: + except Exception as e: msg = ('Failed to initialize the 404 detection using HTTP' ' response from "%s", the original exception was: "%s"' ' (%s).') diff --git a/w3af/core/controllers/core_helpers/tests/test_exception_handler.py b/w3af/core/controllers/core_helpers/tests/test_exception_handler.py index 60709cd3be..b8c50b28e3 100644 --- a/w3af/core/controllers/core_helpers/tests/test_exception_handler.py +++ b/w3af/core/controllers/core_helpers/tests/test_exception_handler.py @@ -48,7 +48,7 @@ def test_handle_one(self): try: raise Exception('unittest') - except Exception, e: + except Exception as e: exec_info = sys.exc_info() enabled_plugins = '' self.exception_handler.handle(self.status, @@ -83,7 +83,7 @@ def test_handle_multiple(self): for _ in xrange(10): try: raise Exception('unittest') - except Exception, e: + except Exception as e: exec_info = sys.exc_info() enabled_plugins = '' self.exception_handler.handle(self.status, e, exec_info, @@ -109,7 +109,7 @@ def test_get_unique_exceptions(self): for _ in xrange(10): try: raise Exception('unittest') - except Exception, e: + except Exception as e: exec_info = sys.exc_info() enabled_plugins = '' self.exception_handler.handle(self.status, e, exec_info, @@ -139,7 +139,7 @@ def test2(): def test(ehandler): try: test2() - except Exception, e: + except Exception as e: exec_info = sys.exc_info() enabled_plugins = '' ehandler.handle(self.status, e, exec_info, enabled_plugins) @@ -175,7 +175,7 @@ def test2(): def test(ehandler): try: test2() - except Exception, e: + except Exception as e: exec_info = sys.exc_info() enabled_plugins = '' ehandler.handle(self.status, e, exec_info, enabled_plugins) diff --git a/w3af/core/controllers/daemons/proxy/handler.py b/w3af/core/controllers/daemons/proxy/handler.py index 3123955349..77911dade6 100644 --- a/w3af/core/controllers/daemons/proxy/handler.py +++ b/w3af/core/controllers/daemons/proxy/handler.py @@ -185,7 +185,7 @@ def handle_request_in_thread(self, flow): try: # Send the request to the remote webserver http_response = self._send_http_request(http_request) - except Exception, e: + except Exception as e: trace = str(traceback.format_exc()) http_response = self._create_error_response(http_request, None, e, trace=trace) diff --git a/w3af/core/controllers/daemons/proxy/intercept_handler.py b/w3af/core/controllers/daemons/proxy/intercept_handler.py index c9d2fa9a87..afb5dff7b9 100644 --- a/w3af/core/controllers/daemons/proxy/intercept_handler.py +++ b/w3af/core/controllers/daemons/proxy/intercept_handler.py @@ -50,7 +50,7 @@ def handle_request_in_thread(self, flow): else: # Send the request to the remote webserver http_response = self._send_http_request(http_request) - except Exception, e: + except Exception as e: trace = str(traceback.format_exc()) http_response = self._create_error_response(http_request, None, e, trace=trace) @@ -95,7 +95,7 @@ def on_request_edit_finished(self, orig_http_request, head, post_data): try: http_request = http_request_parser(head, post_data) http_response = self._send_http_request(http_request) - except Exception, e: + except Exception as e: trace = str(traceback.format_exc()) http_response = self._create_error_response(orig_http_request, None, e, trace=trace) diff --git a/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py b/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py index ce0a94210c..3cf231db97 100644 --- a/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py +++ b/w3af/core/controllers/daemons/proxy/tests/test_intercept_proxy.py @@ -149,7 +149,7 @@ def send_request(_id, proxy_opener, results, exceptions): results.put(he) except KeyboardInterrupt, k: exceptions.put(k) - except Exception, e: + except Exception as e: exceptions.put(e) else: results.put(response) diff --git a/w3af/core/controllers/daemons/webserver.py b/w3af/core/controllers/daemons/webserver.py index 8770c361c2..3f602d1fd4 100644 --- a/w3af/core/controllers/daemons/webserver.py +++ b/w3af/core/controllers/daemons/webserver.py @@ -129,7 +129,7 @@ def do_GET(self): except IOError: try: self.send_error(404, 'File Not Found: %s' % self.path) - except Exception, e: + except Exception as e: om.out.debug('[webserver] Exception: ' + str(e)) else: try: @@ -144,7 +144,7 @@ def do_GET(self): self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write(f.read()) - except Exception, e: + except Exception as e: om.out.debug('[webserver] Exception: ' + str(e)) f.close() diff --git a/w3af/core/controllers/easy_contribution/github_issues.py b/w3af/core/controllers/easy_contribution/github_issues.py index c778862790..7d53846f8b 100644 --- a/w3af/core/controllers/easy_contribution/github_issues.py +++ b/w3af/core/controllers/easy_contribution/github_issues.py @@ -90,7 +90,7 @@ def __init__(self, user_or_token, password=None): def login(self): try: self.gh = Github(self._user_or_token, self._password) - except GithubException, ex: + except GithubException as ex: # Not sure when we get here, but just in case... raise LoginFailed(str(ex)) else: diff --git a/w3af/core/controllers/misc/decorators.py b/w3af/core/controllers/misc/decorators.py index 95dd572af9..fc5f48f2dd 100644 --- a/w3af/core/controllers/misc/decorators.py +++ b/w3af/core/controllers/misc/decorators.py @@ -86,7 +86,7 @@ def f_retry(*args, **kwargs): while mtries >= 0: try: rv = f(*args, **kwargs) - except Exception, ex: + except Exception as ex: # Ok, fail! if mtries == 0: if exc_class: diff --git a/w3af/core/controllers/misc/factory.py b/w3af/core/controllers/misc/factory.py index 1b8b9c242c..380a2240a5 100644 --- a/w3af/core/controllers/misc/factory.py +++ b/w3af/core/controllers/misc/factory.py @@ -76,7 +76,7 @@ def factory(module_name, *args): # Raise so the user sees the whole traceback raise - except Exception, e: + except Exception as e: msg = 'There was an error while importing %s: "%s".' raise BaseFrameworkException(msg % (module_name, e)) @@ -95,7 +95,7 @@ def factory(module_name, *args): try: inst = a_class(*args) - except Exception, e: + except Exception as e: msg = ('Failed to create an instance of "%s". The original exception' ' was: "%s". Traceback for this error:\n%s') msg = msg % (class_name, e, traceback.format_exc()) diff --git a/w3af/core/controllers/output_manager/manager.py b/w3af/core/controllers/output_manager/manager.py index 9a5da2ca91..58e9596615 100644 --- a/w3af/core/controllers/output_manager/manager.py +++ b/w3af/core/controllers/output_manager/manager.py @@ -249,7 +249,7 @@ def __inner_flush_plugin_output(self, o_plugin): try: o_plugin.flush() - except Exception, exception: + except Exception as exception: self._handle_output_plugin_exception(o_plugin, exception) finally: o_plugin.is_running_flush = False @@ -427,7 +427,7 @@ def _call_output_plugins_action(self, action_name, *args, **kwds): try: opl_func_ptr = getattr(o_plugin, action_name) apply(opl_func_ptr, args, kwds) - except Exception, exception: + except Exception as exception: self._handle_output_plugin_exception(o_plugin, exception) def set_output_plugin_inst(self, output_plugin_inst): diff --git a/w3af/core/controllers/payload_transfer/payload_transfer_factory.py b/w3af/core/controllers/payload_transfer/payload_transfer_factory.py index e803a1ff9f..0aabef09b6 100644 --- a/w3af/core/controllers/payload_transfer/payload_transfer_factory.py +++ b/w3af/core/controllers/payload_transfer/payload_transfer_factory.py @@ -79,7 +79,7 @@ def get_transfer_handler(self, inbound_port=None): 'methods can be used. Trying inband echo transfer method.' ' Error: "%s"') om.out.error(msg % w3) - except Exception, e: + except Exception as e: om.out.error('Unhandled exception: "%s"' % e) else: to_test.append(ReverseFTP(self._exec_method, os, inbound_port)) diff --git a/w3af/core/controllers/plugins/audit_plugin.py b/w3af/core/controllers/plugins/audit_plugin.py index 9ae45018bc..6362cf0457 100644 --- a/w3af/core/controllers/plugins/audit_plugin.py +++ b/w3af/core/controllers/plugins/audit_plugin.py @@ -72,7 +72,7 @@ def audit_return_vulns(self, fuzzable_request): try: orig_response = self.get_original_response(fuzzable_request) self.audit_with_copy(fuzzable_request, orig_response, debugging_id) - except Exception, e: + except Exception as e: om.out.error(str(e)) finally: self._store_kb_vulns = False diff --git a/w3af/core/controllers/plugins/tests/test_404_errors.py b/w3af/core/controllers/plugins/tests/test_404_errors.py index 2994746d64..8aa03650ca 100644 --- a/w3af/core/controllers/plugins/tests/test_404_errors.py +++ b/w3af/core/controllers/plugins/tests/test_404_errors.py @@ -74,7 +74,7 @@ def test_raises_other_exceptions(self): try: self.plugin.grep_wrapper(request, resp) - except Exception, e: + except Exception as e: self.assertEqual(str(e), msg) else: self.assertTrue(False, 'Expected exception, success found!') \ No newline at end of file diff --git a/w3af/core/controllers/profiling/core_stats.py b/w3af/core/controllers/profiling/core_stats.py index e42bec6ebf..a76cbdae90 100644 --- a/w3af/core/controllers/profiling/core_stats.py +++ b/w3af/core/controllers/profiling/core_stats.py @@ -87,7 +87,7 @@ def dump_data(w3af_core): 'Output manager input queue size': om.manager.get_in_queue().qsize(), 'Cache stats': get_parser_cache_stats()} - except Exception, e: + except Exception as e: exc_type, exc_value, exc_tb = sys.exc_info() tback = traceback.format_exception(exc_type, exc_value, exc_tb) diff --git a/w3af/core/controllers/profiling/extract_http_from_log.py b/w3af/core/controllers/profiling/extract_http_from_log.py index f086fd6618..35efc2c731 100755 --- a/w3af/core/controllers/profiling/extract_http_from_log.py +++ b/w3af/core/controllers/profiling/extract_http_from_log.py @@ -48,7 +48,7 @@ def extract(log_file, http_request_id): def main(args): try: request, response = extract(args.log_file, args.id) - except Exception, e: + except Exception as e: print(e) sys.exit(1) diff --git a/w3af/core/controllers/profiling/scan_log_analysis/main/watch.py b/w3af/core/controllers/profiling/scan_log_analysis/main/watch.py index 520060e6a0..64d8e10f49 100644 --- a/w3af/core/controllers/profiling/scan_log_analysis/main/watch.py +++ b/w3af/core/controllers/profiling/scan_log_analysis/main/watch.py @@ -16,6 +16,6 @@ def watch(scan, function_name): time.sleep(5) except KeyboardInterrupt: sys.exit(0) - except Exception, e: + except Exception as e: print('Exception: %s' % e) sys.exit(1) diff --git a/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py b/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py index 846022100d..673981b436 100644 --- a/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py +++ b/w3af/core/controllers/tests/core_test_suite/test_multiple_instances.py @@ -30,7 +30,7 @@ def start_w3af_core(exception_handler): try: w3afCore() - except Exception, e: + except Exception as e: if exception_handler: exception_handler(e) diff --git a/w3af/core/controllers/threads/pool276.py b/w3af/core/controllers/threads/pool276.py index cf54a737dc..aeb44946b3 100644 --- a/w3af/core/controllers/threads/pool276.py +++ b/w3af/core/controllers/threads/pool276.py @@ -129,7 +129,7 @@ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): job, i, func, args, kwds = task try: result = (True, func(*args, **kwds)) - except Exception, e: + except Exception as e: result = (False, e) try: diff --git a/w3af/core/controllers/threads/silent_joinable_queue.py b/w3af/core/controllers/threads/silent_joinable_queue.py index 208de671e9..82fa8ab160 100644 --- a/w3af/core/controllers/threads/silent_joinable_queue.py +++ b/w3af/core/controllers/threads/silent_joinable_queue.py @@ -58,7 +58,7 @@ def _feed(buffer, notempty, send, writelock, close): except Exception as e: if getattr(e, 'errno', 0) == errno.EPIPE: return - except Exception, e: + except Exception as e: # Since this runs in a daemon thread the resources it uses # may be become unusable while the process is cleaning up. # We ignore errors which happen after the process has diff --git a/w3af/core/controllers/threads/threadpool.py b/w3af/core/controllers/threads/threadpool.py index d428b1f1b0..4cb3c5028b 100644 --- a/w3af/core/controllers/threads/threadpool.py +++ b/w3af/core/controllers/threads/threadpool.py @@ -275,7 +275,7 @@ def __call__(self, inqueue, outqueue, initializer=None, initargs=(), maxtasks=No try: result = (True, func(*args, **kwds)) - except Exception, e: + except Exception as e: add_traceback_string(e) result = (False, e) diff --git a/w3af/core/controllers/vdaemon/pe.py b/w3af/core/controllers/vdaemon/pe.py index 7e3c2f73dd..2ffe44882c 100644 --- a/w3af/core/controllers/vdaemon/pe.py +++ b/w3af/core/controllers/vdaemon/pe.py @@ -52,7 +52,7 @@ def dump(self): """ try: template = file(self._templateFileName, 'r').read() - except Exception, e: + except Exception as e: raise BaseFrameworkException( 'Failed to open PE template file. Exception: ' + str(e)) else: diff --git a/w3af/core/controllers/vdaemon/vdaemon.py b/w3af/core/controllers/vdaemon/vdaemon.py index 465878684d..5eec362f71 100644 --- a/w3af/core/controllers/vdaemon/vdaemon.py +++ b/w3af/core/controllers/vdaemon/vdaemon.py @@ -100,14 +100,14 @@ def run(self, user_defined_parameters): try: executable_file_name = self._generate_exe(payload, msfpayload_parameters) - except Exception, e: + except Exception as e: raise BaseFrameworkException( 'Failed to create the payload file, error: "%s".' % str(e)) try: remote_file_location = self._send_exe_to_server( executable_file_name) - except BaseFrameworkException, e: + except BaseFrameworkException as e: error_msg = 'Failed to send the payload file, error: "%s".' raise BaseFrameworkException(error_msg % e) else: @@ -124,7 +124,7 @@ def run(self, user_defined_parameters): else: try: self._exec_payload(remote_file_location) - except Exception, e: + except Exception as e: raise BaseFrameworkException('Failed to execute the executable file on the server, error: %s' % e) else: om.out.console('Successfully executed the MSF payload on the remote server.') diff --git a/w3af/core/controllers/w3afAgent/client/w3afAgentClient.py b/w3af/core/controllers/w3afAgent/client/w3afAgentClient.py index 6dc63e8938..e9f6598f90 100755 --- a/w3af/core/controllers/w3afAgent/client/w3afAgentClient.py +++ b/w3af/core/controllers/w3afAgent/client/w3afAgentClient.py @@ -254,7 +254,7 @@ def gen_connections(self, number): try: s.connect((self._w3afAgentServer_address, self._w3afAgentServer_port)) - except Exception, e: + except Exception as e: log.debug('Failed to connect to the w3afAgentServer, exception: ' + str(e)) sys.exit(1) else: diff --git a/w3af/core/controllers/w3afAgent/server/w3afAgentServer.py b/w3af/core/controllers/w3afAgent/server/w3afAgentServer.py index 13733b85b6..91718b64db 100644 --- a/w3af/core/controllers/w3afAgent/server/w3afAgentServer.py +++ b/w3af/core/controllers/w3afAgent/server/w3afAgentServer.py @@ -79,7 +79,7 @@ def run(self): self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock.bind((self._ip_address, self._port)) self.sock.listen(5) - except Exception, e: + except Exception as e: msg = '[w3afAgentServer] Failed to bind to %s:%s' % ( self._ip_address, self._port) msg += '. Error: "%s".' % e diff --git a/w3af/core/controllers/w3afAgent/w3afAgentManager.py b/w3af/core/controllers/w3afAgent/w3afAgentManager.py index 6f24523fc7..bbce59fe52 100644 --- a/w3af/core/controllers/w3afAgent/w3afAgentManager.py +++ b/w3af/core/controllers/w3afAgent/w3afAgentManager.py @@ -213,7 +213,7 @@ def _get_inbound_port(self): es = extrusionScanner(self._exec_method) try: inbound_port = es.get_inbound_port() - except Exception, e: + except Exception as e: om.out.error('The extrusion scan failed.') om.out.error('Error: ' + str(e)) diff --git a/w3af/core/controllers/w3afCore.py b/w3af/core/controllers/w3afCore.py index e9a0c5df1a..7675c67c2f 100644 --- a/w3af/core/controllers/w3afCore.py +++ b/w3af/core/controllers/w3afCore.py @@ -202,7 +202,7 @@ def start(self): try: # Just in case the GUI / Console forgot to do this... self.verify_environment() - except Exception, e: + except Exception as e: error = ('verify_environment() raised an exception: "%s". This' ' should never happen. Are you (UI developer) sure that' ' you called verify_environment() *before* start() ?') @@ -277,7 +277,7 @@ def start(self): ' resolved:\n%s\n') om.out.error(error % wmse) - except Exception, e: + except Exception as e: msg = 'Unhandled exception "%s", traceback:\n%s' om.out.error(msg % (e, traceback.format_exc())) raise diff --git a/w3af/core/data/db/dbms.py b/w3af/core/data/db/dbms.py index 16c2b876ec..7adf2f7940 100644 --- a/w3af/core/data/db/dbms.py +++ b/w3af/core/data/db/dbms.py @@ -452,7 +452,7 @@ def run(self): future.set_exception(dbe) - except Exception, e: + except Exception as e: dbe = DBException(str(e)) future.set_exception(dbe) diff --git a/w3af/core/data/kb/exec_shell.py b/w3af/core/data/kb/exec_shell.py index 3dc63178da..89d20e61ef 100644 --- a/w3af/core/data/kb/exec_shell.py +++ b/w3af/core/data/kb/exec_shell.py @@ -149,7 +149,7 @@ def write(self, remote_filename, file_content): try: ptf = payload_transfer_factory(self.execute) self._transfer_handler = ptf.get_transfer_handler() - except BaseFrameworkException, e: + except BaseFrameworkException as e: return '%s' % e if not self._transfer_handler.can_transfer(): diff --git a/w3af/core/data/options/form_id_list_option.py b/w3af/core/data/options/form_id_list_option.py index 632f762fdd..0b7ca0efeb 100644 --- a/w3af/core/data/options/form_id_list_option.py +++ b/w3af/core/data/options/form_id_list_option.py @@ -44,6 +44,6 @@ def set_value(self, value): def validate(self, value): try: return FormIDMatcherList(value) - except Exception, e: + except Exception as e: msg = 'Invalid form ID list configured by user, error: %s.' % e raise BaseFrameworkException(msg) diff --git a/w3af/core/data/options/input_file_option.py b/w3af/core/data/options/input_file_option.py index 8df5207e20..ec6f60bea4 100644 --- a/w3af/core/data/options/input_file_option.py +++ b/w3af/core/data/options/input_file_option.py @@ -95,7 +95,7 @@ def get_value_for_profile(self, self_contained=False): if self_contained or self.should_base64_encode_file(self._value): try: return self.encode_b64_data(self._value) - except Exception, e: + except Exception as e: msg = ('An exception occurred while encoding "%s" for storing' ' into the profile: "%s"') raise BaseFrameworkException(msg % (self._value, e)) diff --git a/w3af/core/data/options/regex_option.py b/w3af/core/data/options/regex_option.py index b1fecf14c3..28d88b3daf 100644 --- a/w3af/core/data/options/regex_option.py +++ b/w3af/core/data/options/regex_option.py @@ -43,7 +43,7 @@ def set_value(self, value): def validate(self, value): try: re.compile(value) - except Exception, e: + except Exception as e: msg = 'The regular expression "%s" is invalid, the compilation'\ ' error was: "%s".' raise BaseFrameworkException(msg % (value, e)) diff --git a/w3af/core/data/options/url_list_option.py b/w3af/core/data/options/url_list_option.py index afaacc0722..e866ff4205 100644 --- a/w3af/core/data/options/url_list_option.py +++ b/w3af/core/data/options/url_list_option.py @@ -39,7 +39,7 @@ def validate(self, value): for input_url in parsed_list: try: res.append(URL(input_url)) - except Exception, e: + except Exception as e: msg = 'Invalid URL configured by user, error: %s.' % e raise BaseFrameworkException(msg) diff --git a/w3af/core/data/options/url_option.py b/w3af/core/data/options/url_option.py index 0804a9b5f2..b5cce4db0a 100644 --- a/w3af/core/data/options/url_option.py +++ b/w3af/core/data/options/url_option.py @@ -45,6 +45,6 @@ def set_value(self, value): def validate(self, value): try: return URL(value) - except Exception, e: + except Exception as e: msg = 'Invalid URL configured by user, error: %s.' % e raise BaseFrameworkException(msg) diff --git a/w3af/core/data/parsers/doc/sgml.py b/w3af/core/data/parsers/doc/sgml.py index 0ea5083364..6ba3729b3e 100644 --- a/w3af/core/data/parsers/doc/sgml.py +++ b/w3af/core/data/parsers/doc/sgml.py @@ -149,13 +149,13 @@ def start(self, tag): else: try: method(tag, tag_name, attrs) - except Exception, ex: + except Exception as ex: self._handle_exception('parsing %s tag' % tag_name, ex) try: if tag_name in self.TAGS_WITH_URLS: self._find_references(tag, tag_name, attrs) - except Exception, ex: + except Exception as ex: self._handle_exception('extracting references', ex) try: @@ -164,7 +164,7 @@ def start(self, tag): # changed it to this for performance if tag_name == 'a': self._find_emails(tag, tag_name, attrs) - except Exception, ex: + except Exception as ex: self._handle_exception('finding emails', ex) def end(self, tag): @@ -248,7 +248,7 @@ def _parse_response_body_as_string(self, resp_body, errors='strict'): for event, elem in context: try: event_map[event](elem) - except Exception, e: + except Exception as e: msg = ('Found a parser exception while handling tag "%s" with' ' event "%s". The exception was: "%s"') args = (elem.tag, event, e) diff --git a/w3af/core/data/parsers/doc/wsdl.py b/w3af/core/data/parsers/doc/wsdl.py index 13e71599d5..f8f270ed35 100644 --- a/w3af/core/data/parsers/doc/wsdl.py +++ b/w3af/core/data/parsers/doc/wsdl.py @@ -65,7 +65,7 @@ def set_wsdl(self, xmlData): self._proxy = SOAPpy.WSDL.Proxy(xmlData) except expat.ExpatError: raise BaseFrameworkException('The body content is not a WSDL.') - except Exception, e: + except Exception as e: msg = 'The body content is not a WSDL.' msg += ' Unhandled exception in SOAPpy: "' + str(e) + '".' om.out.debug(msg) diff --git a/w3af/core/data/parsers/mp_document_parser.py b/w3af/core/data/parsers/mp_document_parser.py index d1523f41b8..64edfbef71 100644 --- a/w3af/core/data/parsers/mp_document_parser.py +++ b/w3af/core/data/parsers/mp_document_parser.py @@ -208,7 +208,7 @@ def get_document_parser_for(self, http_response): try: parser_output = load_object_from_temp_file(process_result) - except Exception, e: + except Exception as e: msg = 'Failed to deserialize sub-process result. Exception: "%s"' args = (e,) raise Exception(msg % args) @@ -302,7 +302,7 @@ def get_tags_by_filter(self, http_response, tags, yield_text=False): try: filtered_tags = load_tags_from_temp_file(process_result) - except Exception, e: + except Exception as e: msg = 'Failed to deserialize sub-process result. Exception: "%s"' args = (e,) raise Exception(msg % args) @@ -356,7 +356,7 @@ def process_document_parser(filename, debug): try: # Parse document_parser = DocumentParser(http_resp) - except Exception, e: + except Exception as e: if debug: msg = ('[mp_document_parser] PID %s finished parsing %s with' ' exception: "%s"') diff --git a/w3af/core/data/parsers/parser_cache.py b/w3af/core/data/parsers/parser_cache.py index c31ed02937..29f5a17433 100644 --- a/w3af/core/data/parsers/parser_cache.py +++ b/w3af/core/data/parsers/parser_cache.py @@ -206,7 +206,7 @@ def get_document_parser_for(self, http_response, cache=True): # Act just like when there is no parser msg = 'Reached memory usage limit parsing "%s".' % http_response.get_url() raise BaseFrameworkException(msg) - except ScanMustStopException, e: + except ScanMustStopException as e: msg = 'The document parser is in an invalid state! %s' raise ScanMustStopException(msg % e) except: @@ -340,10 +340,10 @@ def get_tags_by_filter(self, http_response, tags, yield_text=False, cache=True): # Act just like when there is no parser self._log_return_empty(http_response, 'Reached memory usage limit') return [] - except ScanMustStopException, e: + except ScanMustStopException as e: msg = 'The document parser is in an invalid state! %s' raise ScanMustStopException(msg % e) - except Exception, e: + except Exception as e: # Act just like when there is no parser msg = 'Unhandled exception running get_tags_by_filter("%s"): %s' args = (http_response.get_url(), e) diff --git a/w3af/core/data/profile/profile.py b/w3af/core/data/profile/profile.py index 40698fe611..e1c8f10a9a 100644 --- a/w3af/core/data/profile/profile.py +++ b/w3af/core/data/profile/profile.py @@ -64,10 +64,10 @@ def __init__(self, profname='', workdir=None): with codecs.open(profname, "rb", UTF8) as fp: try: self._config.readfp(fp) - except ConfigParser.Error, cpe: + except ConfigParser.Error as cpe: msg = 'ConfigParser error in profile: "%s". Exception: "%s"' raise BaseFrameworkException(msg % (profname, cpe)) - except Exception, e: + except Exception as e: msg = 'Unknown error in profile: "%s". Exception: "%s"' raise BaseFrameworkException(msg % (profname, e)) else: @@ -179,7 +179,7 @@ def remove(self): """ try: os.unlink(self.profile_file_name) - except Exception, e: + except Exception as e: msg = ('An exception occurred while removing the profile.' ' Exception: "%s".') raise BaseFrameworkException(msg % e) @@ -204,7 +204,7 @@ def copy(self, copy_profile_name): try: shutil.copyfile(self.profile_file_name, new_profile_path_name) - except Exception, e: + except Exception as e: msg = 'An exception occurred while copying the profile. Exception:' msg += ' "%s".' % e raise BaseFrameworkException(msg % e) diff --git a/w3af/core/data/search_engines/google.py b/w3af/core/data/search_engines/google.py index d7c707b381..cc76067e04 100644 --- a/w3af/core/data/search_engines/google.py +++ b/w3af/core/data/search_engines/google.py @@ -220,7 +220,7 @@ def _do_google_search(self): # Do the request try: resp = self._do_GET(google_url_instance) - except Exception, e: + except Exception as e: msg = 'Failed to GET google.com AJAX API: "%s"' raise BaseFrameworkException(msg % e) diff --git a/w3af/core/data/search_engines/search_engine.py b/w3af/core/data/search_engines/search_engine.py index d8b365a498..65d50784fe 100644 --- a/w3af/core/data/search_engines/search_engine.py +++ b/w3af/core/data/search_engines/search_engine.py @@ -52,7 +52,7 @@ def get_n_results(self, query, limit=0): except BaseFrameworkException, w3: om.out.debug(str(w3)) raise - except Exception, e: + except Exception as e: msg = 'An unhandled exception was found in ' \ 'search_engines.SearchEngine.search(): "%s"' % str(e) om.out.error(msg) @@ -95,7 +95,7 @@ def get_n_result_pages(self, query, limit=0): except BaseFrameworkException, w3: om.out.debug(str(w3)) raise - except Exception, e: + except Exception as e: msg = ('Unhandled exception in SearchEngine.' 'get_n_result_pages(): "%s"') om.out.debug(msg % e) diff --git a/w3af/core/data/url/extended_urllib.py b/w3af/core/data/url/extended_urllib.py index e7b7ace37a..702390f488 100644 --- a/w3af/core/data/url/extended_urllib.py +++ b/w3af/core/data/url/extended_urllib.py @@ -1325,11 +1325,11 @@ def _server_root_path_is_reachable(self, request): try: self.send(req, grep=False) - except HTTPRequestException, e: + except HTTPRequestException as e: msg = 'Remote URL %s is UNREACHABLE due to: "%s"' om.out.debug(msg % (root_url, e)) return False - except Exception, e: + except Exception as e: msg = 'Internal error makes URL %s UNREACHABLE due to: "%s"' om.out.debug(msg % (root_url, e)) return False @@ -1431,7 +1431,7 @@ def _evasion(self, request): for eplugin in self._evasion_plugins: try: request = eplugin.modify_request(request) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('Evasion plugin "%s" failed to modify the request.' ' Exception: "%s".') om.out.error(msg % (eplugin.get_name(), e)) diff --git a/w3af/core/data/url/handlers/cache_backend/db.py b/w3af/core/data/url/handlers/cache_backend/db.py index 9045c0e971..6015f4d9a0 100644 --- a/w3af/core/data/url/handlers/cache_backend/db.py +++ b/w3af/core/data/url/handlers/cache_backend/db.py @@ -93,7 +93,7 @@ def store_in_cache(request, response): # Got this one during a moth scan, need to debug further raise - except Exception, ex: + except Exception as ex: args = (ex, resp.get_id(), request.get_uri(), resp.get_code()) msg = ('Exception while inserting request/response to the' ' database: "%s". The request/response that generated' diff --git a/w3af/core/data/url/handlers/cache_backend/disk.py b/w3af/core/data/url/handlers/cache_backend/disk.py index 9d1ffb27d4..7318cc93bd 100644 --- a/w3af/core/data/url/handlers/cache_backend/disk.py +++ b/w3af/core/data/url/handlers/cache_backend/disk.py @@ -60,20 +60,20 @@ def store_in_cache(request, response): headers = str(response.info()) f.write(headers) f.close() - except Exception, e: + except Exception as e: msg = 'cache.py: Could not save headers file. Exception: "%s".' raise FileException(msg % e) try: body = response.read() - except Exception, e: + except Exception as e: om.out.error('cache.py: Timeout while fetching page body.') else: try: f = open(fname + ".body", "w") f.write(body) f.close() - except Exception, e: + except Exception as e: msg = 'cache.py: Could not save body file. Exception: "%s".' raise FileException(msg % e) @@ -86,7 +86,7 @@ def store_in_cache(request, response): # store data to disk f.write(str(response.code)) f.close() - except Exception, e: + except Exception as e: msg = 'cache.py: Could not save code file. Exception: "%s".' raise FileException(msg % e) @@ -94,7 +94,7 @@ def store_in_cache(request, response): f = open(fname + ".msg", "w") f.write(str(response.msg)) f.close() - except Exception, e: + except Exception as e: msg = 'cache.py: Could not save msg file. Exception: "%s".' raise FileException(msg % e) diff --git a/w3af/core/data/url/handlers/keepalive/connections.py b/w3af/core/data/url/handlers/keepalive/connections.py index fc66bb16bf..ecefb0734c 100644 --- a/w3af/core/data/url/handlers/keepalive/connections.py +++ b/w3af/core/data/url/handlers/keepalive/connections.py @@ -241,7 +241,7 @@ def make_ssl_aware(self, sock, protocol): # Always close the tcp/ip connection on error sock.close() - except Exception, e: + except Exception as e: msg = "Unexpected exception occurred with protocol %s: '%s'" debug(msg % (protocol, e)) diff --git a/w3af/core/data/url/handlers/keepalive/handler.py b/w3af/core/data/url/handlers/keepalive/handler.py index 45b54cd133..0a72c8931e 100644 --- a/w3af/core/data/url/handlers/keepalive/handler.py +++ b/w3af/core/data/url/handlers/keepalive/handler.py @@ -159,7 +159,7 @@ def do_open(self, req): self._cm.remove_connection(conn, host, reason='socket error') raise - except Exception, e: + except Exception as e: # We better discard this connection, we don't even know what happen! reason = 'unexpected exception "%s"' % e self._cm.remove_connection(conn, host, reason=reason) @@ -192,7 +192,7 @@ def do_open(self, req): # https://github.com/andresriancho/w3af/issues/2074 self._cm.remove_connection(conn, host, reason='http connection died') raise HTTPRequestException('The HTTP connection died') - except Exception, e: + except Exception as e: # We better discard this connection, we don't even know what happen! reason = 'unexpected exception while reading "%s"' % e self._cm.remove_connection(conn, host, reason=reason) @@ -256,7 +256,7 @@ def _reuse_connection(self, conn, req, host): self._cm.remove_connection(conn, host, reason='OpenSSL.SSL.SysCallError') resp = None reason = e - except Exception, e: + except Exception as e: # adding this block just in case we've missed something we will # still raise the exception, but lets try and close the connection # and remove it first. We previously got into a nasty loop where diff --git a/w3af/core/data/url/tests/helpers/ssl_daemon.py b/w3af/core/data/url/tests/helpers/ssl_daemon.py index c85d28c0b4..2dbbc6a288 100644 --- a/w3af/core/data/url/tests/helpers/ssl_daemon.py +++ b/w3af/core/data/url/tests/helpers/ssl_daemon.py @@ -102,7 +102,7 @@ def accept(self): #print 'Connection from %s port %s, sending HTTP response' % fromaddr try: newsocket.send(self.http_response) - except Exception, e: + except Exception as e: self.errors.append(e) #print 'Failed to send HTTP response to client: "%s"' % e finally: diff --git a/w3af/core/data/url/tests/test_xurllib.py b/w3af/core/data/url/tests/test_xurllib.py index ae2cf58a66..caf9c5cafd 100644 --- a/w3af/core/data/url/tests/test_xurllib.py +++ b/w3af/core/data/url/tests/test_xurllib.py @@ -225,7 +225,7 @@ def test_url_port_not_http_many(self): except ScanMustStopException, smse: scan_must_stop_e += 1 break - except Exception, e: + except Exception as e: msg = 'Not expecting "%s".' self.assertTrue(False, msg % e.__class__.__name__) diff --git a/w3af/core/data/url/tests/test_xurllib_error_handling.py b/w3af/core/data/url/tests/test_xurllib_error_handling.py index e67c82e682..01198b00f9 100644 --- a/w3af/core/data/url/tests/test_xurllib_error_handling.py +++ b/w3af/core/data/url/tests/test_xurllib_error_handling.py @@ -81,7 +81,7 @@ def test_increasing_delay_on_errors(self): self.uri_opener.GET(url, cache=False) except HTTPRequestException: http_exception_count += 1 - except Exception, e: + except Exception as e: msg = 'Not expecting: "%s"' self.assertTrue(False, msg % e.__class__.__name__) else: @@ -166,7 +166,7 @@ def test_exception_is_raised_always_after_stop(self): http_exception_count += 1 except ScanMustStopByKnownReasonExc, smse: break - except Exception, e: + except Exception as e: msg = 'Not expecting: "%s"' self.assertTrue(False, msg % e.__class__.__name__) else: diff --git a/w3af/core/data/url/tests/test_xurllib_timeout.py b/w3af/core/data/url/tests/test_xurllib_timeout.py index f36064bee3..40d0e9751f 100644 --- a/w3af/core/data/url/tests/test_xurllib_timeout.py +++ b/w3af/core/data/url/tests/test_xurllib_timeout.py @@ -67,7 +67,7 @@ def test_timeout(self): self.uri_opener.GET(url) except HTTPRequestException, hre: self.assertEqual(hre.message, 'HTTP timeout error') - except Exception, e: + except Exception as e: msg = 'Not expecting: "%s"' self.assertTrue(False, msg % e.__class__.__name__) else: @@ -129,7 +129,7 @@ def test_timeout_many(self): scan_stop_e += 1 self.assertTrue(True) break - except Exception, e: + except Exception as e: msg = 'Not expecting: "%s"' self.assertTrue(False, msg % e.__class__.__name__) else: diff --git a/w3af/core/ui/api/tests/test_exceptions.py b/w3af/core/ui/api/tests/test_exceptions.py index 931ce251d6..eac5cbc86e 100644 --- a/w3af/core/ui/api/tests/test_exceptions.py +++ b/w3af/core/ui/api/tests/test_exceptions.py @@ -64,7 +64,7 @@ def test_query_exceptions(self): #u'lineno': 123, u'phase': u'phase', u'plugin': u'plugin'} - self.assertEqual(exception, expected_summary) + self.assertEqual(Exception as expected_summary) response = self.app.get('/scans/%s/exceptions/0' % scan_id, headers=self.HEADERS) diff --git a/w3af/core/ui/console/config.py b/w3af/core/ui/console/config.py index 248e37ca07..5220fba735 100644 --- a/w3af/core/ui/console/config.py +++ b/w3af/core/ui/console/config.py @@ -115,7 +115,7 @@ def _cmd_set(self, params): try: self._options[name].set_value(value) self._unsaved_options[name] = value - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) else: if value not in self._memory[name]: @@ -151,7 +151,7 @@ def _cmd_save(self, tokens): self._configurable.get_name(), self._options) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'Identified an error with the user-defined settings:\n\n'\ ' - %s \n\n'\ 'No information has been saved.' @@ -163,7 +163,7 @@ def _cmd_save(self, tokens): def _cmd_back(self, tokens): try: self._cmd_save(tokens) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) return self._console.back diff --git a/w3af/core/ui/console/console_ui.py b/w3af/core/ui/console/console_ui.py index 99d4ec0938..69fd5fd34f 100644 --- a/w3af/core/ui/console/console_ui.py +++ b/w3af/core/ui/console/console_ui.py @@ -161,7 +161,7 @@ def sh(self, name='w3af', callback=None): try: c = term.getch() self._handleKey(c) - except Exception, e: + except Exception as e: om.out.console(str(e)) term.set_raw_input_mode(False) @@ -230,7 +230,7 @@ def _handleKey(self, key): self._handlers[key]() else: self._paste(key) - except Exception, e: + except Exception as e: # TODO traceback.print_exc() @@ -290,7 +290,7 @@ def _execute(self): menu = None self.exit() - except BaseFrameworkException, e: + except BaseFrameworkException as e: menu = None om.out.console(e.value) diff --git a/w3af/core/ui/console/exploit.py b/w3af/core/ui/console/exploit.py index ac2abd2c82..4093e3393f 100644 --- a/w3af/core/ui/console/exploit.py +++ b/w3af/core/ui/console/exploit.py @@ -202,7 +202,7 @@ def _exploit(self, plugin_name, params, show_list=True): try: response = plugin.can_exploit(vuln_to_exploit) - except BaseFrameworkException, e: + except BaseFrameworkException as e: raise e else: if not response: @@ -327,7 +327,7 @@ def _callback(self, command): response = shell.generic_user_input(command, params) except BaseFrameworkException: raise - except Exception, e: + except Exception as e: msg = 'The "%s" plugin failed to execute the user command,'\ ' exception: "%s".' om.out.error(msg % (self._plugin.get_name(), e)) diff --git a/w3af/core/ui/console/io/console.py b/w3af/core/ui/console/io/console.py index 6b161485aa..bd05a5e1d9 100644 --- a/w3af/core/ui/console/io/console.py +++ b/w3af/core/ui/console/io/console.py @@ -134,7 +134,7 @@ def terminal_width(): import tty import termios from w3af.core.ui.console.io.unixctrl import * -except Exception, e: +except Exception as e: # We aren't on unix ! try: import msvcrt diff --git a/w3af/core/ui/console/io/unixctrl.py b/w3af/core/ui/console/io/unixctrl.py index 9b02f01e5d..3511a34ab9 100644 --- a/w3af/core/ui/console/io/unixctrl.py +++ b/w3af/core/ui/console/io/unixctrl.py @@ -73,7 +73,7 @@ def set_raw_input_mode(raw): try: old_settings = termios.tcgetattr(fd) tty.setraw(sys.stdin.fileno()) - except Exception, e: + except Exception as e: om.out.console('termios error: ' + str(e)) elif not (raw or old_settings is None): @@ -82,7 +82,7 @@ def set_raw_input_mode(raw): termios.TCSADRAIN, old_settings) old_settings = None - except Exception, e: + except Exception as e: om.out.console('termios error: ' + str(e)) diff --git a/w3af/core/ui/console/kbMenu.py b/w3af/core/ui/console/kbMenu.py index f6a257baee..ddbfc8227d 100644 --- a/w3af/core/ui/console/kbMenu.py +++ b/w3af/core/ui/console/kbMenu.py @@ -131,7 +131,7 @@ def _cmd_back(self, tokens): try: self._configurable.store_in_kb() - except Exception, e: + except Exception as e: msg = 'Failed to store "%s" in the knowledge base because of a'\ ' configuration error at: "%s".' om.out.console(msg % (vuln_name, e)) diff --git a/w3af/core/ui/console/plugins.py b/w3af/core/ui/console/plugins.py index af3bc7344b..a3c4731f24 100644 --- a/w3af/core/ui/console/plugins.py +++ b/w3af/core/ui/console/plugins.py @@ -121,7 +121,7 @@ def __init__(self, name, console, w3af, parent): try: options = self._w3af.plugins.get_plugin_inst( self._name, p).get_options() - except Exception, e: + except Exception as e: om.out.error('Error while reading plugin options: "%s"' % e) sys.exit(-8) else: diff --git a/w3af/core/ui/gui/output/gtk_output.py b/w3af/core/ui/gui/output/gtk_output.py index 4c132dbe51..4859eb9d29 100644 --- a/w3af/core/ui/gui/output/gtk_output.py +++ b/w3af/core/ui/gui/output/gtk_output.py @@ -113,7 +113,7 @@ def _send_to_observers(self, m): for observer in observers.copy(): try: observer(m) - except Exception, e: + except Exception as e: msg = 'Observer function at "%s" failed with exception "%s".'\ ' Removing observer from list.' om.out.error(msg % (observer, e)) diff --git a/w3af/core/ui/gui/rrviews/rendering.py b/w3af/core/ui/gui/rrviews/rendering.py index 5936a9517e..dc83168d06 100644 --- a/w3af/core/ui/gui/rrviews/rendering.py +++ b/w3af/core/ui/gui/rrviews/rendering.py @@ -124,7 +124,7 @@ def show_object(self, obj): # I get here when the mime type is an image or something that I # can't display pass - except Exception, e: + except Exception as e: print _('gtkhtml2 exception:'), type(e), str(e) print _('Please report this issue here:') print 'https://github.com/andresriancho/w3af/issues/new' diff --git a/w3af/core/ui/gui/tools/fuzzy_requests.py b/w3af/core/ui/gui/tools/fuzzy_requests.py index af4956fce8..3922616885 100644 --- a/w3af/core/ui/gui/tools/fuzzy_requests.py +++ b/w3af/core/ui/gui/tools/fuzzy_requests.py @@ -412,12 +412,12 @@ def _real_send(self, fixContentLength, requestGenerator): fixContentLength) error_msg = None self.result_ok += 1 - except HTTPRequestException, e: + except HTTPRequestException as e: # One HTTP request failed error_msg = str(e) http_resp = None self.result_err += 1 - except ScanMustStopException, e: + except ScanMustStopException as e: # Many HTTP requests failed and the URL library wants to stop error_msg = str(e) self.result_err += 1 diff --git a/w3af/core/ui/gui/tools/helpers/fuzzygen.py b/w3af/core/ui/gui/tools/helpers/fuzzygen.py index fd3a663ee0..ed37a057d2 100644 --- a/w3af/core/ui/gui/tools/helpers/fuzzygen.py +++ b/w3af/core/ui/gui/tools/helpers/fuzzygen.py @@ -79,7 +79,7 @@ def _genIterator(self, text): namespace = {"string": __import__("string")} try: it = eval(text, namespace) - except Exception, e: + except Exception as e: msg = _("%s: %s (generated from %r)") % (e.__class__.__name__, e, text) raise FuzzyError(msg) diff --git a/w3af/core/ui/gui/tools/helpers/threaded_impact.py b/w3af/core/ui/gui/tools/helpers/threaded_impact.py index c393a9e6d9..3e08f4824e 100644 --- a/w3af/core/ui/gui/tools/helpers/threaded_impact.py +++ b/w3af/core/ui/gui/tools/helpers/threaded_impact.py @@ -42,7 +42,7 @@ def run(self): self.tlow, self.fixContentLength) self.ok = True - except Exception, e: + except Exception as e: self.exception = e finally: self.event.set() \ No newline at end of file diff --git a/w3af/plugins/attack/dav.py b/w3af/plugins/attack/dav.py index cd91636889..5d33148bd8 100644 --- a/w3af/plugins/attack/dav.py +++ b/w3af/plugins/attack/dav.py @@ -175,7 +175,7 @@ def end(self): try: self._uri_opener.DELETE(url_to_del) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error('DAVShell cleanup failed with exception: "%s".' % e) else: om.out.debug('DAVShell cleanup complete, %s deleted.' % url_to_del) diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py index 4f26e90d39..a42a497f7d 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py @@ -75,7 +75,7 @@ def action(): if conf.getPasswordHashes: try: conf.dumper.userSettings("database management system users password hashes", conf.dbmsHandler.getPasswordHashes(), "password hash", CONTENT_TYPE.PASSWORDS) - except SqlmapNoneDataException, ex: + except SqlmapNoneDataException as ex: logger.critical(ex) except: raise @@ -83,7 +83,7 @@ def action(): if conf.getPrivileges: try: conf.dumper.userSettings("database management system users privileges", conf.dbmsHandler.getPrivileges(), "privilege", CONTENT_TYPE.PRIVILEGES) - except SqlmapNoneDataException, ex: + except SqlmapNoneDataException as ex: logger.critical(ex) except: raise @@ -91,7 +91,7 @@ def action(): if conf.getRoles: try: conf.dumper.userSettings("database management system users roles", conf.dbmsHandler.getRoles(), "role", CONTENT_TYPE.ROLES) - except SqlmapNoneDataException, ex: + except SqlmapNoneDataException as ex: logger.critical(ex) except: raise diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py b/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py index 58e8bc4d57..ad00d38f54 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py @@ -1390,7 +1390,7 @@ def _(*args, **kwargs): try: logger.debug("checking for WAF/IPS/IDS product '%s'" % product) found = function(_) - except Exception, ex: + except Exception as ex: errMsg = "exception occurred while running " errMsg += "WAF script for '%s' ('%s')" % (product, getSafeExString(ex)) logger.critical(errMsg) @@ -1474,7 +1474,7 @@ def checkNullConnection(): infoMsg = "NULL connection is supported with 'skip-read' method" logger.info(infoMsg) - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: errMsg = getSafeExString(ex) raise SqlmapConnectionException(errMsg) @@ -1523,7 +1523,7 @@ def checkConnection(suppressOutput=False): else: kb.errorIsNone = True - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: if conf.ipv6: warnMsg = "check connection to a provided " warnMsg += "IPv6 address with a tool like ping6 " diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py b/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py index 50bad20bd1..74ab95e23b 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py @@ -672,7 +672,7 @@ def start(): except SqlmapSilentQuitException: raise - except SqlmapBaseException, ex: + except SqlmapBaseException as ex: errMsg = getSafeExString(ex) if conf.multipleTargets: diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py index e3c0b704b7..e27e44c6ae 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py @@ -87,7 +87,7 @@ def pop(self): except IOError, ex: errMsg = "exception occurred while retrieving data " errMsg += "from a temporary file ('%s')" % ex.message - raise SqlmapSystemException, errMsg + raise SqlmapSystemException as errMsg return self.chunks[-1].pop() @@ -112,7 +112,7 @@ def _dump(self, chunk): errMsg += "make sure that there is enough disk space left. If problem persists, " errMsg += "try to set environment variable 'TEMP' to a location " errMsg += "writeable by the current user" - raise SqlmapSystemException, errMsg + raise SqlmapSystemException as errMsg def _checkcache(self, index): if (self.cache and self.cache.index != index and self.cache.dirty): @@ -126,7 +126,7 @@ def _checkcache(self, index): except IOError, ex: errMsg = "exception occurred while retrieving data " errMsg += "from a temporary file ('%s')" % ex.message - raise SqlmapSystemException, errMsg + raise SqlmapSystemException as errMsg def __getstate__(self): return self.chunks, self.filenames diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/common.py b/w3af/plugins/attack/db/sqlmap/lib/core/common.py index 952625977f..dfac50b2ee 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/common.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/common.py @@ -1984,7 +1984,7 @@ def parseXmlFile(xmlFile, handler): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg def getSQLSnippet(dbms, sfile, **variables): """ @@ -2343,7 +2343,7 @@ def pushValue(value): getCurrentThreadData().valueStack.append(copy.deepcopy(value)) success = True break - except Exception, ex: + except Exception as ex: _ = ex if not success: @@ -3359,7 +3359,7 @@ def createGithubIssue(errMsg, excMsg): try: content = urllib2.urlopen(req).read() - except Exception, ex: + except Exception as ex: content = None issueUrl = re.search(r"https://github.com/sqlmapproject/sqlmap/issues/\d+", content or "") @@ -4082,7 +4082,7 @@ def evaluateCode(code, variables=None): exec(code, variables) except KeyboardInterrupt: raise - except Exception, ex: + except Exception as ex: errMsg = "an error occurred while evaluating provided code ('%s') " % getSafeExString(ex) raise SqlmapGenericException(errMsg) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/dump.py b/w3af/plugins/attack/db/sqlmap/lib/core/dump.py index 7c1325ca2c..63abae2cb4 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/dump.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/dump.py @@ -424,7 +424,7 @@ def dbTableValues(self, tableValues): if not os.path.isdir(dumpDbPath): try: os.makedirs(dumpDbPath, 0755) - except Exception, ex: + except Exception as ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapdb") except IOError, _: @@ -621,7 +621,7 @@ def dbTableValues(self, tableValues): with open(filepath, "wb") as f: _ = safechardecode(value, True) f.write(_) - except magic.MagicException, err: + except magic.MagicException as err: logger.debug(str(err)) if conf.dumpFormat == DUMP_FORMAT.CSV: diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/option.py b/w3af/plugins/attack/db/sqlmap/lib/core/option.py index 37e56f77a6..15c44c1f4a 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/option.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/option.py @@ -337,7 +337,7 @@ def _parseBurpLog(content): if not host: errMsg = "invalid format of a request file" - raise SqlmapSyntaxException, errMsg + raise SqlmapSyntaxException as errMsg if not url.startswith("http"): url = "%s://%s:%s%s" % (scheme or "http", host, port or "80", url) @@ -398,11 +398,11 @@ def __contains__(self, name): tree = ElementTree() try: tree.parse(paths.QUERIES_XML) - except Exception, ex: + except Exception as ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg for node in tree.findall("*"): queries[node.attrib['value']] = iterate(node) @@ -514,7 +514,7 @@ def _setCrawler(): if conf.verbose in (1, 2): status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets))) dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) - except Exception, ex: + except Exception as ex: errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, getSafeExString(ex)) logger.error(errMsg) @@ -650,7 +650,7 @@ def _findPageForms(): dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) except KeyboardInterrupt: break - except Exception, ex: + except Exception as ex: errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, getSafeExString(ex)) logger.error(errMsg) @@ -1125,9 +1125,9 @@ def _setHTTPHandlers(): try: _ = urlparse.urlsplit(conf.proxy) - except Exception, ex: + except Exception as ex: errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, getSafeExString(ex)) - raise SqlmapSyntaxException, errMsg + raise SqlmapSyntaxException as errMsg hostnamePort = _.netloc.split(":") @@ -1254,7 +1254,7 @@ def _setSafeVisit(): kb.safeReq.post = None else: errMsg = "invalid format of a safe request file" - raise SqlmapSyntaxException, errMsg + raise SqlmapSyntaxException as errMsg else: if not re.search(r"\Ahttp[s]*://", conf.safeUrl): if ":443/" in conf.safeUrl: @@ -1579,7 +1579,7 @@ def _createTemporaryDirectory(): except (OSError, IOError), ex: errMsg = "there has been a problem while accessing " errMsg += "temporary directory location(s) ('%s')" % getSafeExString(ex) - raise SqlmapSystemException, errMsg + raise SqlmapSystemException as errMsg else: try: if not os.path.isdir(tempfile.gettempdir()): @@ -1606,7 +1606,7 @@ def _createTemporaryDirectory(): except (OSError, IOError, WindowsError), ex: errMsg = "there has been a problem while setting " errMsg += "temporary directory location ('%s')" % getSafeExString(ex) - raise SqlmapSystemException, errMsg + raise SqlmapSystemException as errMsg def _cleanupOptions(): """ @@ -2451,14 +2451,14 @@ def _basicOptionValidation(): if conf.regexp: try: re.compile(conf.regexp) - except Exception, ex: + except Exception as ex: errMsg = "invalid regular expression '%s' ('%s')" % (conf.regexp, getSafeExString(ex)) raise SqlmapSyntaxException(errMsg) if conf.crawlExclude: try: re.compile(conf.crawlExclude) - except Exception, ex: + except Exception as ex: errMsg = "invalid regular expression '%s' ('%s')" % (conf.crawlExclude, getSafeExString(ex)) raise SqlmapSyntaxException(errMsg) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/replication.py b/w3af/plugins/attack/db/sqlmap/lib/core/replication.py index c44f6113d4..a12c8fe557 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/replication.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/replication.py @@ -63,7 +63,7 @@ def __init__(self, parent, name, columns=None, create=True, typeless=False): self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s" %s' % (unsafeSQLIdentificatorNaming(colname), coltype) for colname, coltype in self.columns))) else: self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s"' % unsafeSQLIdentificatorNaming(colname) for colname in self.columns))) - except Exception, ex: + except Exception as ex: errMsg = "problem occurred ('%s') while initializing the sqlite database " % getSafeExString(ex, UNICODE_ENCODING) errMsg += "located at '%s'" % self.parent.dbpath raise SqlmapGenericException(errMsg) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/testing.py b/w3af/plugins/attack/db/sqlmap/lib/core/testing.py index caf8168e35..fce1f219b7 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/testing.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/testing.py @@ -271,9 +271,9 @@ def runCase(parse): result = start() except KeyboardInterrupt: pass - except SqlmapBaseException, e: + except SqlmapBaseException as e: handled_exception = e - except Exception, e: + except Exception as e: unhandled_exception = e finally: sys.stdout.seek(0) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/threads.py b/w3af/plugins/attack/db/sqlmap/lib/core/threads.py index 89b1098bf9..6821b6ffed 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/threads.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/threads.py @@ -91,7 +91,7 @@ def exceptionHandledFunction(threadFunction, silent=False): kb.threadContinue = False kb.threadException = True raise - except Exception, ex: + except Exception as ex: if not silent: logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message)) @@ -147,7 +147,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio try: thread.start() - except Exception, ex: + except Exception as ex: errMsg = "error occurred while starting new thread ('%s')" % ex.message logger.critical(errMsg) break diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py index 55345a8498..fac0952e08 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py @@ -47,7 +47,7 @@ def adjust(self): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg if len(_.namelist()) == 0: errMsg = "no file(s) inside '%s'" % self.current raise SqlmapDataException(errMsg) @@ -73,7 +73,7 @@ def next(self): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg except StopIteration: self.adjust() retVal = self.iter.next().rstrip() diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py b/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py index 735eab6293..83053873f3 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py @@ -71,7 +71,7 @@ def configFileParser(configFile): try: config = UnicodeRawConfigParser() config.readfp(configFP) - except Exception, ex: + except Exception as ex: errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getSafeExString(ex) raise SqlmapSyntaxException(errMsg) diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py b/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py index b2629a9fd6..a06ce5f08a 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py @@ -74,11 +74,11 @@ def parseXmlNode(node): def loadBoundaries(): try: doc = et.parse(paths.BOUNDARIES_XML) - except Exception, ex: + except Exception as ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (paths.BOUNDARIES_XML, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg root = doc.getroot() parseXmlNode(root) @@ -89,11 +89,11 @@ def loadPayloads(): try: doc = et.parse(payloadFilePath) - except Exception, ex: + except Exception as ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (payloadFilePath, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException, errMsg + raise SqlmapInstallationException as errMsg root = doc.getroot() parseXmlNode(root) diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py b/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py index 1bb73c1c60..fb810a01ff 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py @@ -32,7 +32,7 @@ def parseSitemap(url, retVal=None): content = Request.getPage(url=url, raise404=True)[0] if not abortedFlag else "" except httplib.InvalidURL: errMsg = "invalid URL given for sitemap ('%s')" % url - raise SqlmapSyntaxException, errMsg + raise SqlmapSyntaxException as errMsg for match in re.finditer(r"\s*([^<]+)", content or ""): if abortedFlag: diff --git a/w3af/plugins/attack/db/sqlmap/lib/request/connect.py b/w3af/plugins/attack/db/sqlmap/lib/request/connect.py index adb4838b2f..b3dd425f61 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/request/connect.py +++ b/w3af/plugins/attack/db/sqlmap/lib/request/connect.py @@ -540,11 +540,11 @@ class _(dict): if hasattr(conn.fp, '_sock'): conn.fp._sock.close() conn.close() - except Exception, ex: + except Exception as ex: warnMsg = "problem occurred during connection closing ('%s')" % getSafeExString(ex) logger.warn(warnMsg) - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: if conf.proxyList and not kb.threadException: warnMsg = "unable to connect to the target URL ('%s')" % ex logger.critical(warnMsg) @@ -817,7 +817,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent for function in kb.tamperFunctions: try: payload = function(payload=payload, headers=auxHeaders) - except Exception, ex: + except Exception as ex: errMsg = "error occurred while running tamper " errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex)) raise SqlmapGenericException(errMsg) @@ -981,7 +981,7 @@ def _adjustParameter(paramString, parameter, newValue): if not conf.csrfUrl: errMsg += ". You can try to rerun by providing " errMsg += "a valid value for option '--csrf-url'" - raise SqlmapTokenException, errMsg + raise SqlmapTokenException as errMsg if token: token = token.strip("'\"") diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/api.py b/w3af/plugins/attack/db/sqlmap/lib/utils/api.py index ee96635c64..a00e651bf4 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/api.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/api.py @@ -754,7 +754,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non try: _client(addr) - except Exception, ex: + except Exception as ex: if not isinstance(ex, urllib2.HTTPError) or ex.code == httplib.UNAUTHORIZED: errMsg = "There has been a problem while connecting to the " errMsg += "REST-JSON API server at '%s' " % addr @@ -806,7 +806,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non try: argv = ["sqlmap.py"] + shlex.split(command)[1:] - except Exception, ex: + except Exception as ex: logger.error("Error occurred while parsing arguments ('%s')" % ex) taskid = None continue diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py b/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py index df3eca37b9..91feb8e150 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py @@ -63,7 +63,7 @@ def crawlThread(): try: if current: content = Request.getPage(url=current, crawling=True, raise404=False)[0] - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: errMsg = "connection exception detected ('%s'). skipping " % getSafeExString(ex) errMsg += "URL '%s'" % current logger.critical(errMsg) @@ -138,7 +138,7 @@ def crawlThread(): url = urlparse.urljoin(target, "/sitemap.xml") try: items = parseSitemap(url) - except SqlmapConnectionException, ex: + except SqlmapConnectionException as ex: if "page not found" in getSafeExString(ex): found = False logger.warn("'sitemap.xml' not found") diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py b/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py index 4c93509e2d..82a181e758 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py @@ -762,7 +762,7 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc except (UnicodeEncodeError, UnicodeDecodeError): pass # ignore possible encoding problems caused by some words in custom dictionaries - except Exception, e: + except Exception as e: warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e) warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS logger.critical(warnMsg) @@ -836,7 +836,7 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found except (UnicodeEncodeError, UnicodeDecodeError): pass # ignore possible encoding problems caused by some words in custom dictionaries - except Exception, e: + except Exception as e: warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e) warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS logger.critical(warnMsg) @@ -987,7 +987,7 @@ def dictionaryAttack(attack_dict): kb.wordlists = dictPaths - except Exception, ex: + except Exception as ex: warnMsg = "there was a problem while loading dictionaries" warnMsg += " ('%s')" % getSafeExString(ex) logger.critical(warnMsg) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py b/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py index 56606398da..1bcb15c63c 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py @@ -41,7 +41,7 @@ def _get_cursor(self): threadData.hashDBCursor = connection.cursor() threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)") connection.commit() - except Exception, ex: + except Exception as ex: errMsg = "error occurred while opening a session " errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex)) raise SqlmapConnectionException(errMsg) @@ -92,7 +92,7 @@ def retrieve(self, key, unserialize=False): except sqlite3.DatabaseError, ex: errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex)) errMsg += "If the problem persists please rerun with `--flush-session`" - raise SqlmapConnectionException, errMsg + raise SqlmapConnectionException as errMsg else: break diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py b/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py index bd711aa0f7..c38bd2e369 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py @@ -172,7 +172,7 @@ def _(column, pivotValue): warnMsg += "will display partial output" logger.warn(warnMsg) - except SqlmapConnectionException, e: + except SqlmapConnectionException as e: errMsg = "connection exception detected. sqlmap " errMsg += "will display partial output" errMsg += "'%s'" % e diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/search.py b/w3af/plugins/attack/db/sqlmap/lib/utils/search.py index 138197f180..dd9be26baa 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/search.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/search.py @@ -53,7 +53,7 @@ def _search(dork): try: req = urllib2.Request("https://www.google.com/ncr", headers=headers) conn = urllib2.urlopen(req) - except Exception, ex: + except Exception as ex: errMsg = "unable to connect to Google ('%s')" % getSafeExString(ex) raise SqlmapConnectionException(errMsg) @@ -90,7 +90,7 @@ def _search(dork): except urllib2.HTTPError, e: try: page = e.read() - except Exception, ex: + except Exception as ex: warnMsg = "problem occurred while trying to get " warnMsg += "an error page information (%s)" % getSafeExString(ex) logger.critical(warnMsg) @@ -171,7 +171,7 @@ def search(dork): try: return _search(dork) - except SqlmapBaseException, ex: + except SqlmapBaseException as ex: if conf.proxyList: logger.critical(getSafeExString(ex)) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py index 92581220ae..f4671da085 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py @@ -70,7 +70,7 @@ def sqlQuery(self, query): output = NULL - except SqlmapNoneDataException, ex: + except SqlmapNoneDataException as ex: logger.warn(ex) return output diff --git a/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py b/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py index c088fb0b3b..e700d3de05 100644 --- a/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py +++ b/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py @@ -1836,7 +1836,7 @@ def _convertFrom(self, proposed): u = self._toUnicode(markup, proposed) self.markup = u self.originalEncoding = proposed - except Exception, e: + except Exception as e: # print "That didn't work!" # print e return None diff --git a/w3af/plugins/attack/local_file_reader.py b/w3af/plugins/attack/local_file_reader.py index 54f2123660..697bd3d4fd 100644 --- a/w3af/plugins/attack/local_file_reader.py +++ b/w3af/plugins/attack/local_file_reader.py @@ -111,7 +111,7 @@ def _guess_with_diff(self, vuln_obj): try: response_a = self._uri_opener.send_mutant(orig_mutant) response_b = self._uri_opener.send_mutant(copy_mutant) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) return False else: @@ -138,7 +138,7 @@ def _strict_with_etc_passwd(self, vuln_obj): try: response_a = self._uri_opener.send_mutant(mutant) response_b = self._uri_opener.send_mutant(mutant) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.error(str(e)) return False @@ -231,7 +231,7 @@ def _init_read(self): try: #FIXME: This only works in Linux! response = self._read_with_b64('/etc/passwd') - except Exception, e: + except Exception as e: msg = 'Not using base64 wrapper for reading because of ' \ 'exception: "%s"' om.out.debug(msg % e) @@ -259,7 +259,7 @@ def read(self, filename): if self._use_base64_wrapper: try: return self._read_with_b64(filename) - except Exception, e: + except Exception as e: om.out.debug('read_with_b64 failed: "%s"' % e) return self._read_basic(filename) @@ -292,7 +292,7 @@ def _read_utils(self, filename): try: response = self._uri_opener.send_mutant(mutant) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'Error "%s" while sending request to remote host. Try again.' return msg % e diff --git a/w3af/plugins/attack/os_commanding.py b/w3af/plugins/attack/os_commanding.py index 7c11bd8014..621ad1c3cc 100644 --- a/w3af/plugins/attack/os_commanding.py +++ b/w3af/plugins/attack/os_commanding.py @@ -320,7 +320,7 @@ def execute(self, command): try: http_response = self.strategy.send(strategy_cmd, self.get_url_opener()) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('Error "%s" while sending HTTP request with OS command to' ' remote host. Please try again.') return msg % e diff --git a/w3af/plugins/attack/payloads/payloads/php_sca.py b/w3af/plugins/attack/payloads/payloads/php_sca.py index 09daf0a0ce..475c674df9 100644 --- a/w3af/plugins/attack/payloads/payloads/php_sca.py +++ b/w3af/plugins/attack/payloads/payloads/php_sca.py @@ -98,7 +98,7 @@ def write_vuln_to_kb(vulnty, url, funcs): try: sca = PhpSCA(file=file[1]) vulns = sca.get_vulns() - except Exception, e: + except Exception as e: msg = 'The PHP SCA failed with an unhandled exception: "%s".' om.out.console(msg % e) return {} diff --git a/w3af/plugins/attack/rfi.py b/w3af/plugins/attack/rfi.py index 56eeafd468..b264115598 100644 --- a/w3af/plugins/attack/rfi.py +++ b/w3af/plugins/attack/rfi.py @@ -397,7 +397,7 @@ def is_open_port(self, host, port): http_response = self._uri_opener.send_mutant(mutant) except BaseFrameworkException, w3: return 'Exception from the remote web application: "%s"' % w3 - except Exception, e: + except Exception as e: return 'Unhandled exception, "%s"' % e else: if 'HTTP request failed!' in http_response.get_body(): @@ -482,7 +482,7 @@ def execute(self, command): http_res = self._uri_opener.send_mutant(mutant) except BaseFrameworkException, w3: return 'Exception from the remote web application: "%s"' % w3 - except Exception, e: + except Exception as e: return 'Unhandled exception from the remote web application: "%s"' % e else: return shell_handler.extract_result(http_res.get_body()) @@ -494,7 +494,7 @@ def end(self): om.out.debug('Remote file inclusion shell is cleaning up.') try: self._rm_file(self._exploit_mutant.get_token_value()) - except Exception, e: + except Exception as e: msg = 'Remote file inclusion shell cleanup failed with exception: %s' om.out.error(msg % e) else: diff --git a/w3af/plugins/attack/xpath.py b/w3af/plugins/attack/xpath.py index 5070b39747..7a3b71a6a4 100644 --- a/w3af/plugins/attack/xpath.py +++ b/w3af/plugins/attack/xpath.py @@ -142,7 +142,7 @@ def _verify_vuln(self, vuln): try: false_resp = self._uri_opener.send_mutant(mutant_false) true_resp = self._uri_opener.send_mutant(mutant_true) - except BaseFrameworkException, e: + except BaseFrameworkException as e: return 'Error "%s".' % e else: if (is_error_resp(false_resp.get_body()) @@ -177,7 +177,7 @@ def _get_delimiter(self, vuln, is_error_resp): try: true_resp = self._uri_opener.send_mutant(mutant_true) false_resp = self._uri_opener.send_mutant(mutant_false) - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.debug('Error "%s"' % e) else: if (is_error_resp(false_resp.get_body()) @@ -210,7 +210,7 @@ def _configure_is_error_function(self, vuln, count): diff_ratio += difflib.SequenceMatcher(None, base_res.get_body(), req_x.get_body()).ratio() - except BaseFrameworkException, e: + except BaseFrameworkException as e: om.out.debug('Error "%s"' % e) except RuntimeError, rte: issue = 'https://github.com/andresriancho/w3af/issues/5278' @@ -314,13 +314,13 @@ def getxml(self): """ try: data_len = self._get_data_len() - except BaseFrameworkException, e: + except BaseFrameworkException as e: return 'Error found during data length extraction: "%s"' % e if data_len is not None: try: data = self.get_data(data_len) - except BaseFrameworkException, e: + except BaseFrameworkException as e: return 'Error found during data extraction: "%s"' % e else: return data diff --git a/w3af/plugins/audit/deserialization/java/generator.py b/w3af/plugins/audit/deserialization/java/generator.py index ad2da56e80..18359d500a 100644 --- a/w3af/plugins/audit/deserialization/java/generator.py +++ b/w3af/plugins/audit/deserialization/java/generator.py @@ -90,7 +90,7 @@ def main(payloads): try: p1, o1 = get_payload_bin_for_command_len(payload, 1) p2, o2 = get_payload_bin_for_command_len(payload, 2) - except Exception, e: + except Exception as e: args = (payload, e) msg = 'Failed to create %s.json, exception: "%s"' print(msg % args) diff --git a/w3af/plugins/auth/detailed.py b/w3af/plugins/auth/detailed.py index 57f5ffb9a7..6175687bba 100644 --- a/w3af/plugins/auth/detailed.py +++ b/w3af/plugins/auth/detailed.py @@ -60,7 +60,7 @@ def login(self): """ try: return self.do_user_login() - except BaseFrameworkException, e: + except BaseFrameworkException as e: if self._login_error: om.out.error(str(e)) self._login_error = False diff --git a/w3af/plugins/auth/generic.py b/w3af/plugins/auth/generic.py index ec054a5af1..52af56fbbb 100644 --- a/w3af/plugins/auth/generic.py +++ b/w3af/plugins/auth/generic.py @@ -50,7 +50,7 @@ def login(self): """ try: return self.do_user_login() - except BaseFrameworkException, e: + except BaseFrameworkException as e: if self._login_error: om.out.error(str(e)) self._login_error = False diff --git a/w3af/plugins/crawl/dot_ds_store.py b/w3af/plugins/crawl/dot_ds_store.py index c8e6ded87d..96b9c1cdc9 100644 --- a/w3af/plugins/crawl/dot_ds_store.py +++ b/w3af/plugins/crawl/dot_ds_store.py @@ -93,7 +93,7 @@ def _check_and_analyze(self, domain_path): try: store = DsStore(response.get_raw_body()) entries = store.get_file_entries() - except Exception, e: + except Exception as e: om.out.debug('Unexpected error while parsing DS_Store file: "%s"' % e) return diff --git a/w3af/plugins/crawl/dwsync_xml.py b/w3af/plugins/crawl/dwsync_xml.py index 219fee2933..231b8ca4e1 100644 --- a/w3af/plugins/crawl/dwsync_xml.py +++ b/w3af/plugins/crawl/dwsync_xml.py @@ -77,7 +77,7 @@ def _find_dwsync(self, domain_path): try: dom = xml.dom.minidom.parseString(response.get_body()) - except Exception, e: + except Exception as e: msg = 'Exception while parsing dwsync.xml file at %s : "%s"' om.out.debug(msg % (dwsync_url, e)) return @@ -92,7 +92,7 @@ def _find_dwsync(self, domain_path): except ValueError, ve: msg = 'dwsync file had an invalid URL: "%s"' om.out.debug(msg % ve) - except Exception, e: + except Exception as e: msg = 'Sitemap file had an invalid format: "%s"' om.out.debug(msg % e) diff --git a/w3af/plugins/crawl/find_dvcs.py b/w3af/plugins/crawl/find_dvcs.py index e51337e876..d36323c7bb 100644 --- a/w3af/plugins/crawl/find_dvcs.py +++ b/w3af/plugins/crawl/find_dvcs.py @@ -158,7 +158,7 @@ def _send_and_check(self, repo_url, repo_get_files, repo, domain_path): try: filenames = repo_get_files(http_response.get_raw_body()) - except Exception, e: + except Exception as e: # We get here when the HTTP response is NOT a 404, but the response # body couldn't be properly parsed. This is usually because of a false # positive in the is_404 function, OR a new version-format of the file @@ -371,7 +371,7 @@ def svn_wc_db(self, body): for path, svn_path in query_result: filenames.add(path) filenames.add(svn_path) - except Exception, e: + except Exception as e: msg = 'Failed to extract filenames from wc.db file. The exception was: "%s"' args = (e,) om.out.debug(msg % args) diff --git a/w3af/plugins/crawl/ghdb.py b/w3af/plugins/crawl/ghdb.py index 196d20ec0a..e3bc99c75f 100644 --- a/w3af/plugins/crawl/ghdb.py +++ b/w3af/plugins/crawl/ghdb.py @@ -127,13 +127,13 @@ def _read_ghdb(self): """ try: ghdb_fd = file(self._ghdb_file) - except Exception, e: + except Exception as e: msg = 'Failed to open ghdb file: "%s", error: "%s".' raise BaseFrameworkException(msg % (self._ghdb_file, e)) try: dom = xml.dom.minidom.parseString(ghdb_fd.read()) - except Exception, e: + except Exception as e: msg = 'Failed to parse XML file: "%s", error: "%s".' raise BaseFrameworkException(msg % (self._ghdb_file, e)) @@ -149,7 +149,7 @@ def _read_ghdb(self): try: query_string = signature.childNodes[4].childNodes[0].data - except Exception, e: + except Exception as e: msg = 'There is a corrupt signature in the GHDB. No query '\ ' string was found in the following XML code: "%s".' om.out.debug(msg % signature.toxml()) diff --git a/w3af/plugins/crawl/import_results.py b/w3af/plugins/crawl/import_results.py index 71b0e680aa..c3fddb0f49 100644 --- a/w3af/plugins/crawl/import_results.py +++ b/w3af/plugins/crawl/import_results.py @@ -74,7 +74,7 @@ def _load_data_from_base64(self): try: file_handler = file(self._input_base64, 'rb') - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'An error was found while trying to read "%s": "%s".' om.out.error(msg % (self._input_base64, e)) return @@ -109,7 +109,7 @@ def _load_data_from_burp(self): try: fuzzable_request_list = self._objs_from_burp_log(self._input_burp) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('An error was found while trying to read the Burp log' ' file (%s): "%s".') om.out.error(msg % (self._input_burp, e)) diff --git a/w3af/plugins/crawl/phishtank.py b/w3af/plugins/crawl/phishtank.py index 2d8182ef33..482e2159a2 100644 --- a/w3af/plugins/crawl/phishtank.py +++ b/w3af/plugins/crawl/phishtank.py @@ -116,7 +116,7 @@ def _is_in_phishtank(self, to_check): """ try: phishtank_db_fd = file(self.PHISHTANK_DB, 'r') - except Exception, e: + except Exception as e: msg = 'Failed to open phishtank database: "%s", exception: "%s".' raise BaseFrameworkException(msg % (self.PHISHTANK_DB, e)) diff --git a/w3af/plugins/crawl/phishtank/update.py b/w3af/plugins/crawl/phishtank/update.py index a935878567..88a1d5c172 100755 --- a/w3af/plugins/crawl/phishtank/update.py +++ b/w3af/plugins/crawl/phishtank/update.py @@ -133,13 +133,13 @@ def convert_xml_to_csv(): # # phishtank_db_fd = file(XML_DB_FILE, 'r') - except Exception, e: + except Exception as e: msg = 'Failed to open XML phishtank database: "%s", exception: "%s".' sys.exit(msg % (XML_DB_FILE, e)) try: output_csv_file = file(CSV_DB_FILE, 'w') - except Exception, e: + except Exception as e: msg = 'Failed to open CSV phishtank database: "%s", exception: "%s".' sys.exit(msg % (CSV_DB_FILE, e)) @@ -150,7 +150,7 @@ def convert_xml_to_csv(): try: etree.parse(phishtank_db_fd, parser) - except Exception, e: + except Exception as e: msg = 'XML parsing error in phishtank DB, exception: "%s".' sys.exit(msg % e) diff --git a/w3af/plugins/crawl/pykto.py b/w3af/plugins/crawl/pykto.py index 3be647a0d0..6f18bf8b80 100644 --- a/w3af/plugins/crawl/pykto.py +++ b/w3af/plugins/crawl/pykto.py @@ -149,7 +149,7 @@ def _send_and_check(self, nikto_test): try: http_response = function_ptr(nikto_test.uri) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('An exception was raised while requesting "%s", the error' ' message is: "%s".') om.out.error(msg % (nikto_test.uri, e)) @@ -345,7 +345,7 @@ def test_generator(self): """ try: db_file = codecs.open(self.filename, "r", "utf-8" ) - except Exception, e: + except Exception as e: msg = 'Failed to open the scan database. Exception: "%s".' om.out.error(msg % e) raise StopIteration diff --git a/w3af/plugins/crawl/spider_man.py b/w3af/plugins/crawl/spider_man.py index 4cc9ddfb78..179a05c024 100644 --- a/w3af/plugins/crawl/spider_man.py +++ b/w3af/plugins/crawl/spider_man.py @@ -191,7 +191,7 @@ def handle_request_in_thread(self, flow): # Send the request to the remote webserver http_response = self._send_http_request(http_request, grep=grep) - except Exception, e: + except Exception as e: trace = str(traceback.format_exc()) http_response = self._create_error_response(http_request, None, e, trace=trace) diff --git a/w3af/plugins/crawl/url_fuzzer.py b/w3af/plugins/crawl/url_fuzzer.py index ab16447cbd..2566bed646 100644 --- a/w3af/plugins/crawl/url_fuzzer.py +++ b/w3af/plugins/crawl/url_fuzzer.py @@ -147,7 +147,7 @@ def _return_without_eval(self, uri): try: response = self._uri_opener.GET(uri, cache=True, headers=self._headers) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'An exception was raised while requesting "%s", the error' msg += 'message is: "%s"' om.out.error(msg % (uri, e)) diff --git a/w3af/plugins/crawl/wordpress_fingerprint.py b/w3af/plugins/crawl/wordpress_fingerprint.py index a09dd71b29..944ec038d4 100644 --- a/w3af/plugins/crawl/wordpress_fingerprint.py +++ b/w3af/plugins/crawl/wordpress_fingerprint.py @@ -241,7 +241,7 @@ def _get_wp_fingerprints(self): try: wordpress_fp_fd = codecs.open(self.WP_VERSIONS_XML, 'r', 'utf-8', errors='ignore') - except Exception, e: + except Exception as e: msg = 'Failed to open wordpress fingerprint database file:'\ ' "%s", exception: "%s".' raise BaseFrameworkException(msg % (self.WP_VERSIONS_XML, e)) @@ -253,7 +253,7 @@ def _get_wp_fingerprints(self): try: parser.parse(wordpress_fp_fd) - except Exception, e: + except Exception as e: msg = 'XML parsing error in wordpress version DB, exception: "%s".' raise BaseFrameworkException(msg % e) diff --git a/w3af/plugins/grep/clamav.py b/w3af/plugins/grep/clamav.py index f9df088397..e5238be9c4 100644 --- a/w3af/plugins/grep/clamav.py +++ b/w3af/plugins/grep/clamav.py @@ -145,7 +145,7 @@ def _scan_http_response(self, request, response): try: cd = self._get_connection() result_dict = cd.scan_stream(body) - except Exception, e: + except Exception as e: msg = ('The ClamAV plugin failed to connect to clamd using' ' the provided unix socket: "%s". Please verify your' ' configuration and try again. The exception was: "%s".') diff --git a/w3af/plugins/grep/retirejs.py b/w3af/plugins/grep/retirejs.py index 990a8f2cfa..c2723fca17 100644 --- a/w3af/plugins/grep/retirejs.py +++ b/w3af/plugins/grep/retirejs.py @@ -165,7 +165,7 @@ def _download_retire_db(self): http_response = self._uri_opener.GET(self.RETIRE_DB_URL, binary_response=True, respect_size_limit=False) - except Exception, e: + except Exception as e: msg = 'Failed to download the retirejs database: "%s"' om.out.error(msg % e) return @@ -320,7 +320,7 @@ def _run_retire_on_batch(self, batch): if process.returncode != 0: try: json_doc = json.loads(file(json_file.name).read()) - except Exception, e: + except Exception as e: msg = 'Failed to parse retirejs output. Exception: "%s"' om.out.debug(msg % e) diff --git a/w3af/plugins/infrastructure/favicon_identification.py b/w3af/plugins/infrastructure/favicon_identification.py index a4f0f59a3d..b6377d2a88 100644 --- a/w3af/plugins/infrastructure/favicon_identification.py +++ b/w3af/plugins/infrastructure/favicon_identification.py @@ -107,7 +107,7 @@ def _read_favicon_db(self): try: # read MD5 database. db_file = open(self._db_file, "r") - except Exception, e: + except Exception as e: msg = 'Failed to open the MD5 database at %s. Exception: "%s".' om.out.error(msg % (self._db_file, e)) else: diff --git a/w3af/plugins/infrastructure/finger_google.py b/w3af/plugins/infrastructure/finger_google.py index 57423fd3d0..80a756f327 100644 --- a/w3af/plugins/infrastructure/finger_google.py +++ b/w3af/plugins/infrastructure/finger_google.py @@ -116,7 +116,7 @@ def _find_accounts(self, googlePage): grep_res = True if (gpuri.get_domain() == self._domain) else False response = self._uri_opener.GET(gpuri, cache=True, grep=grep_res) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'ExtendedUrllib exception raised while fetching page in' \ ' finger_google, error description: "%s"' om.out.debug(msg % e) diff --git a/w3af/plugins/infrastructure/hmap.py b/w3af/plugins/infrastructure/hmap.py index 92aa006db9..d93902a682 100644 --- a/w3af/plugins/infrastructure/hmap.py +++ b/w3af/plugins/infrastructure/hmap.py @@ -70,7 +70,7 @@ def discover(self, fuzzable_request): msg = 'A BaseFrameworkException occurred while running hmap: "%s"' om.out.error(msg % w3) return - except Exception, e: + except Exception as e: msg = 'An unhandled exception occurred while running hmap: "%s"' om.out.error(msg % e) return diff --git a/w3af/plugins/infrastructure/http_vs_https_dist.py b/w3af/plugins/infrastructure/http_vs_https_dist.py index 0374836788..e8e24d1ae3 100644 --- a/w3af/plugins/infrastructure/http_vs_https_dist.py +++ b/w3af/plugins/infrastructure/http_vs_https_dist.py @@ -101,7 +101,7 @@ def set_info(name, desc): http_troute = traceroute(domain, dport=http_port)[0].get_trace() # pylint: enable=E1124,E1136 - except Exception, e: + except Exception as e: # I've seen numerous bug reports with the following exception: # "error: illegal IP address string passed to inet_aton" # that come from this part of the code. It seems that in some cases diff --git a/w3af/plugins/infrastructure/oHmap/hmap.py b/w3af/plugins/infrastructure/oHmap/hmap.py index a838a97b1d..4cc28ea239 100644 --- a/w3af/plugins/infrastructure/oHmap/hmap.py +++ b/w3af/plugins/infrastructure/oHmap/hmap.py @@ -72,7 +72,7 @@ def get_connection(self): else: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) - except Exception, e: + except Exception as e: msg = 'hmap connection failed to %s:%s. Exception: "%s"' args = (HOST, PORT, e) raise BaseFrameworkException(msg % args) @@ -81,7 +81,7 @@ def get_connection(self): if useSSL: try: s2 = ssl.wrap_socket(s) - except Exception, e: + except Exception as e: msg = 'hmap SSL connection failed to %s:%s. Exception: "%s"' args = (HOST, PORT, e) raise BaseFrameworkException(msg % args) @@ -105,7 +105,7 @@ def submit(self): # Send the "HTTP request" to the socket try: s.send(str(self)) - except Exception, e: + except Exception as e: om.out.debug('hmap failed to send data to socket: "%s"' % e) # Try again @@ -153,7 +153,7 @@ def submit(self): continue - except Exception, e: + except Exception as e: msg = 'hmap found an exception while reading data from socket: "%s"' om.out.debug(msg % e) @@ -977,7 +977,7 @@ def testServer(ssl, server, port, matchCount, generateFP, threads): try: ### FIXME: This eval is awful, I should change it to pickle. ks = eval(ksf.read()) - except Exception, e: + except Exception as e: raise BaseFrameworkException( 'The signature file "' + f + '" has an invalid syntax.') else: @@ -989,7 +989,7 @@ def testServer(ssl, server, port, matchCount, generateFP, threads): for i in xrange(10): try: fd = open('hmap-fingerprint-' + server + '-' + str(i), 'w') - except Exception, e: + except Exception as e: raise BaseFrameworkException( 'Cannot open fingerprint file. Error:' + str(e)) else: diff --git a/w3af/plugins/infrastructure/xssed_dot_com.py b/w3af/plugins/infrastructure/xssed_dot_com.py index 4cd117683b..4a969c3e39 100644 --- a/w3af/plugins/infrastructure/xssed_dot_com.py +++ b/w3af/plugins/infrastructure/xssed_dot_com.py @@ -63,7 +63,7 @@ def discover(self, fuzzable_request): try: response = self._uri_opener.GET(check_url) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('An exception was raised while running xssed_dot_com' ' plugin. Exception: "%s".') om.out.debug(msg % e) @@ -83,7 +83,7 @@ def _parse_xssed_search_result(self, response): try: xss_report_response = self._uri_opener.GET(mirror_url) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = ('An exception was raised while running xssed_dot_com' ' plugin. Exception: "%s".') om.out.debug(msg % e) diff --git a/w3af/plugins/infrastructure/zone_h.py b/w3af/plugins/infrastructure/zone_h.py index 4b6ff3ef06..0f5f478fc5 100644 --- a/w3af/plugins/infrastructure/zone_h.py +++ b/w3af/plugins/infrastructure/zone_h.py @@ -61,7 +61,7 @@ def discover(self, fuzzable_request): try: response = self._uri_opener.GET(zone_h_url) - except BaseFrameworkException, e: + except BaseFrameworkException as e: msg = 'An exception was raised while running zone-h plugin.' msg += ' Exception: "%s"' % e om.out.debug(msg) diff --git a/w3af/plugins/output/csv_file.py b/w3af/plugins/output/csv_file.py index 68b6bfac8d..fb99f4789b 100644 --- a/w3af/plugins/output/csv_file.py +++ b/w3af/plugins/output/csv_file.py @@ -71,7 +71,7 @@ def flush(self): delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) - except Exception, e: + except Exception as e: msg = ('An exception was raised while trying to open the ' ' CSV writer. Exception: "%s"') om.out.error(msg % e) @@ -89,7 +89,7 @@ def flush(self): info.get_id(), info.get_desc()] csv_writer.writerow(row) - except Exception, e: + except Exception as e: msg = ('An exception was raised while trying to write the ' ' vulnerabilities to the output file. Exception: "%s"') om.out.error(msg % e) diff --git a/w3af/plugins/output/email_report.py b/w3af/plugins/output/email_report.py index b0218fa9bf..05cb9c9e06 100644 --- a/w3af/plugins/output/email_report.py +++ b/w3af/plugins/output/email_report.py @@ -107,7 +107,7 @@ def end(self): server = smtplib.SMTP(self.smtpServer, self.smtpPort) server.sendmail(self.fromAddr, self.toAddrs, msg.as_string()) server.quit() - except Exception, e: + except Exception as e: msg = 'The SMTP settings in email_report plugin seem to be'\ ' incorrect. Original error: "%s".' om.out.error(msg % e) diff --git a/w3af/plugins/output/export_requests.py b/w3af/plugins/output/export_requests.py index 602f4af638..7c69eb5e98 100644 --- a/w3af/plugins/output/export_requests.py +++ b/w3af/plugins/output/export_requests.py @@ -69,7 +69,7 @@ def flush(self): for fr in fuzzable_request_set: out_file.write(fr.to_base64() + '\n') - except Exception, e: + except Exception as e: msg = ('An exception was raised while trying to export fuzzable' ' requests to the output file: "%s".' % e) om.out.error(msg) diff --git a/w3af/plugins/output/json_file.py b/w3af/plugins/output/json_file.py index 537bcf07af..d9157681e6 100644 --- a/w3af/plugins/output/json_file.py +++ b/w3af/plugins/output/json_file.py @@ -125,7 +125,7 @@ def _get_desc(x): "VulnDB ID": info.get_vulndb_id(), "Description": info.get_desc()} items.append(item) - except Exception, e: + except Exception as e: msg = ('An exception was raised while trying to write the ' ' vulnerabilities to the output file. Exception: "%s"') om.out.error(msg % e) diff --git a/w3af/plugins/output/text_file.py b/w3af/plugins/output/text_file.py index feab6801e6..7f630d2e90 100644 --- a/w3af/plugins/output/text_file.py +++ b/w3af/plugins/output/text_file.py @@ -79,7 +79,7 @@ def _init(self): msg = 'Can\'t open report file "%s" for writing, error: %s.' args = (os.path.abspath(self._output_file_name), io.strerror) raise BaseFrameworkException(msg % args) - except Exception, e: + except Exception as e: msg = 'Can\'t open report file "%s" for writing, error: %s.' args = (os.path.abspath(self._output_file_name), e) raise BaseFrameworkException(msg % args) @@ -92,7 +92,7 @@ def _init(self): msg = 'Can\'t open HTTP report file "%s" for writing, error: %s.' args = (os.path.abspath(self._http_file_name), io.strerror) raise BaseFrameworkException(msg % args) - except Exception, e: + except Exception as e: msg = 'Can\'t open HTTP report file "%s" for writing, error: %s.' args = (os.path.abspath(self._http_file_name), e) raise BaseFrameworkException(msg % args) @@ -108,7 +108,7 @@ def _write_to_file(self, msg, flush=False): try: self._file.write(msg) - except Exception, e: + except Exception as e: self._file = None msg = ('An exception was raised while trying to write to the output' ' file "%s", error: "%s". Disabling output to this file.') @@ -130,7 +130,7 @@ def _write_to_HTTP_log(self, msg): try: self._http.write(msg) - except Exception, e: + except Exception as e: self._http = None msg = ('An exception was raised while trying to write to the output' ' file "%s", error: "%s". Disabling output to this file.') diff --git a/w3af/plugins/output/xml_file.py b/w3af/plugins/output/xml_file.py index 342a469004..8650255f48 100644 --- a/w3af/plugins/output/xml_file.py +++ b/w3af/plugins/output/xml_file.py @@ -769,7 +769,7 @@ def to_string(self): for transaction in info.get_id(): try: xml = HTTPTransaction(self._jinja2_env, transaction).to_string() - except DBException, e: + except DBException as e: msg = 'Failed to retrieve request with id %s from DB: "%s"' om.out.error(msg % (transaction, e)) continue diff --git a/w3af/plugins/tests/audit/test_deserialization.py b/w3af/plugins/tests/audit/test_deserialization.py index ee33aff858..fdeee457c4 100644 --- a/w3af/plugins/tests/audit/test_deserialization.py +++ b/w3af/plugins/tests/audit/test_deserialization.py @@ -54,13 +54,13 @@ def get_response(self, http_request, uri, response_headers): try: message = base64.b64decode(b64message) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body try: cPickle.loads(message) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body @@ -94,7 +94,7 @@ def get_response(self, http_request, uri, response_headers): try: cPickle.loads(message) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body @@ -128,13 +128,13 @@ def get_response(self, http_request, uri, response_headers): try: message = base64.b64decode(b64message) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body try: cPickle.loads(message) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body @@ -339,7 +339,7 @@ def test_get_payload_all(self): try: payload_1 = ed.get_string_for_delay(1) payload_22 = ed.get_string_for_delay(22) - except Exception, e: + except Exception as e: msg = 'Raised exception "%s" on "%s"' args = (e, file_name) self.assertTrue(False, msg % args) diff --git a/w3af/plugins/tests/audit/test_xxe.py b/w3af/plugins/tests/audit/test_xxe.py index 35281c5e39..bbf6cf866c 100644 --- a/w3af/plugins/tests/audit/test_xxe.py +++ b/w3af/plugins/tests/audit/test_xxe.py @@ -49,7 +49,7 @@ def get_response(self, http_request, uri, response_headers): try: root = etree.fromstring(str(xml), parser=parser) body = etree.tostring(root) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body @@ -99,7 +99,7 @@ def get_response(self, http_request, uri, response_headers): try: sax.parseString(xml, handler) - except Exception, e: + except Exception as e: body = str(e) else: body = handler.chars @@ -145,7 +145,7 @@ def get_response(self, http_request, uri, response_headers): try: root = etree.fromstring(str(xml), parser=parser) body = etree.tostring(root) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body @@ -185,7 +185,7 @@ def get_response(self, http_request, uri, response_headers): try: root = etree.fromstring(str(xml), parser=parser) body = etree.tostring(root) - except Exception, e: + except Exception as e: body = 'Generic error here' return self.status, response_headers, body @@ -225,7 +225,7 @@ def get_response(self, http_request, uri, response_headers): try: root = etree.fromstring(str(xml), parser=parser) - except Exception, e: + except Exception as e: body = str(e) return self.status, response_headers, body diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html index 2859cbb6fb..67416235dc 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html @@ -391,7 +391,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException as emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite

@@ -571,4 +571,4 @@

PHP License


- + diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html index 21913dbe09..dd64f098c9 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html @@ -470,7 +470,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException as emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

standard

diff --git a/w3af/plugins/tests/crawl/test_spider_man.py b/w3af/plugins/tests/crawl/test_spider_man.py index 9177b3b192..8abb2192f3 100644 --- a/w3af/plugins/tests/crawl/test_spider_man.py +++ b/w3af/plugins/tests/crawl/test_spider_man.py @@ -75,7 +75,7 @@ def run(self): req = urllib2.Request(url, payload) try: response = opener.open(req) - except Exception, ex: + except Exception as ex: self.responses.append(str(ex)) else: self.responses.append(response.read()) @@ -87,14 +87,14 @@ def run(self): try: response = opener.open(full_url) - except Exception, ex: + except Exception as ex: self.responses.append(str(ex)) else: self.responses.append(response.read()) try: response = opener.open(TERMINATE_URL.url_string) - except Exception, ex: + except Exception as ex: self.responses.append(str(ex)) else: self.responses.append(response.read()) diff --git a/w3af/plugins/tests/helper.py b/w3af/plugins/tests/helper.py index 7b3c0ca970..e250407d79 100644 --- a/w3af/plugins/tests/helper.py +++ b/w3af/plugins/tests/helper.py @@ -237,7 +237,7 @@ def _verify_targets_up(self, target_list): self.assertTrue(False, msg % (target, e.reason)) - except Exception, e: + except Exception as e: self.assertTrue(False, msg % (target, e)) def _scan(self, target, plugins, debug=False, assert_exceptions=True, diff --git a/w3af/plugins/tests/output/test_xml_file.py b/w3af/plugins/tests/output/test_xml_file.py index 1678a4dcb8..1f379c18f1 100644 --- a/w3af/plugins/tests/output/test_xml_file.py +++ b/w3af/plugins/tests/output/test_xml_file.py @@ -316,7 +316,7 @@ def test_binary_handling_in_xml(self): try: tree = ElementTree.parse(self.FILENAME) tree.getroot() - except Exception, e: + except Exception as e: self.assertTrue(False, 'Generated invalid XML: "%s"' % e) def tearDown(self): @@ -368,7 +368,7 @@ def test_binary_0x0b_handling_in_xml(self): try: tree = ElementTree.parse(self.FILENAME) tree.getroot() - except Exception, e: + except Exception as e: self.assertTrue(False, 'Generated invalid XML: "%s"' % e) def tearDown(self): @@ -417,7 +417,7 @@ def test_special_character_in_url_handling(self): try: tree = ElementTree.parse(self.FILENAME) tree.getroot() - except Exception, e: + except Exception as e: self.assertTrue(False, 'Generated invalid XML: "%s"' % e) def tearDown(self): diff --git a/w3af/tests/waitfor-test-dependencies.py b/w3af/tests/waitfor-test-dependencies.py index 8b1b44ff1e..8ad15f6f5b 100755 --- a/w3af/tests/waitfor-test-dependencies.py +++ b/w3af/tests/waitfor-test-dependencies.py @@ -28,7 +28,7 @@ def is_online(url, match_string): content = urllib2.urlopen(url).read() except urllib2.HTTPError, e: content = e.read() - except Exception, e: + except Exception as e: print('%s is offline (%s)' % (url, e.__class__.__name__)) return False From 772ff240af15b61e94d2732938735703abbea808 Mon Sep 17 00:00:00 2001 From: "Mohammad Parishan ./" Date: Mon, 31 Dec 2018 02:22:23 -0800 Subject: [PATCH 05/46] Fix another Exceptions Syntax ./ --- w3af/core/data/db/history.py | 2 +- w3af/core/data/url/tests/test_xurllib.py | 4 ++-- w3af/core/data/url/tests/test_xurllib_timeout.py | 4 ++-- w3af/core/ui/api/resources/scans.py | 4 ++-- w3af/core/ui/console/exploit.py | 2 +- w3af/core/ui/console/io/console.py | 2 +- w3af/core/ui/console/profiles.py | 4 ++-- w3af/core/ui/console/rootMenu.py | 4 ++-- w3af/core/ui/gui/export_request.py | 2 +- w3af/core/ui/gui/httpLogTab.py | 4 ++-- w3af/core/ui/gui/profiles.py | 4 ++-- w3af/core/ui/gui/tools/proxywin.py | 4 ++-- .../attack/db/sqlmap/extra/sqlharvest/sqlharvest.py | 4 ++-- .../attack/db/sqlmap/plugins/dbms/hsqldb/connector.py | 8 ++++---- .../plugins/attack/db/sqlmap/plugins/generic/connector.py | 2 +- w3af/plugins/attack/payloads/payloads/metasploit.py | 2 +- w3af/plugins/attack/payloads/payloads/w3af_agent.py | 2 +- w3af/plugins/bruteforce/basic_auth.py | 2 +- w3af/plugins/bruteforce/form_auth.py | 2 +- w3af/plugins/crawl/dot_ds_store.py | 2 +- w3af/plugins/crawl/dot_listing.py | 2 +- w3af/plugins/crawl/ghdb.py | 2 +- w3af/plugins/crawl/spider_man.py | 2 +- w3af/plugins/crawl/web_spider.py | 2 +- w3af/plugins/infrastructure/afd.py | 4 ++-- w3af/plugins/infrastructure/dns_wildcard.py | 2 +- w3af/plugins/infrastructure/domain_dot.py | 2 +- w3af/plugins/infrastructure/finger_bing.py | 2 +- w3af/plugins/infrastructure/finger_google.py | 4 ++-- w3af/plugins/infrastructure/fingerprint_WAF.py | 2 +- w3af/plugins/infrastructure/frontpage_version.py | 2 +- w3af/plugins/infrastructure/hmap.py | 2 +- 32 files changed, 46 insertions(+), 46 deletions(-) diff --git a/w3af/core/data/db/history.py b/w3af/core/data/db/history.py index f6ec15dcab..dbe9603e8d 100644 --- a/w3af/core/data/db/history.py +++ b/w3af/core/data/db/history.py @@ -259,7 +259,7 @@ def load(self, _id=None, full=True, retry=True): sql = 'SELECT * FROM ' + self._DATA_TABLE + ' WHERE id = ? ' try: row = self._db.select_one(sql, (_id,)) - except DBException, dbe: + except DBException as dbe: msg = 'An unexpected error occurred while searching for id "%s"'\ ' in table "%s". Original exception: "%s".' raise DBException(msg % (_id, self._DATA_TABLE, dbe)) diff --git a/w3af/core/data/url/tests/test_xurllib.py b/w3af/core/data/url/tests/test_xurllib.py index caf9c5cafd..4630924245 100644 --- a/w3af/core/data/url/tests/test_xurllib.py +++ b/w3af/core/data/url/tests/test_xurllib.py @@ -199,7 +199,7 @@ def test_url_port_not_http(self): try: self.uri_opener.GET(url) - except HTTPRequestException, hre: + except HTTPRequestException as hre: self.assertEqual(hre.value, "Bad HTTP response status line: ''") else: self.assertTrue(False, 'Expected HTTPRequestException.') @@ -222,7 +222,7 @@ def test_url_port_not_http_many(self): self.uri_opener.GET(url) except HTTPRequestException: http_request_e += 1 - except ScanMustStopException, smse: + except ScanMustStopException as smse: scan_must_stop_e += 1 break except Exception as e: diff --git a/w3af/core/data/url/tests/test_xurllib_timeout.py b/w3af/core/data/url/tests/test_xurllib_timeout.py index 40d0e9751f..fbacf3fa8e 100644 --- a/w3af/core/data/url/tests/test_xurllib_timeout.py +++ b/w3af/core/data/url/tests/test_xurllib_timeout.py @@ -65,7 +65,7 @@ def test_timeout(self): try: self.uri_opener.GET(url) - except HTTPRequestException, hre: + except HTTPRequestException as hre: self.assertEqual(hre.message, 'HTTP timeout error') except Exception as e: msg = 'Not expecting: "%s"' @@ -122,7 +122,7 @@ def test_timeout_many(self): for _ in xrange(MAX_ERROR_COUNT): try: self.uri_opener.GET(url) - except HTTPRequestException, hre: + except HTTPRequestException as hre: http_request_e += 1 self.assertEqual(hre.message, 'HTTP timeout error') except ScanMustStopException: diff --git a/w3af/core/ui/api/resources/scans.py b/w3af/core/ui/api/resources/scans.py index 3b908b8278..20d10871f1 100644 --- a/w3af/core/ui/api/resources/scans.py +++ b/w3af/core/ui/api/resources/scans.py @@ -80,7 +80,7 @@ def start_scan(): try: w3af_core.profiles.use_profile(scan_profile_file_name, workdir=profile_path) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: abort(400, str(bfe)) # @@ -100,7 +100,7 @@ def start_scan(): try: target_option.set_value([URL(u) for u in target_urls]) w3af_core.target.set_options(target_options) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: abort(400, str(bfe)) scan_id = get_new_scan_id() diff --git a/w3af/core/ui/console/exploit.py b/w3af/core/ui/console/exploit.py index 4093e3393f..5cb5e7ea8a 100644 --- a/w3af/core/ui/console/exploit.py +++ b/w3af/core/ui/console/exploit.py @@ -154,7 +154,7 @@ def sortfunc(x, y): try: self._exploit(ap.get_name( ), vuln_obj.get_id(), show_list=False) - except BaseFrameworkException, w: + except BaseFrameworkException as w: continue_exploiting = True om.out.console(str(w)) else: diff --git a/w3af/core/ui/console/io/console.py b/w3af/core/ui/console/io/console.py index bd05a5e1d9..18b1b28e11 100644 --- a/w3af/core/ui/console/io/console.py +++ b/w3af/core/ui/console/io/console.py @@ -139,7 +139,7 @@ def terminal_width(): try: import msvcrt from w3af.core.ui.console.io.winctrl import * - except Exception, a: + except Exception as a: print str(e + '\n' + a) # We arent on windows nor unix raise BaseFrameworkException( diff --git a/w3af/core/ui/console/profiles.py b/w3af/core/ui/console/profiles.py index fdab454ffa..8ff54d8110 100644 --- a/w3af/core/ui/console/profiles.py +++ b/w3af/core/ui/console/profiles.py @@ -60,7 +60,7 @@ def _cmd_use(self, params): try: self._w3af.profiles.use_profile(profile, workdir=workdir) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.console(str(w3)) om.out.console('The plugins configured by the scan profile have ' @@ -115,7 +115,7 @@ def _cmd_save_as(self, params): # Validate the profile name try: Profile.is_valid_profile_name(profile_name) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: om.out.console('%s' % bfe) return diff --git a/w3af/core/ui/console/rootMenu.py b/w3af/core/ui/console/rootMenu.py index 25db69e9db..0aeef24c36 100644 --- a/w3af/core/ui/console/rootMenu.py +++ b/w3af/core/ui/console/rootMenu.py @@ -142,9 +142,9 @@ def _real_start(self): self._w3af.plugins.init_plugins() self._w3af.verify_environment() self._w3af.start() - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.error(str(w3)) - except ScanMustStopException, w3: + except ScanMustStopException as w3: om.out.error(str(w3)) except Exception: self._w3af.stop() diff --git a/w3af/core/ui/gui/export_request.py b/w3af/core/ui/gui/export_request.py index bbd210ceab..6b5c5c04ae 100644 --- a/w3af/core/ui/gui/export_request.py +++ b/w3af/core/ui/gui/export_request.py @@ -120,7 +120,7 @@ def _export(self, widg, combo): try: exported_request = func(self.http_request.get_text()) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: error_msg = str(w3) self.exported_text.set_text(error_msg) else: diff --git a/w3af/core/ui/gui/httpLogTab.py b/w3af/core/ui/gui/httpLogTab.py index aa248b7624..63c47ef07a 100644 --- a/w3af/core/ui/gui/httpLogTab.py +++ b/w3af/core/ui/gui/httpLogTab.py @@ -306,7 +306,7 @@ def _showAllRequestResponses(self, widget=None, event=None): self._searchText.set_text("") try: self.find_request_response() - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: self._empty_results() return @@ -385,7 +385,7 @@ def find_request_response(self, widget=None, refresh=False): # Please see the 5000 below searchResultObjects = self._historyItem.find(searchData, result_limit=5001, orderData=[("id", "")]) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: self._empty_results() return if len(searchResultObjects) == 0: diff --git a/w3af/core/ui/gui/profiles.py b/w3af/core/ui/gui/profiles.py index 289059a368..260c41da6a 100644 --- a/w3af/core/ui/gui/profiles.py +++ b/w3af/core/ui/gui/profiles.py @@ -385,7 +385,7 @@ def _use_profile(self, widget=None): try: self.w3af.profiles.use_profile(profile_obj.get_profile_file()) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, str(w3)) @@ -419,7 +419,7 @@ def new_profile(self, widget=None): # use the empty profile try: self.w3af.profiles.use_profile(None) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, str(w3)) diff --git a/w3af/core/ui/gui/tools/proxywin.py b/w3af/core/ui/gui/tools/proxywin.py index 38a4a448f2..fb1e89d68e 100644 --- a/w3af/core/ui/gui/tools/proxywin.py +++ b/w3af/core/ui/gui/tools/proxywin.py @@ -272,7 +272,7 @@ def reload_options(self): self.proxy.set_what_to_trap(self.pref.get_value('proxy', 'trap')) self.proxy.set_what_not_to_trap(self.pref.get_value('proxy', 'notrap')) self.proxy.set_methods_to_trap(self.pref.get_value('proxy', 'methodtrap')) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: self.show_alert(_("Invalid configuration!\n" + str(w3))) self._prev_ip_port = new_port @@ -306,7 +306,7 @@ def _start_proxy(self, ip=None, port=None, silent=False): try: self.proxy = InterceptProxy(ip, int(port), self.w3af.uri_opener) - except ProxyException, w3: + except ProxyException as w3: if not silent: self.show_alert(_(str(w3))) raise w3 diff --git a/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py b/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py index 7309c09c5a..f8cb99d7f6 100644 --- a/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py +++ b/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py @@ -75,7 +75,7 @@ def main(): except KeyboardInterrupt: raise - except Exception, msg: + except Exception as msg: print msg if abort: @@ -118,7 +118,7 @@ def main(): except KeyboardInterrupt: raise - except Exception, msg: + except Exception as msg: print msg else: diff --git a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py index 82286793fd..0eb3fe6d3e 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py @@ -41,7 +41,7 @@ def connect(self): args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) - except Exception, msg: + except Exception as msg: raise SqlmapConnectionException(msg[0]) try: @@ -51,7 +51,7 @@ def connect(self): connection_string, str(self.user), str(self.password)) - except Exception, msg: + except Exception as msg: raise SqlmapConnectionException(msg[0]) self.initCursor() @@ -60,7 +60,7 @@ def connect(self): def fetchall(self): try: return self.cursor.fetchall() - except Exception, msg: + except Exception as msg: logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) return None @@ -70,7 +70,7 @@ def execute(self, query): try: self.cursor.execute(query) retVal = True - except Exception, msg: #todo fix with specific error + except Exception as msg: #todo fix with specific error logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) self.connector.commit() diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py index 05fe564cbb..96c9c78b43 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py @@ -50,7 +50,7 @@ def close(self): self.cursor.close() if self.connector: self.connector.close() - except Exception, msg: + except Exception as msg: logger.debug(msg) finally: self.closed() diff --git a/w3af/plugins/attack/payloads/payloads/metasploit.py b/w3af/plugins/attack/payloads/payloads/metasploit.py index d402fc0e91..9c1905d383 100644 --- a/w3af/plugins/attack/payloads/payloads/metasploit.py +++ b/w3af/plugins/attack/payloads/payloads/metasploit.py @@ -21,7 +21,7 @@ class metasploit(Payload): def api_execute(self, msf_args): try: vd = get_virtual_daemon(self.shell.execute) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: return 'Error, %s' % w3 else: vd.run(msf_args) diff --git a/w3af/plugins/attack/payloads/payloads/w3af_agent.py b/w3af/plugins/attack/payloads/payloads/w3af_agent.py index ce106ad48b..356a8723e6 100644 --- a/w3af/plugins/attack/payloads/payloads/w3af_agent.py +++ b/w3af/plugins/attack/payloads/payloads/w3af_agent.py @@ -24,7 +24,7 @@ def api_execute(self, ip_address): try: agentManager = w3afAgentManager(self.shell.execute, ip_address) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: return 'Error' + str(w3) else: agentManager.run() diff --git a/w3af/plugins/bruteforce/basic_auth.py b/w3af/plugins/bruteforce/basic_auth.py index b5d33d7bfd..0ca5ae985b 100644 --- a/w3af/plugins/bruteforce/basic_auth.py +++ b/w3af/plugins/bruteforce/basic_auth.py @@ -93,7 +93,7 @@ def _brute_worker(self, url, combination): try: response = self._uri_opener.send_mutant(fr, cache=False, grep=False) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'Exception while brute-forcing basic authentication,'\ ' error message: "%s".' om.out.debug(msg % w3) diff --git a/w3af/plugins/bruteforce/form_auth.py b/w3af/plugins/bruteforce/form_auth.py index f67074e868..deebfd77aa 100644 --- a/w3af/plugins/bruteforce/form_auth.py +++ b/w3af/plugins/bruteforce/form_auth.py @@ -70,7 +70,7 @@ def audit(self, freq): try: login_failed_bodies = self._id_failed_login_page(mutant) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: msg = 'Unexpected response during form bruteforce setup: "%s"' om.out.debug(msg % bfe) return diff --git a/w3af/plugins/crawl/dot_ds_store.py b/w3af/plugins/crawl/dot_ds_store.py index 96b9c1cdc9..8a76062392 100644 --- a/w3af/plugins/crawl/dot_ds_store.py +++ b/w3af/plugins/crawl/dot_ds_store.py @@ -81,7 +81,7 @@ def _check_and_analyze(self, domain_path): try: response = self.http_get_and_parse(url, binary_response=True) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'Failed to GET .DS_Store file: %s. Exception: %s.' om.out.debug(msg, (url, w3)) return diff --git a/w3af/plugins/crawl/dot_listing.py b/w3af/plugins/crawl/dot_listing.py index f2cabed115..e08da085c6 100644 --- a/w3af/plugins/crawl/dot_listing.py +++ b/w3af/plugins/crawl/dot_listing.py @@ -74,7 +74,7 @@ def _check_and_analyze(self, domain_path): url = domain_path.url_join('.listing') try: response = self._uri_opener.GET(url, cache=True) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'Failed to GET .listing file: "%s". Exception: "%s".' om.out.debug(msg % (url, w3)) return diff --git a/w3af/plugins/crawl/ghdb.py b/w3af/plugins/crawl/ghdb.py index e3bc99c75f..07a9083f85 100644 --- a/w3af/plugins/crawl/ghdb.py +++ b/w3af/plugins/crawl/ghdb.py @@ -88,7 +88,7 @@ def _do_clasic_GHDB(self, domain): search_term = 'site:%s %s' % (domain, gh.search) try: self._classic_worker(gh, search_term) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: # Google is saying: "no more automated tests". om.out.error('GHDB exception: "' + str(w3) + '".') break diff --git a/w3af/plugins/crawl/spider_man.py b/w3af/plugins/crawl/spider_man.py index 179a05c024..aa37e3f188 100644 --- a/w3af/plugins/crawl/spider_man.py +++ b/w3af/plugins/crawl/spider_man.py @@ -77,7 +77,7 @@ def crawl(self, freq): plugin=self, target_domain=freq.get_url().get_domain(), name='SpiderManProxyThread') - except ProxyException, proxy_exc: + except ProxyException as proxy_exc: om.out.error('%s' % proxy_exc) else: diff --git a/w3af/plugins/crawl/web_spider.py b/w3af/plugins/crawl/web_spider.py index 5fc18cd9a2..0be80a6b24 100644 --- a/w3af/plugins/crawl/web_spider.py +++ b/w3af/plugins/crawl/web_spider.py @@ -205,7 +205,7 @@ def _body_url_generator(self, resp, fuzzable_req): # try: doc_parser = parser_cache.dpc.get_document_parser_for(resp) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.debug('Failed to find a suitable document parser. ' 'Exception "%s"' % w3) else: diff --git a/w3af/plugins/infrastructure/afd.py b/w3af/plugins/infrastructure/afd.py index 4993bdd921..3709f303d3 100644 --- a/w3af/plugins/infrastructure/afd.py +++ b/w3af/plugins/infrastructure/afd.py @@ -60,7 +60,7 @@ def discover(self, fuzzable_request): """ try: filtered, not_filtered = self._send_requests(fuzzable_request) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: om.out.error(str(bfe)) else: self._analyze_results(filtered, not_filtered) @@ -81,7 +81,7 @@ def _send_requests(self, fuzzable_request): try: http_resp = self._uri_opener.GET(original_url, cache=True) - except BaseFrameworkException, bfe: + except BaseFrameworkException as bfe: msg = ('Active filter detection plugin failed to receive a' ' response for the first request. The exception was: "%s".' ' Can not perform analysis.') diff --git a/w3af/plugins/infrastructure/dns_wildcard.py b/w3af/plugins/infrastructure/dns_wildcard.py index f3b5a2ccdc..71538cff33 100644 --- a/w3af/plugins/infrastructure/dns_wildcard.py +++ b/w3af/plugins/infrastructure/dns_wildcard.py @@ -88,7 +88,7 @@ def _test_IP(self, original_response, domain): try: modified_response = self._uri_opener.GET(ip_url, cache=True) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'An error occurred while fetching IP address URL in ' \ ' dns_wildcard plugin: "%s"' % w3 om.out.debug(msg) diff --git a/w3af/plugins/infrastructure/domain_dot.py b/w3af/plugins/infrastructure/domain_dot.py index ce5dcf6b03..5edf608691 100644 --- a/w3af/plugins/infrastructure/domain_dot.py +++ b/w3af/plugins/infrastructure/domain_dot.py @@ -70,7 +70,7 @@ def discover(self, fuzzable_request): headers = Headers([('Host', domain_dot)]) response = self._uri_opener.GET(orig_url, cache=False, headers=headers) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.error(str(w3)) else: self._analyze_response(original_response, response) diff --git a/w3af/plugins/infrastructure/finger_bing.py b/w3af/plugins/infrastructure/finger_bing.py index 0eab8144d7..e6181ec73d 100644 --- a/w3af/plugins/infrastructure/finger_bing.py +++ b/w3af/plugins/infrastructure/finger_bing.py @@ -82,7 +82,7 @@ def _find_accounts(self, page): except ScanMustStopOnUrlError: # Just ignore it pass - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'ExtendedUrllib exception raised while fetching page in' \ ' finger_bing, error description: "%s"' om.out.debug(msg % w3) diff --git a/w3af/plugins/infrastructure/finger_google.py b/w3af/plugins/infrastructure/finger_google.py index 80a756f327..30b3d4c93d 100644 --- a/w3af/plugins/infrastructure/finger_google.py +++ b/w3af/plugins/infrastructure/finger_google.py @@ -76,7 +76,7 @@ def _do_fast_search(self, domain): search_string, self._result_limit ) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.error(str(w3)) # If I found an error, I don't want to be run again raise RunOnce() @@ -95,7 +95,7 @@ def _do_complete_search(self, domain): search_string, self._result_limit ) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.error(str(w3)) # If I found an error, I don't want to be run again raise RunOnce() diff --git a/w3af/plugins/infrastructure/fingerprint_WAF.py b/w3af/plugins/infrastructure/fingerprint_WAF.py index c07ac47ffb..7251972c7a 100644 --- a/w3af/plugins/infrastructure/fingerprint_WAF.py +++ b/w3af/plugins/infrastructure/fingerprint_WAF.py @@ -97,7 +97,7 @@ def _fingerprint_SecureIIS(self, fuzzable_request): try: lock_response2 = self._uri_opener.GET(fuzzable_request.get_url(), headers=headers, cache=True) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: om.out.debug( 'Failed to identify secure IIS, exception: ' + str(w3)) else: diff --git a/w3af/plugins/infrastructure/frontpage_version.py b/w3af/plugins/infrastructure/frontpage_version.py index 7967e5c611..a9d12a0eda 100644 --- a/w3af/plugins/infrastructure/frontpage_version.py +++ b/w3af/plugins/infrastructure/frontpage_version.py @@ -71,7 +71,7 @@ def discover(self, fuzzable_request): try: response = self._uri_opener.GET(frontpage_info_url, cache=True) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: fmt = ('Failed to GET Frontpage Server _vti_inf.html file: "%s". ' 'Exception: "%s".') om.out.debug(fmt % (frontpage_info_url, w3)) diff --git a/w3af/plugins/infrastructure/hmap.py b/w3af/plugins/infrastructure/hmap.py index d93902a682..6dbe9d7c29 100644 --- a/w3af/plugins/infrastructure/hmap.py +++ b/w3af/plugins/infrastructure/hmap.py @@ -66,7 +66,7 @@ def discover(self, fuzzable_request): try: results = upstream_hmap.testServer(ssl, server, port, 1, self._gen_fp, self._threads) - except BaseFrameworkException, w3: + except BaseFrameworkException as w3: msg = 'A BaseFrameworkException occurred while running hmap: "%s"' om.out.error(msg % w3) return From a807ee66271ed156ae405bdad397f15044f8bb06 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Sat, 2 Feb 2019 21:59:51 +0330 Subject: [PATCH 06/46] Update test_base_consumer.py --- .../core_helpers/consumers/tests/test_base_consumer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py index f31ab7271d..ce55fff866 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py @@ -47,7 +47,7 @@ def test_handle_exception(self): self.assertTrue(exception_data.traceback is not None) self.assertEqual(exception_data.phase, 'audit') self.assertEqual(exception_data.plugin, 'sqli') - self.assertEqual(exception_data.Exception as e) + self.assertEqual(exception_data.Exception, e) def test_terminate(self): self.bc.start() From f247652d6b75c103c2ca5fbe225101dad07d2cd1 Mon Sep 17 00:00:00 2001 From: Hougomartim Date: Sat, 2 Feb 2019 22:09:41 +0330 Subject: [PATCH 07/46] resolve Exception bug ./ --- w3af/core/controllers/core_helpers/exception_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/core/controllers/core_helpers/exception_handler.py b/w3af/core/controllers/core_helpers/exception_handler.py index 2318e3e8ec..1c40d95b85 100644 --- a/w3af/core/controllers/core_helpers/exception_handler.py +++ b/w3af/core/controllers/core_helpers/exception_handler.py @@ -73,7 +73,7 @@ def handle_exception_data(self, exception_data): (_, _, exception_data.traceback), exception_data.enabled_plugins) - def handle(self, current_status, Exception as exec_info, enabled_plugins): + def handle(self, current_status, Exception, exec_info, enabled_plugins): """ This method stores the current status and the exception for later processing. If there are already too many stored exceptions for this From a629addd2c7740a1066186b0c01d628e2c456040 Mon Sep 17 00:00:00 2001 From: Hougomartim Date: Sat, 2 Feb 2019 22:18:26 +0330 Subject: [PATCH 08/46] resolve mistakes ./ --- w3af/core/ui/api/tests/test_exceptions.py | 2 +- w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html | 2 +- w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/w3af/core/ui/api/tests/test_exceptions.py b/w3af/core/ui/api/tests/test_exceptions.py index eac5cbc86e..f064b1ceb9 100644 --- a/w3af/core/ui/api/tests/test_exceptions.py +++ b/w3af/core/ui/api/tests/test_exceptions.py @@ -64,7 +64,7 @@ def test_query_exceptions(self): #u'lineno': 123, u'phase': u'phase', u'plugin': u'plugin'} - self.assertEqual(Exception as expected_summary) + self.assertEqual(Exception, expected_summary) response = self.app.get('/scans/%s/exceptions/0' % scan_id, headers=self.HEADERS) diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html index 67416235dc..a39b2104e3 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html @@ -391,7 +391,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException as emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite

diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html index dd64f098c9..84564a5201 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html @@ -470,7 +470,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException as emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

standard

From a74049ad622975a4b4c2492e6bf3383fd34a216d Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:43:59 +0330 Subject: [PATCH 09/46] Update test_base_consumer.py --- .../core_helpers/consumers/tests/test_base_consumer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py index ce55fff866..319da39e55 100644 --- a/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py +++ b/w3af/core/controllers/core_helpers/consumers/tests/test_base_consumer.py @@ -47,7 +47,7 @@ def test_handle_exception(self): self.assertTrue(exception_data.traceback is not None) self.assertEqual(exception_data.phase, 'audit') self.assertEqual(exception_data.plugin, 'sqli') - self.assertEqual(exception_data.Exception, e) + self.assertEqual(exception_data.exception, e) def test_terminate(self): self.bc.start() From 4a83a57a8780c92de3fe281e26f83818ce331499 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:45:12 +0330 Subject: [PATCH 10/46] Update exception_handler.py --- w3af/core/controllers/core_helpers/exception_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/core/controllers/core_helpers/exception_handler.py b/w3af/core/controllers/core_helpers/exception_handler.py index f96cec339f..4d9a93380b 100644 --- a/w3af/core/controllers/core_helpers/exception_handler.py +++ b/w3af/core/controllers/core_helpers/exception_handler.py @@ -75,7 +75,7 @@ def handle_exception_data(self, exception_data): (_, _, exception_data.traceback), exception_data.enabled_plugins) - def handle(self, current_status, Exception, exec_info, enabled_plugins): + def handle(self, current_status, exception, exec_info, enabled_plugins): """ This method stores the current status and the exception for later processing. If there are already too many stored exceptions for this From e9bccd1b1c78e93f5c12dc47e55fb7b3e8594b58 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:47:06 +0330 Subject: [PATCH 11/46] Update test_exceptions.py --- w3af/core/ui/api/tests/test_exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/core/ui/api/tests/test_exceptions.py b/w3af/core/ui/api/tests/test_exceptions.py index f064b1ceb9..1b66af4331 100644 --- a/w3af/core/ui/api/tests/test_exceptions.py +++ b/w3af/core/ui/api/tests/test_exceptions.py @@ -64,9 +64,9 @@ def test_query_exceptions(self): #u'lineno': 123, u'phase': u'phase', u'plugin': u'plugin'} - self.assertEqual(Exception, expected_summary) + self.assertEqual(exception, expected_summary) response = self.app.get('/scans/%s/exceptions/0' % scan_id, headers=self.HEADERS) - self.assertIn('traceback', json.loads(response.data)) \ No newline at end of file + self.assertIn('traceback', json.loads(response.data)) From 6c5d3b9242bbc479de4cc9bbd96addfb0fcea32e Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:47:56 +0330 Subject: [PATCH 12/46] Update wordlist.py --- w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py index fac0952e08..74d36e42dc 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py @@ -47,7 +47,7 @@ def adjust(self): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg if len(_.namelist()) == 0: errMsg = "no file(s) inside '%s'" % self.current raise SqlmapDataException(errMsg) From eff7aaf7a5ab76cf9dfc231ba8f6aa5314c070fc Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:50:44 +0330 Subject: [PATCH 13/46] Update phpinfo-5.1.3-rc4dev.html --- w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html index a39b2104e3..843ad3f392 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.3-rc4dev.html @@ -391,7 +391,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite

From 96bbfb894e107635869b5c687533bb9b45dfc2e1 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Fri, 8 Feb 2019 10:52:13 +0330 Subject: [PATCH 14/46] Update phpinfo-5.1.6.html --- w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html index 84564a5201..2fa624b212 100644 --- a/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html +++ b/w3af/plugins/tests/crawl/phpinfo/phpinfo-5.1.6.html @@ -470,7 +470,7 @@

SPL

- +
SPL supportenabled
Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, emptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException
Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

standard

@@ -623,4 +623,4 @@

PHP License


- \ No newline at end of file + From c28a8d08a104b5b7ca907c91d4267b98bf7fa14c Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:27:07 +0330 Subject: [PATCH 15/46] Update regressiontest.py --- w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py index 1aad7327ad..2855f8cb6d 100755 --- a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py +++ b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py @@ -56,7 +56,7 @@ def send_email(msg): s.sendmail(FROM, TO, msg.as_string()) s.quit() # Catch all for SMTP exceptions - except smtplib.SMTPException as e: + except smtplib.SMTPException, e: print "Failure to send email: %s" % str(e) def failure_email(msg): From d22e5aa7ab72581c380036cac9d870ed1cd3f0f6 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:28:45 +0330 Subject: [PATCH 16/46] Update regressiontest.py --- w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py index 2855f8cb6d..aa9c4bd418 100755 --- a/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py +++ b/w3af/plugins/attack/db/sqlmap/extra/shutils/regressiontest.py @@ -157,7 +157,7 @@ def main(): try: main() - except Exception as e: + except Exception, e: log_fd.write("An exception has occurred:\n%s" % str(traceback.format_exc())) log_fd.write("Regression test finished at %s\n\n" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())) From b10910a8e39b13540b65d4b6fbe5c9ad710973bf Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:29:46 +0330 Subject: [PATCH 17/46] Update sqlharvest.py --- w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py b/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py index f8cb99d7f6..7309c09c5a 100644 --- a/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py +++ b/w3af/plugins/attack/db/sqlmap/extra/sqlharvest/sqlharvest.py @@ -75,7 +75,7 @@ def main(): except KeyboardInterrupt: raise - except Exception as msg: + except Exception, msg: print msg if abort: @@ -118,7 +118,7 @@ def main(): except KeyboardInterrupt: raise - except Exception as msg: + except Exception, msg: print msg else: From f26e1d5b95c4a383c348ba6623faa978c47bd111 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:31:29 +0330 Subject: [PATCH 18/46] Update action.py --- w3af/plugins/attack/db/sqlmap/lib/controller/action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py index a42a497f7d..888dd15474 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py @@ -75,7 +75,7 @@ def action(): if conf.getPasswordHashes: try: conf.dumper.userSettings("database management system users password hashes", conf.dbmsHandler.getPasswordHashes(), "password hash", CONTENT_TYPE.PASSWORDS) - except SqlmapNoneDataException as ex: + except SqlmapNoneDataException, ex: logger.critical(ex) except: raise From 2449742dd48f2aeaf124fe9025dcfaa72c9cee01 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:32:08 +0330 Subject: [PATCH 19/46] Update action.py --- w3af/plugins/attack/db/sqlmap/lib/controller/action.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py index 888dd15474..4f26e90d39 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/action.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/action.py @@ -83,7 +83,7 @@ def action(): if conf.getPrivileges: try: conf.dumper.userSettings("database management system users privileges", conf.dbmsHandler.getPrivileges(), "privilege", CONTENT_TYPE.PRIVILEGES) - except SqlmapNoneDataException as ex: + except SqlmapNoneDataException, ex: logger.critical(ex) except: raise @@ -91,7 +91,7 @@ def action(): if conf.getRoles: try: conf.dumper.userSettings("database management system users roles", conf.dbmsHandler.getRoles(), "role", CONTENT_TYPE.ROLES) - except SqlmapNoneDataException as ex: + except SqlmapNoneDataException, ex: logger.critical(ex) except: raise From bd437495e9f5293764fde04884389ae34cc52cad Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:33:52 +0330 Subject: [PATCH 20/46] Update checks.py --- w3af/plugins/attack/db/sqlmap/lib/controller/checks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py b/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py index ad00d38f54..58e8bc4d57 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/checks.py @@ -1390,7 +1390,7 @@ def _(*args, **kwargs): try: logger.debug("checking for WAF/IPS/IDS product '%s'" % product) found = function(_) - except Exception as ex: + except Exception, ex: errMsg = "exception occurred while running " errMsg += "WAF script for '%s' ('%s')" % (product, getSafeExString(ex)) logger.critical(errMsg) @@ -1474,7 +1474,7 @@ def checkNullConnection(): infoMsg = "NULL connection is supported with 'skip-read' method" logger.info(infoMsg) - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: errMsg = getSafeExString(ex) raise SqlmapConnectionException(errMsg) @@ -1523,7 +1523,7 @@ def checkConnection(suppressOutput=False): else: kb.errorIsNone = True - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: if conf.ipv6: warnMsg = "check connection to a provided " warnMsg += "IPv6 address with a tool like ping6 " From f793b36d8eb71e19ec5b371a24d481125c83ef6e Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:34:37 +0330 Subject: [PATCH 21/46] Update controller.py --- w3af/plugins/attack/db/sqlmap/lib/controller/controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py b/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py index 74ab95e23b..50bad20bd1 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py +++ b/w3af/plugins/attack/db/sqlmap/lib/controller/controller.py @@ -672,7 +672,7 @@ def start(): except SqlmapSilentQuitException: raise - except SqlmapBaseException as ex: + except SqlmapBaseException, ex: errMsg = getSafeExString(ex) if conf.multipleTargets: From 302dd7547febabef421fb73979739e6121d9cc65 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:35:26 +0330 Subject: [PATCH 22/46] Update bigarray.py --- w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py index e27e44c6ae..6601ff1a51 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py @@ -87,7 +87,7 @@ def pop(self): except IOError, ex: errMsg = "exception occurred while retrieving data " errMsg += "from a temporary file ('%s')" % ex.message - raise SqlmapSystemException as errMsg + raise SqlmapSystemException, errMsg return self.chunks[-1].pop() @@ -112,7 +112,7 @@ def _dump(self, chunk): errMsg += "make sure that there is enough disk space left. If problem persists, " errMsg += "try to set environment variable 'TEMP' to a location " errMsg += "writeable by the current user" - raise SqlmapSystemException as errMsg + raise SqlmapSystemException, errMsg def _checkcache(self, index): if (self.cache and self.cache.index != index and self.cache.dirty): From 0fa10bd4335b8acd1990a1e7ab8ac11f1536eb75 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:35:48 +0330 Subject: [PATCH 23/46] Update bigarray.py --- w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py index 6601ff1a51..e3c0b704b7 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/bigarray.py @@ -126,7 +126,7 @@ def _checkcache(self, index): except IOError, ex: errMsg = "exception occurred while retrieving data " errMsg += "from a temporary file ('%s')" % ex.message - raise SqlmapSystemException as errMsg + raise SqlmapSystemException, errMsg def __getstate__(self): return self.chunks, self.filenames From 30a6d280c62958f319aa13243b648f7edf1f7110 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:37:50 +0330 Subject: [PATCH 24/46] Update common.py --- w3af/plugins/attack/db/sqlmap/lib/core/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/common.py b/w3af/plugins/attack/db/sqlmap/lib/core/common.py index dfac50b2ee..952625977f 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/common.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/common.py @@ -1984,7 +1984,7 @@ def parseXmlFile(xmlFile, handler): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg def getSQLSnippet(dbms, sfile, **variables): """ @@ -2343,7 +2343,7 @@ def pushValue(value): getCurrentThreadData().valueStack.append(copy.deepcopy(value)) success = True break - except Exception as ex: + except Exception, ex: _ = ex if not success: @@ -3359,7 +3359,7 @@ def createGithubIssue(errMsg, excMsg): try: content = urllib2.urlopen(req).read() - except Exception as ex: + except Exception, ex: content = None issueUrl = re.search(r"https://github.com/sqlmapproject/sqlmap/issues/\d+", content or "") @@ -4082,7 +4082,7 @@ def evaluateCode(code, variables=None): exec(code, variables) except KeyboardInterrupt: raise - except Exception as ex: + except Exception, ex: errMsg = "an error occurred while evaluating provided code ('%s') " % getSafeExString(ex) raise SqlmapGenericException(errMsg) From c92c538ff319b719ea3b4c487ba6f939453ab696 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:38:48 +0330 Subject: [PATCH 25/46] Update dump.py --- w3af/plugins/attack/db/sqlmap/lib/core/dump.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/dump.py b/w3af/plugins/attack/db/sqlmap/lib/core/dump.py index 63abae2cb4..7c1325ca2c 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/dump.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/dump.py @@ -424,7 +424,7 @@ def dbTableValues(self, tableValues): if not os.path.isdir(dumpDbPath): try: os.makedirs(dumpDbPath, 0755) - except Exception as ex: + except Exception, ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapdb") except IOError, _: @@ -621,7 +621,7 @@ def dbTableValues(self, tableValues): with open(filepath, "wb") as f: _ = safechardecode(value, True) f.write(_) - except magic.MagicException as err: + except magic.MagicException, err: logger.debug(str(err)) if conf.dumpFormat == DUMP_FORMAT.CSV: From 78b2186ebd9e44a9e6f5073f504b0f91e6e206ab Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:42:17 +0330 Subject: [PATCH 26/46] Update option.py --- .../attack/db/sqlmap/lib/core/option.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/option.py b/w3af/plugins/attack/db/sqlmap/lib/core/option.py index 15c44c1f4a..37e56f77a6 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/option.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/option.py @@ -337,7 +337,7 @@ def _parseBurpLog(content): if not host: errMsg = "invalid format of a request file" - raise SqlmapSyntaxException as errMsg + raise SqlmapSyntaxException, errMsg if not url.startswith("http"): url = "%s://%s:%s%s" % (scheme or "http", host, port or "80", url) @@ -398,11 +398,11 @@ def __contains__(self, name): tree = ElementTree() try: tree.parse(paths.QUERIES_XML) - except Exception as ex: + except Exception, ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg for node in tree.findall("*"): queries[node.attrib['value']] = iterate(node) @@ -514,7 +514,7 @@ def _setCrawler(): if conf.verbose in (1, 2): status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets))) dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) - except Exception as ex: + except Exception, ex: errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, getSafeExString(ex)) logger.error(errMsg) @@ -650,7 +650,7 @@ def _findPageForms(): dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True) except KeyboardInterrupt: break - except Exception as ex: + except Exception, ex: errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, getSafeExString(ex)) logger.error(errMsg) @@ -1125,9 +1125,9 @@ def _setHTTPHandlers(): try: _ = urlparse.urlsplit(conf.proxy) - except Exception as ex: + except Exception, ex: errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, getSafeExString(ex)) - raise SqlmapSyntaxException as errMsg + raise SqlmapSyntaxException, errMsg hostnamePort = _.netloc.split(":") @@ -1254,7 +1254,7 @@ def _setSafeVisit(): kb.safeReq.post = None else: errMsg = "invalid format of a safe request file" - raise SqlmapSyntaxException as errMsg + raise SqlmapSyntaxException, errMsg else: if not re.search(r"\Ahttp[s]*://", conf.safeUrl): if ":443/" in conf.safeUrl: @@ -1579,7 +1579,7 @@ def _createTemporaryDirectory(): except (OSError, IOError), ex: errMsg = "there has been a problem while accessing " errMsg += "temporary directory location(s) ('%s')" % getSafeExString(ex) - raise SqlmapSystemException as errMsg + raise SqlmapSystemException, errMsg else: try: if not os.path.isdir(tempfile.gettempdir()): @@ -1606,7 +1606,7 @@ def _createTemporaryDirectory(): except (OSError, IOError, WindowsError), ex: errMsg = "there has been a problem while setting " errMsg += "temporary directory location ('%s')" % getSafeExString(ex) - raise SqlmapSystemException as errMsg + raise SqlmapSystemException, errMsg def _cleanupOptions(): """ @@ -2451,14 +2451,14 @@ def _basicOptionValidation(): if conf.regexp: try: re.compile(conf.regexp) - except Exception as ex: + except Exception, ex: errMsg = "invalid regular expression '%s' ('%s')" % (conf.regexp, getSafeExString(ex)) raise SqlmapSyntaxException(errMsg) if conf.crawlExclude: try: re.compile(conf.crawlExclude) - except Exception as ex: + except Exception, ex: errMsg = "invalid regular expression '%s' ('%s')" % (conf.crawlExclude, getSafeExString(ex)) raise SqlmapSyntaxException(errMsg) From 8ad3ad22890eb6f6f3150e50c60a0609ab2e0df8 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:42:35 +0330 Subject: [PATCH 27/46] Update replication.py --- w3af/plugins/attack/db/sqlmap/lib/core/replication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/replication.py b/w3af/plugins/attack/db/sqlmap/lib/core/replication.py index a12c8fe557..c44f6113d4 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/replication.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/replication.py @@ -63,7 +63,7 @@ def __init__(self, parent, name, columns=None, create=True, typeless=False): self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s" %s' % (unsafeSQLIdentificatorNaming(colname), coltype) for colname, coltype in self.columns))) else: self.execute('CREATE TABLE "%s" (%s)' % (self.name, ','.join('"%s"' % unsafeSQLIdentificatorNaming(colname) for colname in self.columns))) - except Exception as ex: + except Exception, ex: errMsg = "problem occurred ('%s') while initializing the sqlite database " % getSafeExString(ex, UNICODE_ENCODING) errMsg += "located at '%s'" % self.parent.dbpath raise SqlmapGenericException(errMsg) From fed740c58b338ae7583589dc477f69fcbe517c91 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:43:29 +0330 Subject: [PATCH 28/46] Update testing.py --- w3af/plugins/attack/db/sqlmap/lib/core/testing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/testing.py b/w3af/plugins/attack/db/sqlmap/lib/core/testing.py index fce1f219b7..caf8168e35 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/testing.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/testing.py @@ -271,9 +271,9 @@ def runCase(parse): result = start() except KeyboardInterrupt: pass - except SqlmapBaseException as e: + except SqlmapBaseException, e: handled_exception = e - except Exception as e: + except Exception, e: unhandled_exception = e finally: sys.stdout.seek(0) From 9403c19dddd87b8aeb91e1b2b53b95af2577ac71 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:44:07 +0330 Subject: [PATCH 29/46] Update threads.py --- w3af/plugins/attack/db/sqlmap/lib/core/threads.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/threads.py b/w3af/plugins/attack/db/sqlmap/lib/core/threads.py index 6821b6ffed..89b1098bf9 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/threads.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/threads.py @@ -91,7 +91,7 @@ def exceptionHandledFunction(threadFunction, silent=False): kb.threadContinue = False kb.threadException = True raise - except Exception as ex: + except Exception, ex: if not silent: logger.error("thread %s: %s" % (threading.currentThread().getName(), ex.message)) @@ -147,7 +147,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio try: thread.start() - except Exception as ex: + except Exception, ex: errMsg = "error occurred while starting new thread ('%s')" % ex.message logger.critical(errMsg) break From 43ad00540a24536d2fa749eece61ca002edfbda7 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:44:30 +0330 Subject: [PATCH 30/46] Update wordlist.py --- w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py index 74d36e42dc..55345a8498 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py +++ b/w3af/plugins/attack/db/sqlmap/lib/core/wordlist.py @@ -73,7 +73,7 @@ def next(self): errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg except StopIteration: self.adjust() retVal = self.iter.next().rstrip() From b9c9fc6bd84f7b1294fa2de380f0c0a6f9ba2086 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:44:50 +0330 Subject: [PATCH 31/46] Update configfile.py --- w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py b/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py index 83053873f3..735eab6293 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/configfile.py @@ -71,7 +71,7 @@ def configFileParser(configFile): try: config = UnicodeRawConfigParser() config.readfp(configFP) - except Exception as ex: + except Exception, ex: errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getSafeExString(ex) raise SqlmapSyntaxException(errMsg) From e237ba5fe1431738c2c0f801aa47eea4455a2a6b Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:45:46 +0330 Subject: [PATCH 32/46] Update payloads.py --- w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py b/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py index a06ce5f08a..b2629a9fd6 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/payloads.py @@ -74,11 +74,11 @@ def parseXmlNode(node): def loadBoundaries(): try: doc = et.parse(paths.BOUNDARIES_XML) - except Exception as ex: + except Exception, ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (paths.BOUNDARIES_XML, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg root = doc.getroot() parseXmlNode(root) @@ -89,11 +89,11 @@ def loadPayloads(): try: doc = et.parse(payloadFilePath) - except Exception as ex: + except Exception, ex: errMsg = "something appears to be wrong with " errMsg += "the file '%s' ('%s'). Please make " % (payloadFilePath, getSafeExString(ex)) errMsg += "sure that you haven't made any changes to it" - raise SqlmapInstallationException as errMsg + raise SqlmapInstallationException, errMsg root = doc.getroot() parseXmlNode(root) From 5e0727c1b3eeb68129154d7ee2e9f030fc5312d4 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:46:04 +0330 Subject: [PATCH 33/46] Update sitemap.py --- w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py b/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py index fb810a01ff..1bb73c1c60 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py +++ b/w3af/plugins/attack/db/sqlmap/lib/parse/sitemap.py @@ -32,7 +32,7 @@ def parseSitemap(url, retVal=None): content = Request.getPage(url=url, raise404=True)[0] if not abortedFlag else "" except httplib.InvalidURL: errMsg = "invalid URL given for sitemap ('%s')" % url - raise SqlmapSyntaxException as errMsg + raise SqlmapSyntaxException, errMsg for match in re.finditer(r"\s*([^<]+)", content or ""): if abortedFlag: From 2bbbef377d1b4ee35df09ed96ec9b5d1ae94d1d0 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:47:28 +0330 Subject: [PATCH 34/46] Update connect.py --- w3af/plugins/attack/db/sqlmap/lib/request/connect.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/request/connect.py b/w3af/plugins/attack/db/sqlmap/lib/request/connect.py index b3dd425f61..adb4838b2f 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/request/connect.py +++ b/w3af/plugins/attack/db/sqlmap/lib/request/connect.py @@ -540,11 +540,11 @@ class _(dict): if hasattr(conn.fp, '_sock'): conn.fp._sock.close() conn.close() - except Exception as ex: + except Exception, ex: warnMsg = "problem occurred during connection closing ('%s')" % getSafeExString(ex) logger.warn(warnMsg) - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: if conf.proxyList and not kb.threadException: warnMsg = "unable to connect to the target URL ('%s')" % ex logger.critical(warnMsg) @@ -817,7 +817,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent for function in kb.tamperFunctions: try: payload = function(payload=payload, headers=auxHeaders) - except Exception as ex: + except Exception, ex: errMsg = "error occurred while running tamper " errMsg += "function '%s' ('%s')" % (function.func_name, getSafeExString(ex)) raise SqlmapGenericException(errMsg) @@ -981,7 +981,7 @@ def _adjustParameter(paramString, parameter, newValue): if not conf.csrfUrl: errMsg += ". You can try to rerun by providing " errMsg += "a valid value for option '--csrf-url'" - raise SqlmapTokenException as errMsg + raise SqlmapTokenException, errMsg if token: token = token.strip("'\"") From 1d27c3f1730e196184eb66830851151df58ae2d0 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:48:08 +0330 Subject: [PATCH 35/46] Update api.py --- w3af/plugins/attack/db/sqlmap/lib/utils/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/api.py b/w3af/plugins/attack/db/sqlmap/lib/utils/api.py index a00e651bf4..ee96635c64 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/api.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/api.py @@ -754,7 +754,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non try: _client(addr) - except Exception as ex: + except Exception, ex: if not isinstance(ex, urllib2.HTTPError) or ex.code == httplib.UNAUTHORIZED: errMsg = "There has been a problem while connecting to the " errMsg += "REST-JSON API server at '%s' " % addr @@ -806,7 +806,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non try: argv = ["sqlmap.py"] + shlex.split(command)[1:] - except Exception as ex: + except Exception, ex: logger.error("Error occurred while parsing arguments ('%s')" % ex) taskid = None continue From cd0e5fb6ddc674485c444bad9727a1ff35d45cb6 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:48:41 +0330 Subject: [PATCH 36/46] Update crawler.py --- w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py b/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py index 91feb8e150..df3eca37b9 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/crawler.py @@ -63,7 +63,7 @@ def crawlThread(): try: if current: content = Request.getPage(url=current, crawling=True, raise404=False)[0] - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: errMsg = "connection exception detected ('%s'). skipping " % getSafeExString(ex) errMsg += "URL '%s'" % current logger.critical(errMsg) @@ -138,7 +138,7 @@ def crawlThread(): url = urlparse.urljoin(target, "/sitemap.xml") try: items = parseSitemap(url) - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: if "page not found" in getSafeExString(ex): found = False logger.warn("'sitemap.xml' not found") From 9fa53430d4847141283cbdccc5971b43def0106d Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:50:02 +0330 Subject: [PATCH 37/46] Update hash.py --- w3af/plugins/attack/db/sqlmap/lib/utils/hash.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py b/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py index 82a181e758..4c93509e2d 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/hash.py @@ -762,7 +762,7 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc except (UnicodeEncodeError, UnicodeDecodeError): pass # ignore possible encoding problems caused by some words in custom dictionaries - except Exception as e: + except Exception, e: warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e) warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS logger.critical(warnMsg) @@ -836,7 +836,7 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found except (UnicodeEncodeError, UnicodeDecodeError): pass # ignore possible encoding problems caused by some words in custom dictionaries - except Exception as e: + except Exception, e: warnMsg = "there was a problem while hashing entry: %s (%s). " % (repr(word), e) warnMsg += "Please report by e-mail to '%s'" % DEV_EMAIL_ADDRESS logger.critical(warnMsg) @@ -987,7 +987,7 @@ def dictionaryAttack(attack_dict): kb.wordlists = dictPaths - except Exception as ex: + except Exception, ex: warnMsg = "there was a problem while loading dictionaries" warnMsg += " ('%s')" % getSafeExString(ex) logger.critical(warnMsg) From f528ca5772bf3797f7ede857c9379948be2b3b80 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:50:56 +0330 Subject: [PATCH 38/46] Update hashdb.py --- w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py b/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py index 1bcb15c63c..56606398da 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/hashdb.py @@ -41,7 +41,7 @@ def _get_cursor(self): threadData.hashDBCursor = connection.cursor() threadData.hashDBCursor.execute("CREATE TABLE IF NOT EXISTS storage (id INTEGER PRIMARY KEY, value TEXT)") connection.commit() - except Exception as ex: + except Exception, ex: errMsg = "error occurred while opening a session " errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex)) raise SqlmapConnectionException(errMsg) @@ -92,7 +92,7 @@ def retrieve(self, key, unserialize=False): except sqlite3.DatabaseError, ex: errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex)) errMsg += "If the problem persists please rerun with `--flush-session`" - raise SqlmapConnectionException as errMsg + raise SqlmapConnectionException, errMsg else: break From cad92293d01f43f56fe394c007827c31b48b3d36 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:51:28 +0330 Subject: [PATCH 39/46] Update pivotdumptable.py --- w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py b/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py index c38bd2e369..bd711aa0f7 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/pivotdumptable.py @@ -172,7 +172,7 @@ def _(column, pivotValue): warnMsg += "will display partial output" logger.warn(warnMsg) - except SqlmapConnectionException as e: + except SqlmapConnectionException, e: errMsg = "connection exception detected. sqlmap " errMsg += "will display partial output" errMsg += "'%s'" % e From 13b996b5ab90fd7d0f9f2baf14d626699efb6062 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:52:32 +0330 Subject: [PATCH 40/46] Update search.py --- w3af/plugins/attack/db/sqlmap/lib/utils/search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/lib/utils/search.py b/w3af/plugins/attack/db/sqlmap/lib/utils/search.py index dd9be26baa..138197f180 100644 --- a/w3af/plugins/attack/db/sqlmap/lib/utils/search.py +++ b/w3af/plugins/attack/db/sqlmap/lib/utils/search.py @@ -53,7 +53,7 @@ def _search(dork): try: req = urllib2.Request("https://www.google.com/ncr", headers=headers) conn = urllib2.urlopen(req) - except Exception as ex: + except Exception, ex: errMsg = "unable to connect to Google ('%s')" % getSafeExString(ex) raise SqlmapConnectionException(errMsg) @@ -90,7 +90,7 @@ def _search(dork): except urllib2.HTTPError, e: try: page = e.read() - except Exception as ex: + except Exception, ex: warnMsg = "problem occurred while trying to get " warnMsg += "an error page information (%s)" % getSafeExString(ex) logger.critical(warnMsg) @@ -171,7 +171,7 @@ def search(dork): try: return _search(dork) - except SqlmapBaseException as ex: + except SqlmapBaseException, ex: if conf.proxyList: logger.critical(getSafeExString(ex)) From c67f88ce3e741f0745ac5b70c26c429b13d3f759 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:53:15 +0330 Subject: [PATCH 41/46] Update connector.py --- w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py index 0eb3fe6d3e..8cb5cac34e 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py @@ -41,7 +41,7 @@ def connect(self): args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) - except Exception as msg: + except Exception, msg: raise SqlmapConnectionException(msg[0]) try: From e010cd620231d5411143e49b60563a1bbdb9758a Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:54:03 +0330 Subject: [PATCH 42/46] Update connector.py --- .../attack/db/sqlmap/plugins/dbms/hsqldb/connector.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py index 8cb5cac34e..82286793fd 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/dbms/hsqldb/connector.py @@ -51,7 +51,7 @@ def connect(self): connection_string, str(self.user), str(self.password)) - except Exception as msg: + except Exception, msg: raise SqlmapConnectionException(msg[0]) self.initCursor() @@ -60,7 +60,7 @@ def connect(self): def fetchall(self): try: return self.cursor.fetchall() - except Exception as msg: + except Exception, msg: logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) return None @@ -70,7 +70,7 @@ def execute(self, query): try: self.cursor.execute(query) retVal = True - except Exception as msg: #todo fix with specific error + except Exception, msg: #todo fix with specific error logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) self.connector.commit() From 26e6cf5e62a2ffe044b6804b709550835d6eba76 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:54:20 +0330 Subject: [PATCH 43/46] Update connector.py --- w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py index 96c9c78b43..05fe564cbb 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/connector.py @@ -50,7 +50,7 @@ def close(self): self.cursor.close() if self.connector: self.connector.close() - except Exception as msg: + except Exception, msg: logger.debug(msg) finally: self.closed() From 3d8bc4d451491ce685830731833a9a6b61486eb6 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:54:41 +0330 Subject: [PATCH 44/46] Update custom.py --- w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py index f4671da085..92581220ae 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/custom.py @@ -70,7 +70,7 @@ def sqlQuery(self, query): output = NULL - except SqlmapNoneDataException as ex: + except SqlmapNoneDataException, ex: logger.warn(ex) return output From 92d1b588b8cebfdc5e1a22c096da3957bb20fe01 Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:55:20 +0330 Subject: [PATCH 45/46] Update entries.py --- w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py b/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py index d606dbf07f..a4e877e4a6 100644 --- a/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py +++ b/w3af/plugins/attack/db/sqlmap/plugins/generic/entries.py @@ -422,13 +422,13 @@ def dumpTable(self, foundData=None): "db": safeSQLIdentificatorNaming(conf.db)} try: attackDumpedTable() - except (IOError, OSError) as ex: + except (IOError, OSError), ex: errMsg = "an error occurred while attacking " errMsg += "table dump ('%s')" % getSafeExString(ex) logger.critical(errMsg) conf.dumper.dbTableValues(kb.data.dumpedTable) - except SqlmapConnectionException as ex: + except SqlmapConnectionException, ex: errMsg = "connection exception detected in dumping phase " errMsg += "('%s')" % getSafeExString(ex) logger.critical(errMsg) From 5cb2688a9e1d55cefb665d236c6c75609add6c6b Mon Sep 17 00:00:00 2001 From: hougomartim Date: Wed, 30 Oct 2019 09:55:45 +0330 Subject: [PATCH 46/46] Update beautifulsoup.py --- .../attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py b/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py index e700d3de05..c088fb0b3b 100644 --- a/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py +++ b/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py @@ -1836,7 +1836,7 @@ def _convertFrom(self, proposed): u = self._toUnicode(markup, proposed) self.markup = u self.originalEncoding = proposed - except Exception as e: + except Exception, e: # print "That didn't work!" # print e return None