added case for chrome proxy

This commit is contained in:
3bru 2023-03-20 18:33:00 +03:00
parent 0a8622f2f5
commit 99533487ff
3 changed files with 43 additions and 42 deletions

View file

@ -28,19 +28,20 @@ class Logout(AbstractPlugin):
def default_proxy_settings(self):
username = self.get_username()
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
def handle_mode(context):

View file

@ -76,7 +76,7 @@ class BrowserChrome(AbstractPlugin):
def write_to_chrome_proxy(self):
self.default_proxy_settings()
#self.default_proxy_settings()
proxy_type = "0"
proxy_preferences = json.loads(self.data)
username = self.get_username()
@ -121,22 +121,21 @@ class BrowserChrome(AbstractPlugin):
username = self.get_username()
if username is None:
username = self.get_active_user()
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
def handle_policy(profile_data, context):
browser = BrowserChrome(profile_data, context)
browser.handle_policy()

View file

@ -23,19 +23,20 @@ class Safe(AbstractPlugin):
self.default_proxy_settings()
def default_proxy_settings(self):
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(self.username))
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(self.username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(self.username))
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(self.username))
#self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(self.username))
def handle_mode(context):
init = Safe(context)