-
Notifications
You must be signed in to change notification settings - Fork 152
GUI vaddr search #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rbs-jacob
merged 14 commits into
redballoonsecurity:master
from
EdwardLarson:feature/gui_vaddr_search
Oct 17, 2022
Merged
GUI vaddr search #70
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
efd415a
add angr and no backend as options for GUI, fixup some frontend dev t…
Edward-Larson 62c6e58
remove docs from development frontend image (they are hosted on ofrak…
Edward-Larson 37140cd
add test for Angr project serializer
Edward-Larson d1d73ca
remove mkdocs serve command
Edward-Larson 0ac8261
add new route to search for resources matching a vaddr or range of va…
Edward-Larson 2b8e8dc
initial implementation of search feature in frontend
Edward-Larson 901d2f2
working search frontend-backend implementation (results not displayed)
Edward-Larson 59d7147
display search results in the GUI
Edward-Larson a884b11
lint frontend code
Edward-Larson 14781b2
Merge branch 'master' into feature/gui_vaddr_search
Edward-Larson 97e13f8
sort search results, uncollapse ancestors of selected search result, …
Edward-Larson b054ef2
apply suggestions from PR
Edward-Larson 9edb3e7
add resource caption to SearchView as well as the unique ID
Edward-Larson 18f54dd
satisfy linter....
Edward-Larson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| <style> | ||
| button { | ||
| padding-top: 0.5em; | ||
| padding-bottom: 0.5em; | ||
| padding-left: 1em; | ||
| padding-right: 1em; | ||
| } | ||
|
|
||
| button:hover, | ||
| button:focus { | ||
| outline: none; | ||
| box-shadow: inset 1px 1px 0 var(--main-fg-color), | ||
| inset -1px -1px 0 var(--main-fg-color); | ||
| } | ||
|
|
||
| button:active { | ||
| box-shadow: inset 2px 2px 0 var(--main-fg-color), | ||
| inset -2px -2px 0 var(--main-fg-color); | ||
|
EdwardLarson marked this conversation as resolved.
|
||
| } | ||
|
|
||
| .container { | ||
| min-height: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex-wrap: nowrap; | ||
| justify-content: center; | ||
| align-items: stretch; | ||
| align-content: center; | ||
| } | ||
|
|
||
| .inputs { | ||
| flex-grow: 1; | ||
| } | ||
|
|
||
| .inputs *:first-child { | ||
| margin-top: 0; | ||
| } | ||
|
|
||
| .actions { | ||
| margin-top: 2em; | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: nowrap; | ||
| justify-content: space-evenly; | ||
| align-items: flex-start; | ||
| align-content: flex-start; | ||
| } | ||
|
|
||
| input { | ||
| background: inherit; | ||
| color: inherit; | ||
| border: none; | ||
| border-bottom: 1px solid white; | ||
| flex-grow: 1; | ||
| margin-left: 1ch; | ||
| } | ||
|
|
||
| input:focus { | ||
| outline: none; | ||
| box-shadow: inset 0 -1px 0 var(--main-fg-color); | ||
| } | ||
|
|
||
| /* Adapted from: https://moderncss.dev/pure-css-custom-checkbox-style/ */ | ||
| input[type="checkbox"] { | ||
| flex-grow: 0; | ||
| margin-left: 1ch; | ||
| } | ||
|
|
||
| label { | ||
| margin-bottom: 1em; | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: nowrap; | ||
| justify-content: space-evenly; | ||
| align-items: baseline; | ||
| align-content: center; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .row { | ||
| display: flex; | ||
| flex-direction: row; | ||
| flex-wrap: nowrap; | ||
| justify-content: space-evenly; | ||
| align-items: baseline; | ||
| align-content: center; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .error { | ||
| margin-top: 2em; | ||
| } | ||
|
|
||
| .treebox { | ||
| flex-grow: 1; | ||
| padding-left: 1em; | ||
| overflow-x: scroll; | ||
| white-space: nowrap; | ||
| text-align: left; | ||
| } | ||
| </style> | ||
|
|
||
| <script> | ||
| import { selected, selectedResource } from "./stores.js"; | ||
| import { calculator } from "./helpers"; | ||
| import ResourceTreeNode from "./ResourceTreeNode.svelte"; | ||
|
|
||
| export let modifierView, resourceNodeDataMap; | ||
| let searchInput, | ||
| searchRangeStartInput, | ||
| searchRangeEndInput, | ||
| rangeSearch = false, | ||
| results = [], | ||
| errorMessage; | ||
|
|
||
| const searchTarget = $selectedResource; | ||
|
|
||
| function refreshResource() { | ||
| // Force hex view refresh with colors | ||
| const originalSelected = $selected; | ||
| $selected = undefined; | ||
| $selected = originalSelected; | ||
| } | ||
|
|
||
| async function search() { | ||
| if (searchTarget) { | ||
| try { | ||
| if (rangeSearch) { | ||
| const searchRangeStartAddress = calculator.calculate( | ||
| searchRangeStartInput | ||
| ), | ||
| searchRangeEndAddress = calculator.calculate(searchRangeEndInput); | ||
|
|
||
| results = await searchTarget.search_for_vaddr( | ||
| searchRangeStartAddress, | ||
| searchRangeEndAddress | ||
| ); | ||
| } else { | ||
| const startAddress = calculator.calculate(searchInput); | ||
|
|
||
| results = await searchTarget.search_for_vaddr(startAddress, null); | ||
| } | ||
| } catch (err) { | ||
| try { | ||
| errorMessage = JSON.parse(err.message).message; | ||
| } catch (_) { | ||
| errorMessage = err.message; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| async function leave_view() { | ||
| if ($selectedResource !== undefined) { | ||
| const ancestors = await $selectedResource.get_ancestors(null); | ||
| for (const ancestor of ancestors) { | ||
| resourceNodeDataMap[ancestor.get_id()].collapsed = false; | ||
| } | ||
| } | ||
| modifierView = undefined; | ||
| } | ||
| </script> | ||
|
|
||
| <div class="container"> | ||
| <div class="inputs"> | ||
| <p> | ||
| Searching for descendants of {searchTarget.get_caption()} ({searchTarget.get_id()}) | ||
| whose virtual address matches a specific address or lies in a range of | ||
| addresses. | ||
| </p> | ||
| {#if rangeSearch} | ||
| <label> | ||
| Min virtual address: | ||
| <input type="text" bind:value="{searchRangeStartInput}" /> | ||
| </label> | ||
| <label> | ||
| Max virtual address: | ||
| <input type="text" bind:value="{searchRangeEndInput}" /> | ||
| </label> | ||
| {:else} | ||
| <label> | ||
| Virtual address: | ||
| <input type="text" bind:value="{searchInput}" /> | ||
| </label> | ||
| {/if} | ||
| <div class="row"> | ||
| <label> | ||
| Range | ||
| <input type="checkbox" bind:checked="{rangeSearch}" /> | ||
| </label> | ||
| </div> | ||
| {#if errorMessage} | ||
| <p class="error"> | ||
| Error: | ||
| {errorMessage} | ||
| </p> | ||
| {/if} | ||
| </div> | ||
| <div class="actions"> | ||
| <button on:click="{search}">Search</button> | ||
| <button on:click="{leave_view}">Cancel</button> | ||
| </div> | ||
| <div class="results"> | ||
| <p>Found {results.length} results</p> | ||
| </div> | ||
| {#each results as matched_resource} | ||
| <div class="resultsbox"> | ||
| <ResourceTreeNode | ||
| rootResource="{matched_resource}" | ||
| collapsed="false" | ||
| bind:resourceNodeDataMap | ||
| /> | ||
| </div> | ||
| {/each} | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.