From 9c924e9060485a37a5de5d44883e67b36fa3baf1 Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Tue, 15 Jun 2021 12:06:26 +0200 Subject: [PATCH] inql.*: stop GraphiQL server on extension unload - inql.actions.sendto: stop server included in this class - inql.burp_ext.generator_tab: forward a stop message to the http_mutator included in the tab - inql.burp_ext.extender: forward a stop message to the generator_tab on extension unload --- inql/actions/sendto.py | 6 +++++- inql/burp_ext/extender.py | 1 + inql/burp_ext/generator_tab.py | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/inql/actions/sendto.py b/inql/actions/sendto.py index ee145ce..f2b4f55 100644 --- a/inql/actions/sendto.py +++ b/inql/actions/sendto.py @@ -155,4 +155,8 @@ def send_to_graphiql(self, host, payload): URLOpener().open(self.get_graphiql_target( self._server.server_port, host, content['query'] if 'query' in content else None, - content['variables'] if 'variables' in content else None)) \ No newline at end of file + content['variables'] if 'variables' in content else None)) + + def stop(self): + self._server.shutdown() + self._server.socket.close() \ No newline at end of file diff --git a/inql/burp_ext/extender.py b/inql/burp_ext/extender.py index 5bf8782..5a8a8a8 100644 --- a/inql/burp_ext/extender.py +++ b/inql/burp_ext/extender.py @@ -57,3 +57,4 @@ def extensionUnloaded(self): shutil.rmtree(self._tmpdir, ignore_errors=False, onerror=None) stop() self._tab.save() + self._tab.stop() diff --git a/inql/burp_ext/generator_tab.py b/inql/burp_ext/generator_tab.py index 2bab8e8..1670c8e 100644 --- a/inql/burp_ext/generator_tab.py +++ b/inql/burp_ext/generator_tab.py @@ -50,6 +50,7 @@ def getUiComponent(self): http_mutator = HTTPMutator( callbacks=self._callbacks, helpers=self._helpers, overrideheaders=overrideheaders) + self.http_mutator = http_mutator repeater_sender = SendToAction(omnimenu=repeater_omnimenu, has_host=http_mutator.has_host, send_to=http_mutator.send_to_repeater) @@ -113,4 +114,7 @@ def save(self): try: self._callbacks.saveExtensionSetting(self.panel.__class__.__name__, self.panel.state()) except: - print("Cannot save state!") \ No newline at end of file + print("Cannot save state!") + + def stop(self): + self.http_mutator.stop() \ No newline at end of file