Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24689937
D3994.id10373.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3994.id10373.diff
View Options
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -2,6 +2,12 @@
Allow to resolve a hash to a known URL representation.
+## Plugins
+
+This repository contains various tools and plugins:
+
+* **[Resolve Hash Plugin](./support/terminator/README.md)**: A Terminator plugin to handle hashes as URLs.
+
### Usage
`resolve-hash <hash>` outputs URL matching the hash
diff --git a/support/terminator/README.md b/support/terminator/README.md
new file mode 100644
--- /dev/null
+++ b/support/terminator/README.md
@@ -0,0 +1,18 @@
+resolve_hash.py is a Terminator plugin to call Resolve hash as URL handler for longer hashes.
+
+How to install :
+
+The plugin file must be placed in ~/.config/terminator/plugins/
+The plugin needs "resolve-hash" module to be installed on your system for it to work.
+
+## Prerequisites
+
+The plugin requires the `resolve-hash` module to be installed on your system
+```bash
+pip install resolve-hash
+
+mkdir -p ~/.config/terminator/plugins/
+cp resolve_hash.py ~/.config/terminator/plugins/
+
+- Restart terminator.
+- Go to preferences (Right click on Terminator) --> select plugins tab --> activate "resolve_hash" in the menu.
diff --git a/support/terminator/resolve_hash.py b/support/terminator/resolve_hash.py
new file mode 100644
--- /dev/null
+++ b/support/terminator/resolve_hash.py
@@ -0,0 +1,38 @@
+from terminatorlib.plugin import URLHandler
+import subprocess
+import os
+
+AVAILABLE = ['ResolveHashURLHandler']
+
+class ResolveHashURLHandler(URLHandler):
+ capabilities = ['url_handler']
+ handler_name = 'resolve_hash'
+ name = 'Nasqueron Resolve Hash'
+
+ # La regex pour détecter les hashs
+ match = r'\b[0-9a-f]{7,40}\b'
+
+ def callback(self, url):
+ hash_value = url.strip()
+
+ try:
+ #On définit le chemin absolu vers le module resolve-hash
+ script_path = os.path.expanduser ("~/bin/resolve-hash")
+
+ result = subprocess.check_output(
+ [script_path, hash_value],
+ stderr=subprocess.STDOUT,
+ text=True
+ )
+ #On nettoie le résultat
+ final_url = result.strip()
+
+ # Terminator n'ouvrira le navigateur que si on retourne une URL valide
+ if final_url.startswith('http'):
+ return final_url
+
+ except Exception as e:
+ # En cas d'erreur on ne retourne rien pour que Terminator ignore le clic
+ return None
+
+ return None
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 6, 12:09 (10 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3501559
Default Alt Text
D3994.id10373.diff (2 KB)
Attached To
Mode
D3994: Add Terminator plugin support for resolve-hash
Attached
Detach File
Event Timeline
Log In to Comment