From f18e7538bfc00e165f2d4c211d089f8fb266b5c1 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 15 Oct 2023 15:35:59 +0800 Subject: [PATCH] gnome 45 --- README.md | 2 -- eval-gjs@ramottamado.dev/extension.js | 17 ++++++++--------- eval-gjs@ramottamado.dev/metadata.json | 7 ++----- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index db97f1a..8f24290 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ This extension enables arbitrary code execution via `Eval()` dbus method. This means when you enable this extension, malicious apps, extensions or scripts can call the said dbus method and run malicious GJS codes on your machine. -The extension at https://extensions.gnome.org/extension/5952/eval-gjs/ was not uploaded nor maintained by me. **Please refrain from installing this extension at all.** - # Eval GJS GNOME Shell Extension As of GNOME 41, the dbus method `Eval()` is now restricted with `MetaContext:unsafe-mode` property (see this [commit](https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970/diffs?commit_id=f42df5995e08a89495e2f59a9ed89b5c03369bf8)). This extension provides unrestricted `Eval()` dbus method for running arbitrary code in the compositor. diff --git a/eval-gjs@ramottamado.dev/extension.js b/eval-gjs@ramottamado.dev/extension.js index 78e31e1..6fd6fb6 100644 --- a/eval-gjs@ramottamado.dev/extension.js +++ b/eval-gjs@ramottamado.dev/extension.js @@ -20,9 +20,11 @@ 'use strict'; -const { Gio, GLib, Meta } = imports.gi; - -const Main = imports.ui.main; +import Gio from 'gi://Gio' +import GLib from 'gi://GLib' +import Meta from 'gi://Meta' +import * as Main from 'resource:///org/gnome/shell/ui/main.js' +import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js' const EvalGjsIface = '' + @@ -35,8 +37,9 @@ const EvalGjsIface = ' ' + ''; -class EvalGjs { - constructor() { +export default class EvalGjs extends Extension { + constructor(metadata) { + super(metadata) this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(EvalGjsIface, this); } @@ -85,7 +88,3 @@ class EvalGjs { if (this._dbusImpl) this._dbusImpl.unexport(); } } - -function init() { - return new EvalGjs(); -} diff --git a/eval-gjs@ramottamado.dev/metadata.json b/eval-gjs@ramottamado.dev/metadata.json index 9b854ff..80d8f26 100644 --- a/eval-gjs@ramottamado.dev/metadata.json +++ b/eval-gjs@ramottamado.dev/metadata.json @@ -3,10 +3,7 @@ "description": "Evaluate GJS script through DBus", "uuid": "eval-gjs@ramottamado.dev", "shell-version": [ - "41", - "42", - "43", - "44" + "45" ], "url": "https://github.com/ramottamado/eval-gjs" -} \ No newline at end of file +}