Current Path: > > usr > lib > python3.6 > site-packages > tuned > > utils
Operation : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 Software : Apache Server IP : 198.54.126.42 | Your IP: 216.73.216.38 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 0 bytes | February 22 2024 12:23:28. | |
commands.py | File | 16622 bytes | March 11 2025 07:42:24. | |
config_parser.py | File | 1567 bytes | February 22 2024 12:23:28. | |
global_config.py | File | 3221 bytes | February 22 2024 12:23:28. | |
nettool.py | File | 5702 bytes | February 22 2024 12:23:28. | |
plugin_loader.py | File | 1795 bytes | February 22 2024 12:23:28. | |
polkit.py | File | 1432 bytes | February 22 2024 12:23:28. | |
profile_recommender.py | File | 5939 bytes | February 22 2024 12:23:28. |
import dbus import tuned.logs log = tuned.logs.get() class polkit(): def __init__(self): self._bus = dbus.SystemBus() self._proxy = self._bus.get_object('org.freedesktop.PolicyKit1', '/org/freedesktop/PolicyKit1/Authority', follow_name_owner_changes = True) self._authority = dbus.Interface(self._proxy, dbus_interface='org.freedesktop.PolicyKit1.Authority') def check_authorization(self, sender, action_id): """Check authorization, return codes: 1 - authorized 2 - polkit error, but authorized with fallback method 0 - unauthorized -1 - polkit error and unauthorized by the fallback method -2 - polkit error and unable to use the fallback method """ if sender is None or action_id is None: return False details = {} flags = 1 # AllowUserInteraction flag cancellation_id = "" # No cancellation id subject = ("system-bus-name", {"name" : sender}) try: ret = self._authority.CheckAuthorization(subject, action_id, details, flags, cancellation_id)[0] except (dbus.exceptions.DBusException, ValueError) as e: log.error("error querying polkit: %s" % e) # No polkit or polkit error, fallback to always allow root try: uid = self._bus.get_unix_user(sender) except dbus.exceptions.DBusException as e: log.error("error using fallback authorization method: %s" % e) return -2 if uid == 0: return 2 else: return -1 return 1 if ret else 0
SILENT KILLER Tool