diff --git a/frontend/package.json b/frontend/package.json index 2a722ea95..183dc34fc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "ofrak-app", - "version": "0.6.0", + "version": "2.1.2", "description": "The graphical front-end for OFRAK.", "homepage": "https://ofrak.com", "private": true, diff --git a/frontend/src/FileBrowser.svelte b/frontend/src/FileBrowser.svelte new file mode 100644 index 000000000..15ee298ad --- /dev/null +++ b/frontend/src/FileBrowser.svelte @@ -0,0 +1,86 @@ + + + + +
+ {#if !dragging} + + {:else} + Drop the files to upload. + {/if} +
diff --git a/frontend/src/StartView.svelte b/frontend/src/StartView.svelte index e5c53b416..8844b322b 100644 --- a/frontend/src/StartView.svelte +++ b/frontend/src/StartView.svelte @@ -4,6 +4,14 @@ font-weight: bold; color: inherit; font-size: xxx-large; + line-height: 1; + margin: 0; + max-width: 50%; + text-align: center; + } + + form { + max-width: 50%; } .center { @@ -55,31 +63,70 @@ width: calc(100% - 6em); height: calc(100% - 6em); } + + input[type="file"] { + display: none; + } + + .maxwidth { + max-width: 50%; + width: 50%; + margin: 1em 0; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + } + + .clickable { + cursor: pointer; + } + + .underline { + text-decoration: underline; + } {#if !tryHash} +
{#if !dragging}

Drag in a file to analyze

+

Click anwyhere to browse your computer

{:else}

Drop the file!

{/if} + + +
+ + OR + +
+ {#await preExistingRootsPromise} {:then preExistingRootResources} -
- - - -
+ {#if preExistingRootsPromise && preExistingRootsPromise.length > 0} +
+ + + +
+ {:else} + No resources loaded yet. + {/if} {:catch}

Failed to get any pre-existing root resources!

The back end server may be down.

diff --git a/frontend/src/TextDivider.svelte b/frontend/src/TextDivider.svelte new file mode 100644 index 000000000..50043e84a --- /dev/null +++ b/frontend/src/TextDivider.svelte @@ -0,0 +1,32 @@ + + + + +
+
+ +
+
diff --git a/frontend/src/helpers.js b/frontend/src/helpers.js index cbf7579e2..39e152e31 100644 --- a/frontend/src/helpers.js +++ b/frontend/src/helpers.js @@ -52,13 +52,31 @@ export function buf2hex(buffer, joinchar) { .join(joinchar ? joinchar : ""); } -/** +/*** * Asynchronously sleep for a certain number of milliseconds. */ export async function sleep(ms) { await new Promise((resolve) => setTimeout(resolve, ms)); } +/** + * Turn a number of bytes into a text-based file size + */ +export function numBytesToQuantity(bytes) { + if (bytes < 1024) { + return `${bytes}B`; + } else if (bytes < 1024 * 1024) { + return `${(bytes / 1024).toFixed(2)}KB`; + } else if (bytes < 1024 * 1024 * 1024) { + return `${(bytes / (1024 * 1024)).toFixed(2)}MB`; + } else if (bytes < 1024 * 1024 * 1024 * 1024) { + return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`; + } else { + // TODO if necessary + return `${bytes}B`; + } +} + /*** * Evaluate an input arithmetic string consisting of (possibly hex) numbers * and the given binary operators using the Shunting Yard algorithm diff --git a/ofrak_core/CHANGELOG.md b/ofrak_core/CHANGELOG.md index 4fc9bc552..fcaee5bed 100644 --- a/ofrak_core/CHANGELOG.md +++ b/ofrak_core/CHANGELOG.md @@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fix bug in `SegmentInjectorModifier` that resulted in deleting more resources than necessary [#200](https://github.com/redballoonsecurity/ofrak/pull/200) ### Added -- Replace unofficial p7zip with official 7zip package. +- Replace unofficial p7zip with official 7zip package +- File browser dialog in the GUI - Area in the GUI to jump to a given data offset - GUI command line now has a flag to not automatically open the browser