diff --git a/README.md b/README.md index d174fd21..36f83407 100755 --- a/README.md +++ b/README.md @@ -103,4 +103,4 @@ CyberChef is released under the [Apache 2.0 Licence](https://www.apache.org/lice [8]: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn','%5C%5Cn',false)Conditional_Jump('1',false,'base64',10)To_Hex('Space')Return()Label('base64')To_Base64('A-Za-z0-9%2B/%3D')&input=U29tZSBkYXRhIHdpdGggYSAxIGluIGl0ClNvbWUgZGF0YSB3aXRoIGEgMiBpbiBpdA [9]: https://gchq.github.io/CyberChef/#recipe=Register('key%3D(%5B%5C%5Cda-f%5D*)',true,false)Find_/_Replace(%7B'option':'Regex','string':'.*data%3D(.*)'%7D,'$1',true,false,true)RC4(%7B'option':'Hex','string':'$R0'%7D,'Hex','Latin1')&input=aHR0cDovL21hbHdhcmV6LmJpei9iZWFjb24ucGhwP2tleT0wZTkzMmE1YyZkYXRhPThkYjdkNWViZTM4NjYzYTU0ZWNiYjMzNGUzZGIxMQ [10]: https://gchq.github.io/CyberChef/#recipe=Register('(.%7B32%7D)',true,false)Drop_bytes(0,32,false)AES_Decrypt(%7B'option':'Hex','string':'1748e7179bd56570d51fa4ba287cc3e5'%7D,%7B'option':'Hex','string':'$R0'%7D,'CTR','Hex','Raw',%7B'option':'Hex','string':''%7D)&input=NTFlMjAxZDQ2MzY5OGVmNWY3MTdmNzFmNWI0NzEyYWYyMGJlNjc0YjNiZmY1M2QzODU0NjM5NmVlNjFkYWFjNDkwOGUzMTljYTNmY2Y3MDg5YmZiNmIzOGVhOTllNzgxZDI2ZTU3N2JhOWRkNmYzMTFhMzk0MjBiODk3OGU5MzAxNGIwNDJkNDQ3MjZjYWVkZjU0MzZlYWY2NTI0MjljMGRmOTRiNTIxNjc2YzdjMmNlODEyMDk3YzI3NzI3M2M3YzcyY2Q4OWFlYzhkOWZiNGEyNzU4NmNjZjZhYTBhZWUyMjRjMzRiYTNiZmRmN2FlYjFkZGQ0Nzc2MjJiOTFlNzJjOWU3MDlhYjYwZjhkYWY3MzFlYzBjYzg1Y2UwZjc0NmZmMTU1NGE1YTNlYzI5MWNhNDBmOWU2MjlhODcyNTkyZDk4OGZkZDgzNDUzNGFiYTc5YzFhZDE2NzY3NjlhN2MwMTBiZjA0NzM5ZWNkYjY1ZDk1MzAyMzcxZDYyOWQ5ZTM3ZTdiNGEzNjFkYTQ2OGYxZWQ1MzU4OTIyZDJlYTc1MmRkMTFjMzY2ZjMwMTdiMTRhYTAxMWQyYWYwM2M0NGY5NTU3OTA5OGExNWUzY2Y5YjQ0ODZmOGZmZTljMjM5ZjM0ZGU3MTUxZjZjYTY1MDBmZTRiODUwYzNmMWMwMmU4MDFjYWYzYTI0NDY0NjE0ZTQyODAxNjE1YjhmZmFhMDdhYzgyNTE0OTNmZmRhN2RlNWRkZjMzNjg4ODBjMmI5NWIwMzBmNDFmOGYxNTA2NmFkZDA3MWE2NmNmNjBlNWY0NmYzYTIzMGQzOTdiNjUyOTYzYTIxYTUzZg - [11]: https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':'3a'%7D,'',false)To_Hexdump(16,false,false)&input=VGhlIGFuc3dlciB0byB0aGUgdWx0aW1hdGUgcXVlc3Rpb24gb2YgbGlmZSwgdGhlIFVuaXZlcnNlLCBhbmQgZXZlcnl0aGluZyBpcyA0Mi4 + [11]: https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':'3a'%7D,'Standard',false)To_Hexdump(16,false,false)&input=VGhlIGFuc3dlciB0byB0aGUgdWx0aW1hdGUgcXVlc3Rpb24gb2YgbGlmZSwgdGhlIFVuaXZlcnNlLCBhbmQgZXZlcnl0aGluZyBpcyA0Mi4 diff --git a/src/web/InputWaiter.js b/src/web/InputWaiter.js index 8ae452fa..bf17eff6 100755 --- a/src/web/InputWaiter.js +++ b/src/web/InputWaiter.js @@ -1,4 +1,5 @@ import LoaderWorker from "worker-loader?inline&fallback=false!./LoaderWorker.js"; +import Utils from "../core/Utils.js"; /** @@ -263,11 +264,28 @@ InputWaiter.prototype.handleLoaderMessage = function(e) { if (r.hasOwnProperty("fileBuffer")) { log.debug("Input file loaded"); this.fileBuffer = r.fileBuffer; + this.displayFilePreview(); window.dispatchEvent(this.manager.statechange); } }; +/** + * Shows a chunk of the file in the input behind the file overlay. + */ +InputWaiter.prototype.displayFilePreview = function() { + const inputText = document.getElementById("input-text"), + fileSlice = this.fileBuffer.slice(0, 2048); + + inputText.style.overflow = "hidden"; + inputText.classList.add("blur"); + inputText.value = Utils.printable(Utils.arrayBufferToStr(fileSlice)); + if (this.fileBuffer.byteLength > 2048) { + inputText.value += "[truncated]"; + } +}; + + /** * Handler for file close events. */ @@ -275,6 +293,9 @@ InputWaiter.prototype.closeFile = function() { if (this.loaderWorker) this.loaderWorker.terminate(); this.fileBuffer = null; document.getElementById("input-file").style.display = "none"; + const inputText = document.getElementById("input-text"); + inputText.style.overflow = "auto"; + inputText.classList.remove("blur"); }; diff --git a/src/web/OutputWaiter.js b/src/web/OutputWaiter.js index f86274bb..db6d8cec 100755 --- a/src/web/OutputWaiter.js +++ b/src/web/OutputWaiter.js @@ -128,6 +128,13 @@ OutputWaiter.prototype.setFile = function(buf) { fileOverlay.style.display = "block"; fileSize.textContent = file.size.toLocaleString() + " bytes"; + + // Display preview slice in the background + const outputText = document.getElementById("output-text"), + fileSlice = this.dishBuffer.slice(0, 2048); + + outputText.classList.add("blur"); + outputText.value = Utils.printable(Utils.arrayBufferToStr(fileSlice)); }; @@ -137,6 +144,7 @@ OutputWaiter.prototype.setFile = function(buf) { OutputWaiter.prototype.closeFile = function() { this.dishBuffer = null; document.getElementById("output-file").style.display = "none"; + document.getElementById("output-text").classList.remove("blur"); }; @@ -163,6 +171,7 @@ OutputWaiter.prototype.displayFileSlice = function() { sliceTo = parseInt(sliceToEl.value, 10), str = Utils.arrayBufferToStr(this.dishBuffer.slice(sliceFrom, sliceTo)); + document.getElementById("output-text").classList.remove("blur"); showFileOverlay.style.display = "block"; this.set(str, "string", new Date().getTime() - startTime, true); }; @@ -177,6 +186,7 @@ OutputWaiter.prototype.showFileOverlayClick = function(e) { const outputFile = document.getElementById("output-file"), showFileOverlay = e.target; + document.getElementById("output-text").classList.add("blur"); outputFile.style.display = "block"; showFileOverlay.style.display = "none"; this.setOutputInfo(this.dishBuffer.byteLength, null, 0); diff --git a/src/web/html/index.html b/src/web/html/index.html index de439577..22877fd7 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -183,8 +183,9 @@
- +
+
@@ -218,9 +219,10 @@
- +
+
@@ -233,7 +235,7 @@
to
- +
diff --git a/src/web/stylesheets/layout/_io.css b/src/web/stylesheets/layout/_io.css index c93c800b..1e58a7e5 100644 --- a/src/web/stylesheets/layout/_io.css +++ b/src/web/stylesheets/layout/_io.css @@ -84,10 +84,17 @@ top: 0; width: 100%; height: 100%; - background-color: var(--title-background-colour); display: none; } +.file-overlay { + position: absolute; + opacity: 0.8; + background-color: var(--title-background-colour); + width: 100%; + height: 100%; +} + #show-file-overlay { position: absolute; right: 15px;