summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Lindvall2020-06-12 19:12:57 +0200
committerMarius Lindvall2020-06-12 19:12:57 +0200
commit34ca41a689b632a18ef4ed7ece4f3bfa73a318ed (patch)
tree97ae72ed9c56867185b3fa639928ed8f4ff7530f
downloadaur-34ca41a689b632a18ef4ed7ece4f3bfa73a318ed.tar.gz
Initial push
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD53
-rw-r--r--cyberchef.desktop9
-rw-r--r--cyberchef.sh2
-rw-r--r--main.js73
-rw-r--r--prompt.js6
6 files changed, 171 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..ad7e98d58b77
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = cyberchef-electron
+ pkgdesc = The Cyber Swiss Army Knife (unofficial Electron wrapper)
+ pkgver = 9.21.0
+ pkgrel = 1
+ url = https://github.com/gchq/CyberChef
+ arch = any
+ license = Apache
+ makedepends = unzip
+ depends = electron
+ noextract = CyberChef_v9.21.0.zip
+ options = !strip
+ source = https://github.com/gchq/CyberChef/releases/download/v9.21.0/CyberChef_v9.21.0.zip
+ source = https://raw.githubusercontent.com/gchq/CyberChef/master/src/web/static/images/logo/cyberchef_hat_512.png
+ source = https://raw.githubusercontent.com/gchq/CyberChef/master/src/web/static/images/logo/cyberchef_hat.svg
+ source = main.js
+ source = prompt.js
+ source = cyberchef.sh
+ source = cyberchef.desktop
+ sha256sums = 5a53c4e0bee1303ef73210a6e2fbb3f5151d4ad09cc3681581c6c35b15584126
+ sha256sums = 0e936b556d83975e3ecf02e45433c46bf63fa303a31147fd8599f22fcb2d61e1
+ sha256sums = e6582ba4f0f6141f62f6214420abcf524475f5a887e3aaee6169974f78462589
+ sha256sums = a48ce4a789367ddb66ff49bcdb12f5f7c540581b4c78c93e3a3cb6440d60ade8
+ sha256sums = e61bcdb9df37f14deea5fefcbae40eb4a3609887946ac08651a1b65e434c7042
+ sha256sums = a1d095d83601902f9ec741f6586429d9f1f4052187f2aee022e6cfcea1f9cf3a
+ sha256sums = 8700203f930a1fac32f69f4b8f8e01fd832444a29ff7f73cbde66194f2350155
+
+pkgname = cyberchef-electron
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..2b7044bec75b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,53 @@
+# Maintainer: Marius Lindvall <marius {cat} varden {dog} info>
+pkgname=cyberchef-electron
+pkgver=9.21.0
+pkgrel=1
+pkgdesc="The Cyber Swiss Army Knife (unofficial Electron wrapper)"
+arch=('any')
+url="https://github.com/gchq/CyberChef"
+license=('Apache')
+depends=('electron')
+makedepends=('unzip')
+conflicts=()
+source=("https://github.com/gchq/CyberChef/releases/download/v${pkgver}/CyberChef_v${pkgver}.zip"
+ "https://raw.githubusercontent.com/gchq/CyberChef/master/src/web/static/images/logo/cyberchef_hat_512.png"
+ "https://raw.githubusercontent.com/gchq/CyberChef/master/src/web/static/images/logo/cyberchef_hat.svg"
+ "main.js"
+ "prompt.js"
+ "cyberchef.sh"
+ "cyberchef.desktop")
+sha256sums=('5a53c4e0bee1303ef73210a6e2fbb3f5151d4ad09cc3681581c6c35b15584126'
+ '0e936b556d83975e3ecf02e45433c46bf63fa303a31147fd8599f22fcb2d61e1'
+ 'e6582ba4f0f6141f62f6214420abcf524475f5a887e3aaee6169974f78462589'
+ 'a48ce4a789367ddb66ff49bcdb12f5f7c540581b4c78c93e3a3cb6440d60ade8'
+ 'e61bcdb9df37f14deea5fefcbae40eb4a3609887946ac08651a1b65e434c7042'
+ 'a1d095d83601902f9ec741f6586429d9f1f4052187f2aee022e6cfcea1f9cf3a'
+ '8700203f930a1fac32f69f4b8f8e01fd832444a29ff7f73cbde66194f2350155')
+options=(!strip)
+noextract=("CyberChef_v${pkgver}.zip")
+
+prepare() {
+ unzip -o "CyberChef_v${pkgver}.zip" -d "CyberChef_v${pkgver}"
+ cd "${srcdir}/CyberChef_v${pkgver}"
+ mv "CyberChef_v${pkgver}.html" "index.html"
+ cat << EOF > package.json
+{
+ "name": "$pkgname",
+ "version": "$pkgver",
+ "description": "$pkgdesc",
+ "main": "main.js"
+}
+EOF
+}
+
+package() {
+ cd "${srcdir}/CyberChef_v${pkgver}"
+ mkdir -p "${pkgdir}/usr/lib/${pkgname}"
+ cp -r * "${pkgdir}/usr/lib/${pkgname}"
+ install -Dm644 "${srcdir}/main.js" "${pkgdir}/usr/lib/${pkgname}/main.js"
+ install -Dm644 "${srcdir}/prompt.js" "${pkgdir}/usr/lib/${pkgname}/prompt.js"
+ install -Dm644 "${srcdir}/cyberchef_hat_512.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/cyberchef.png"
+ install -Dm644 "${srcdir}/cyberchef_hat.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/cyberchef.svg"
+ install -Dm644 "${srcdir}/cyberchef.desktop" "${pkgdir}/usr/share/applications/cyberchef.desktop"
+ install -Dm755 "${srcdir}/cyberchef.sh" "${pkgdir}/usr/bin/cyberchef"
+}
diff --git a/cyberchef.desktop b/cyberchef.desktop
new file mode 100644
index 000000000000..4f7e94bc47a3
--- /dev/null
+++ b/cyberchef.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=CyberChef
+Comment=The Cyber Swiss Army Knife
+Icon=cyberchef
+Exec=cyberchef
+Terminal=false
+Categories=Utility;Development;
+StartupWMClass=CyberChef
diff --git a/cyberchef.sh b/cyberchef.sh
new file mode 100644
index 000000000000..85240a40f256
--- /dev/null
+++ b/cyberchef.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec electron /usr/lib/cyberchef-electron/ "$@"
diff --git a/main.js b/main.js
new file mode 100644
index 000000000000..e69a6f2842d6
--- /dev/null
+++ b/main.js
@@ -0,0 +1,73 @@
+const {app, BrowserWindow, ipcMain} = require('electron');
+const path = require('path');
+
+function createWindow () {
+ const mainWindow = new BrowserWindow({
+ width: 800,
+ height: 600,
+ webPreferences: {
+ preload: path.join(__dirname, 'prompt.js')
+ }
+ });
+
+ mainWindow.loadFile('index.html');
+
+ // Electon does not support prompt()!
+ // Using prompt from https://github.com/konsumer/electron-prompt
+ var promptResponse;
+ ipcMain.on('prompt', function(eventRet, arg) {
+ promptResponse = null;
+ var promptWindow = new BrowserWindow({
+ width: 300,
+ height: 100,
+ show: false,
+ resizable: false,
+ movable: false,
+ alwaysOnTop: true,
+ frame: false,
+ webPreferences: {
+ nodeIntegration: true
+ }
+ });
+ arg.val = arg.val || '';
+ const promptHtml =
+ '<script>\
+ function ok() {\
+ require(\'electron\').ipcRenderer.send(\'prompt-response\', document.getElementById(\'val\').value);\
+ window.close();\
+ }\
+ </script>\
+ <label for="val">' + arg.title + '</label>\
+ <input onkeypress="if (window.event.which == 10 || window.event.which == 13) {ok();}" id="val" value="' + arg.val + '" autofocus />\
+ <button onclick="ok();">Ok</button>\
+ <button onclick="window.close()">Cancel</button>\
+ <style>body {font-family: sans-serif;} button {float:right; margin-left: 10px;} label,input {margin-bottom: 10px; width: 100%; display:block;}</style>\
+ <script>document.getElementById("val").select();</script>';
+ promptWindow.loadURL('data:text/html,' + promptHtml);
+ promptWindow.show();
+ promptWindow.on('closed', function() {
+ eventRet.returnValue = promptResponse;
+ promptWindow = null;
+ });
+ })
+ ipcMain.on('prompt-response', function(event, arg) {
+ if (arg === '') arg = null;
+ promptResponse = arg
+ })
+}
+
+app.whenReady().then(() => {
+ createWindow();
+ app.on('activate', function() {
+ // On macOS it's common to re-create a window in the app when the
+ // dock icon is clicked and there are no other windows open.
+ if (BrowserWindow.getAllWindows().length === 0) createWindow();
+ })
+})
+
+// Quit when all windows are closed, except on macOS. There, it's common
+// for applications and their menu bar to stay active until the user quits
+// explicitly with Cmd + Q.
+app.on('window-all-closed', function() {
+ if (process.platform !== 'darwin') app.quit();
+});
diff --git a/prompt.js b/prompt.js
new file mode 100644
index 000000000000..260744014c41
--- /dev/null
+++ b/prompt.js
@@ -0,0 +1,6 @@
+// put this preload for main-window to give it prompt()
+const ipcRenderer = require('electron').ipcRenderer;
+
+window.prompt = function(title, val) {
+ return ipcRenderer.sendSync('prompt', {title, val})
+};