mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
The raw, unpresented dish is now returned to the app after baking, where it can be retrieved as various different data types.
This commit is contained in:
parent
30aa4e05ef
commit
76a066ab74
12 changed files with 163 additions and 73 deletions
|
@ -7,7 +7,7 @@
|
|||
import utf8 from "utf8";
|
||||
import moment from "moment-timezone";
|
||||
import {fromBase64} from "./lib/Base64";
|
||||
import {toHexFast, fromHex} from "./lib/Hex";
|
||||
import {fromHex} from "./lib/Hex";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -833,39 +833,24 @@ class Utils {
|
|||
|
||||
const formatFile = async function(file, i) {
|
||||
const buff = await Utils.readFile(file);
|
||||
const fileStr = Utils.arrayBufferToStr(buff.buffer);
|
||||
const blob = new Blob(
|
||||
[buff],
|
||||
{type: "octet/stream"}
|
||||
);
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
const viewFileElem = `<a href='#collapse${i}'
|
||||
class='collapsed'
|
||||
data-toggle='collapse'
|
||||
aria-expanded='true'
|
||||
aria-controls='collapse${i}'
|
||||
title="Show/hide contents of '${Utils.escapeHtml(file.name)}'">👁️</a>`;
|
||||
|
||||
const downloadFileElem = `<a href='${blobUrl}'
|
||||
title='Download ${Utils.escapeHtml(file.name)}'
|
||||
download='${Utils.escapeHtml(file.name)}'>💾</a>`;
|
||||
|
||||
const hexFileData = toHexFast(buff);
|
||||
|
||||
const switchToInputElem = `<a href='#switchFileToInput${i}'
|
||||
class='file-switch'
|
||||
title='Move file to input as hex'
|
||||
fileValue='${hexFileData}'>⇧</a>`;
|
||||
|
||||
const html = `<div class='panel panel-default' style='white-space: normal;'>
|
||||
<div class='panel-heading' role='tab' id='heading${i}'>
|
||||
<h4 class='panel-title'>
|
||||
<div>
|
||||
${Utils.escapeHtml(file.name)}
|
||||
${viewFileElem}
|
||||
${downloadFileElem}
|
||||
${switchToInputElem}
|
||||
<a href='#collapse${i}'
|
||||
class='collapsed'
|
||||
data-toggle='collapse'
|
||||
aria-expanded='true'
|
||||
aria-controls='collapse${i}'
|
||||
title="Show/hide contents of '${Utils.escapeHtml(file.name)}'">${Utils.escapeHtml(file.name)}</a>
|
||||
<a href='${URL.createObjectURL(blob)}'
|
||||
title='Download ${Utils.escapeHtml(file.name)}'
|
||||
download='${Utils.escapeHtml(file.name)}'>💾</a>
|
||||
<span class='pull-right'>
|
||||
${file.size.toLocaleString()} bytes
|
||||
</span>
|
||||
|
@ -875,7 +860,7 @@ class Utils {
|
|||
<div id='collapse${i}' class='panel-collapse collapse'
|
||||
role='tabpanel' aria-labelledby='heading${i}'>
|
||||
<div class='panel-body'>
|
||||
<pre><code>${Utils.escapeHtml(fileStr)}</code></pre>
|
||||
<pre><code>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue