From 836d2c942be8c22f0946006554f5233b5a2a201a Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 22 Sep 2016 12:57:48 +0300 Subject: Added input sanitation --- functions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'functions.py') diff --git a/functions.py b/functions.py index 6b76dc4..0d59e78 100644 --- a/functions.py +++ b/functions.py @@ -13,6 +13,9 @@ SERVICEDIR = '/Library/Services' def display_notification(msg, title='', subtitle=''): + msg = msg.replace('"', '\\"') + title = title.replace('"', '\\"') + subtitle = subtitle.replace('"', '\\"') osascript('display notification "{0}" with title "{1}" subtitle "{2}"'.format(msg, title, subtitle)) @@ -33,7 +36,7 @@ def exec_jar(path, user): if not os.path.exists(javapath): raise ValueError('Looks like your machine does not have Java installed') - subprocess.call(['launchctl', 'asuser', user, javapath, '-jar', path, '-silent']) + subprocess.call(['/bin/launchctl', 'asuser', user, javapath, '-jar', path, '-silent']) def osascript(s): @@ -181,7 +184,7 @@ def umount(path): """ Unmounts path """ - subprocess.call(['umount', path]) + subprocess.call(['/sbin/umount', path]) def enable_ard(username): -- cgit v1.2.3