# HG changeset patch # User Oliver Maurhart # Date 1411987611 -7200 # Node ID 107dc235508f11f6efc4149cc58fdc087f88f82f # Parent e68561e69f8659d94dd9e5f93e0e6294c9c89529 added tray client termination support for uninstall diff -r e68561e69f86 -r 107dc235508f OpenSecurity.iss --- a/OpenSecurity.iss Mon Sep 29 11:55:16 2014 +0200 +++ b/OpenSecurity.iss Mon Sep 29 12:46:51 2014 +0200 @@ -65,6 +65,7 @@ [UninstallRun] ; When uninstalling run this command prior +Filename: "{app}\python27\pythonw.exe"; Parameters: """{app}\bin\terminate_client_tray.pyw"" stop"; WorkingDir: "{app}"; StatusMsg: "Stopping the OpenSecurity Client Tray Service"; Flags: runascurrentuser Filename: "{app}\python27\pythonw.exe"; Parameters: """{app}\bin\opensecurity_service.pyw"" stop"; WorkingDir: "{app}"; StatusMsg: "Stopping the OpenSecurity Service"; Flags: runascurrentuser Filename: "{app}\python27\pythonw.exe"; Parameters: """{app}\bin\opensecurity_service.pyw"" remove"; WorkingDir: "{app}"; StatusMsg: "Removing the OpenSecurity Service"; Flags: runascurrentuser diff -r e68561e69f86 -r 107dc235508f OpenSecurity/bin/opensecurity_client_restful_server.py --- a/OpenSecurity/bin/opensecurity_client_restful_server.py Mon Sep 29 11:55:16 2014 +0200 +++ b/OpenSecurity/bin/opensecurity_client_restful_server.py Mon Sep 29 12:46:51 2014 +0200 @@ -83,6 +83,7 @@ '/netmount', 'os_netmount', '/netumount', 'os_netumount', '/netcleanup', 'os_netcleanup', + '/quit', 'os_quit', '/', 'os_root' ) @@ -527,6 +528,20 @@ return res +class os_quit: + + """OpenSecurity '/quit' handler. + + Terminate the client REST server + """ + + def GET(self): + + stop() + return 'done' + + + class ProcessResultBouncer(threading.Thread): """A class to post the result of a given process - assuming it to be in JSON - to a REST Api.""" diff -r e68561e69f86 -r 107dc235508f OpenSecurity/bin/terminate_client_tray.pyw --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/bin/terminate_client_tray.pyw Mon Sep 29 12:46:51 2014 +0200 @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +# ------------------------------------------------------------ +# terminate the client tray +# +# Autor: Oliver Maurhart, +# +# Copyright (C) 2014 AIT Austrian Institute of Technology +# AIT Austrian Institute of Technology GmbH +# Donau-City-Strasse 1 | 1220 Vienna | Austria +# http://www.ait.ac.at +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# ------------------------------------------------------------ + + +# ------------------------------------------------------------ +# imports + +import urllib2 + + +# ------------------------------------------------------------ +# code + + +# start +if __name__ == "__main__": + + try: + + # TODO: HARDCODED ADDRESS OF OPENSECURITY CLIENT TRAY + browsing_vm = urllib2.urlopen('http://127.0.0.1:8090/quit').readline() + print('Called http://127.0.0.1:8090/quit') + + except Exception as e: + print('Failed: %s' % (e.message)) + +