Page MenuHomeDevCentral

D3976.id10404.diff
No OneTemporary

D3976.id10404.diff

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 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,19 @@
+resolve_hash.py is a Terminator plugin to call Resolve hash as URL handler for longer hashes.
+
+How to install :
+First we need terminator terminal : "sudo apt-get install terminator"
+then we need a python virtual environement : "source env/bin/activate"
+The plugin file must be placed in: " ~/.config/terminator/plugins/"
+The plugin needs "resolve-hash" module/dependancies 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,39 @@
+# ---------------------------------------------------------------
+# Resolve hash
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: Terminator plugin to call Resolve hash as
+# URL handler for longer hashes
+# License: BSD-2-Clause
+# ---------------------------------------------------------------
+
+from terminatorlib.plugin import URLHandler
+
+from resolvehash.resolvehash import parse_config, find_hash
+
+AVAILABLE = ["ResolveHashURLHandler"]
+
+
+class ResolveHashURLHandler(URLHandler):
+ capabilities = ["url_handler"]
+ handler_name = "resolve_hash"
+ name = "Nasqueron Resolve Hash"
+
+ # Long enough hexadecimal expressions are good hash candidates
+ match = r"\b[0-9a-f]{7,40}\b"
+
+ def __init__(self):
+ URLHandler.__init__(self)
+ self.config = parse_config()
+
+ def callback(self, needle_hash):
+ try:
+ final_url = find_hash(self.config, needle_hash)
+
+ if final_url.startswith("http"):
+ return final_url
+
+ except Exception:
+ pass
+
+ return None

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 17, 04:49 (15 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3538793
Default Alt Text
D3976.id10404.diff (2 KB)

Event Timeline