Spaces:
Running
Running
Edward J. Schwartz commited on
Commit ·
b727f11
0
Parent(s):
Create public Gradio frontend with private core submodule
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .dockerignoreAdded+11
- .gitignoreAdded+6
- .gitmodulesAdded+3
- .python-versionAdded+1
- DockerfileAdded+25
- README.mdAdded+102
- bootstrap.pyAdded+88
- coreAdded+1
- core-revision.jsonAdded+5
- demo/__init__.pyAdded+1
- demo/app.pyAdded+277
- demo/examples.pyAdded+47
- demo/presentation.pyAdded+118
- demo/session.pyAdded+104
- demo/workbench.cssAdded+62
- demo/workbench.jsAdded+32
- examples/COPYINGAdded+674
- examples/binaries/byte-swap.elfAdded
- examples/binaries/factorAdded
- examples/binaries/float-identity.elfAdded
- examples/binaries/format-string.elfAdded
- examples/binaries/ghidra-byte-swap.elfAdded
- examples/binaries/ghidra-float-identity.elfAdded
- examples/binaries/ghidra-format-string.elfAdded
- examples/binaries/ghidra-hello-goodbye.elfAdded
- examples/binaries/ghidra-hello-world.elfAdded
- examples/binaries/ghidra-identical.elfAdded
- examples/binaries/ghidra-malloc.elfAdded
- examples/binaries/ghidra-nan-payload.elfAdded
- examples/binaries/ghidra-pointer-identity.elfAdded
- examples/binaries/ghidra-population-count.elfAdded
- examples/binaries/ghidra-sign-extension.elfAdded
- examples/binaries/ghidra-signed-zero.elfAdded
- examples/binaries/ghidra-struct-fields.elfAdded
- examples/binaries/ghidra-struct-indirect.elfAdded
- examples/binaries/ghidra-struct-padding.elfAdded
- examples/binaries/ghidra-tail-call.elfAdded
- examples/binaries/ghidra-transient-global.elfAdded
- examples/binaries/ghidra-unsigned-maximum.elfAdded
- examples/binaries/ghidra-void-memory.elfAdded
- examples/binaries/ghidra-wide-integer.elfAdded
- examples/binaries/hello-goodbye.elfAdded
- examples/binaries/hello-world.elfAdded
- examples/binaries/identical.elfAdded
- examples/binaries/malloc.elfAdded
- examples/binaries/nan-payload.elfAdded
- examples/binaries/pointer-identity.elfAdded
- examples/binaries/population-count.elfAdded
- examples/binaries/rotate-vs-shift.elfAdded
- examples/binaries/sign-extension.elfAdded
1234567891011**!Dockerfile!README.md!requirements-runtime.txt!core-revision.json!demo/!demo/**!examples/!examples/**!bootstrap.py**/__pycache__/123456__pycache__/.pytest_cache/.venv/build/dist/*.egg-info/123[submodule "core"] path = core url = https://github.com/edmcman/decompile-verify.git13.11.1312345678910111213141516171819202122232425FROM ghcr.io/astral-sh/uv:0.12.19@sha256:04d046b13e60d6bcec73cbc5e1cad25d680dea90c8573340950a0ac2d1aef424 AS uvFROM ubuntu:24.04@sha256:a853f94d226358a79c740cfc7bce0c289748f3fe3488d921d038ccd752c61b60
RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ ca-certificates git gcc g++ clang binutils make && \ dpkg-query -W > /opt/apt-packages.txt && rm -rf /var/lib/apt/lists/*COPY --from=uv /uv /uvx /usr/local/bin/ENV UV_PYTHON_INSTALL_DIR=/opt/python UV_LINK_MODE=copyRUN useradd -o -m -u 1000 user && \ uv python install 3.11.13 && uv venv --python 3.11.13 /opt/venv && \ chown -R user:user /opt/venvCOPY requirements-runtime.txt /opt/requirements-runtime.txtUSER userENV HOME=/home/user UV_CACHE_DIR=/home/user/.cache/uvRUN --mount=type=cache,id=decompile-verify-gradio-uv,target=/home/user/.cache/uv,uid=1000,gid=1000 \ uv pip sync --python /opt/venv/bin/python --require-hashes /opt/requirements-runtime.txtENV PATH="/opt/venv/bin:$PATH" PYTHONHASHSEED=0 PYTHONUNBUFFERED=1 GRADIO_ANALYTICS_ENABLED=FalseWORKDIR /home/user/app# Do not COPY the build context as a whole: it may have an initialized private submodule.COPY --chown=user:user demo/ ./demo/COPY --chown=user:user examples/ ./examples/COPY --chown=user:user bootstrap.py core-revision.json ./EXPOSE 7860CMD ["python", "bootstrap.py"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102---title: Decompiler verifieremoji: 🔍colorFrom: indigocolorTo: bluesdk: dockerapp_port: 7860fullWidth: true---
# Decompiler verifier workbench
Public Gradio frontend for comparing a binary function with candidate C. Selectan example or upload an ELF x86-64 binary, supply its function address and candidatesource, and stream verification results with assembly previews and a JSON download.The application includes all 45 synthetic, saved Ghidra, and real-binary examples.
The verification library is a private GitHub repository referenced by the `core/`Git submodule. This repository publishes the UI and demo assets. Running verificationlocally requires access to the private core; cloning the public frontend alone doesnot grant that access.
## Local development
Use Linux/amd64, Python 3.11.13, GCC, Clang, and binutils. On macOS or Windows,use the Docker workflow below. With authorized GitHub credentials:
```shgit submodule update --init coreuv sync --lockeduv run python -m demo.appuv run python -m pytest -q```
Open <http://localhost:7860>. The library is installed as an editable dependencyfrom the submodule. UI tests operate on public assets and the installed library;they do not import the private engine tests. Core regression tests run separatelyin the core project.
## Docker and Hugging Face
```shdocker build --platform linux/amd64 -t decompile-verify:gradio .docker run --rm --platform linux/amd64 --publish 127.0.0.1:7860:7860 \ --env CORE_GITHUB_TOKEN decompile-verify:gradio```
Set `CORE_GITHUB_TOKEN` in your local environment using your credential managerbefore running the command; do not write its value into shell history. In theSpace Settings, configure the same name as a secret. Use a GitHub token scopedto the private core repository with read-only Contents permission.
The public image contains third-party dependencies, UI code, and example assets.It excludes the private submodule even when initialized locally. At startup,`bootstrap.py` fetches the pinned core commit, verifies it, installs the library,deletes the temporary checkout, removes the token from the application environment,and launches Gradio on port 7860. Startup fails clearly if credentials or the pinnedrevision are unavailable. This requires network access to GitHub at startup.The installed core exists only in the running container, outside the published image.uv uses a BuildKit cache mount for dependency downloads and builds; that cache isreused across builds and does not become part of the published image.
Uploads and downloaded reports are ephemeral. Gradio blocks file serving fromthe private library, development submodule, and Git metadata. The workbench preservesqueued streaming, cancellation, editable settings, and deterministic JSON reports.
## Update the core revision
Commit and push library changes in the private core repository first. Update thesubmodule to that committed revision, then regenerate pin metadata and dependencies:
```shgit -C core fetch origingit -C core checkout CORE_COMMITuv run --no-sync python scripts/pin_core.py```
Commit `core`, `core-revision.json`, `uv.lock`, and `requirements-runtime.txt`together. The private core stays on GitHub; only its gitlink is published here.The Docker build installs the hashed requirements without authenticating to GitHub.
Examples are prepared in the private core's Linux container with`python -m scripts.export_demo_examples --out build/public-examples` and copiedinto `examples/`. Startup does not compile original example sources or requirethe core's test tree. Reference C is a display aid; uploaded binaries have none.The bundled `factor` executable retains its redistribution notices in `examples/`.
## Publish under the existing Space name
The old private `ejschwartz/decompile-verify` Space contains core source and history.Do not make it public directly. Back it up privately, then create a clean replacementat the same name and push only this repository's fresh history. Configure secrets,validate the app and all image layers while private, and verify old core-containingcommits and images are inaccessible before publishing. Replacing the Space requiresseparate approval because it interrupts the current app and removes its history/settings.
See [Docker Space secrets](https://huggingface.co/docs/hub/spaces-sdks-docker#secrets-and-variables-management)and [downloadable Space images](https://huggingface.co/docs/hub/spaces-run-with-docker).
To inspect every image layer for private core files and repository metadata, run`python scripts/audit_image.py decompile-verify:gradio`. The audit recognizes uv'sempty cache sentinel as installer metadata rather than a project Git repository.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788"""Install the pinned private submodule at runtime, before importing Gradio."""
import argparseimport jsonimport osfrom pathlib import Pathimport reimport subprocessimport sysimport tempfile
ROOT = Path(__file__).resolve().parentREPOSITORY = "https://github.com/edmcman/decompile-verify.git"
def revision(): data = json.loads((ROOT / "core-revision.json").read_text()) if data["repository"] != REPOSITORY or not re.fullmatch(r"[0-9a-f]{40}", data["commit"]): raise ValueError("invalid pinned core repository or commit") return data
def command(args, *, env=None, cwd=None, timeout=300): try: return subprocess.run(args, cwd=cwd, env=env, check=True, capture_output=True, text=True, timeout=timeout).stdout.strip() except (subprocess.CalledProcessError, subprocess.TimeoutExpired, OSError) as error: # Never emit raw Git output or the authentication environment into Space logs. raise RuntimeError(f"private core setup failed during {Path(args[0]).name}; " "check repository access, pinned commit, and network availability") from error
def install_core(): pinned = revision() token = os.environ.pop("CORE_GITHUB_TOKEN", None) if not token: raise RuntimeError("set the CORE_GITHUB_TOKEN Space secret to a read-only GitHub token") clean_env = {key: value for key, value in os.environ.items() if not key.startswith("GIT_")} clean_env["GIT_TERMINAL_PROMPT"] = "0" clean_env["GIT_CONFIG_GLOBAL"] = os.devnull clean_env["GIT_CONFIG_NOSYSTEM"] = "1" # An ephemeral askpass helper supplies the credential without storing it in # a URL, git config, command line, or the environment of the running app. with tempfile.TemporaryDirectory(prefix="private-core-") as temporary: directory = Path(temporary) askpass = directory / "askpass.py" askpass.write_text(f"#!{sys.executable}\nimport os, sys\n" "print('x-access-token' if 'username' in sys.argv[1].lower() " "else os.environ['CORE_GITHUB_TOKEN'])\n") askpass.chmod(0o700) git_env = {**clean_env, "GIT_ASKPASS": str(askpass), "CORE_GITHUB_TOKEN": token} # Disable credential helpers so no persistent credential is read or saved. git_env.update(GIT_CONFIG_COUNT="1", GIT_CONFIG_KEY_0="credential.helper", GIT_CONFIG_VALUE_0="") source = directory / "source" source.mkdir() command(["git", "init", "--quiet", str(source)], env=clean_env) command(["git", "remote", "add", "origin", REPOSITORY], env=clean_env, cwd=source) command(["git", "fetch", "--quiet", "--depth=1", "origin", pinned["commit"]], env=git_env, cwd=source) fetched = command(["git", "rev-parse", "FETCH_HEAD"], env=clean_env, cwd=source) if fetched != pinned["commit"]: raise RuntimeError("fetched core revision differs from the pinned submodule") command(["git", "checkout", "--quiet", "--detach", "FETCH_HEAD"], env=clean_env, cwd=source) git_env.clear() token = None command(["uv", "pip", "install", "--python", sys.executable, "--no-deps", "--no-build-isolation", str(source)], env=clean_env) from importlib.metadata import version if version("decompile-verify") != pinned["version"]: raise RuntimeError("installed core version differs from the pinned metadata")
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--install-only", action="store_true") args = parser.parse_args() try: install_core() except (RuntimeError, ValueError, KeyError, OSError) as error: print(str(error), file=sys.stderr) return 1 if not args.install_only: os.execv(sys.executable, [sys.executable, "-m", "demo.app", "--host", "0.0.0.0", "--port", "7860"]) return 0
if __name__ == "__main__": raise SystemExit(main())1Subproject commit bdc8d4af1f3a26294cbca5bb094b7308b98859bd12345{ "repository": "https://github.com/edmcman/decompile-verify.git", "commit": "bdc8d4af1f3a26294cbca5bb094b7308b98859bd", "version": "0.0.0"}1"""Gradio front end; verification is owned by verifier.api."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277"""Local Gradio demo. Run inside the Linux x86-64 Docker environment."""
import argparsefrom contextlib import closingfrom dataclasses import asdictfrom hashlib import sha256from decimal import Decimalimport refrom pathlib import Pathimport verifierimport shleximport tempfile
import gradio as gr
from demo.examples import EXAMPLE_LABELS, ROOT, prepare_examples, reference_sourcesfrom demo.presentation import banner, format_bit_ranges, json_detail, mismatch_summary, statusfrom demo.session import (UISession, begin_ui, cancel_session, controls, edit_inputs, idle_controls, reset_session, stream_ui)import verifier as apifrom verifier import Task, integer_text, parse_bindings, parse_function, yaml_mapping
HEADERS = ["Seed", "Verdict", "Location", "Differing bits", "Original", "Candidate", "Reason"]
def integer(value, label): if type(value) is int: return value if isinstance(value, float) and value.is_integer(): return int(value) if isinstance(value, str): try: if value.strip().lower().startswith("0x"): return int(value.strip(), 16) if re.fullmatch(r"[+-]?[0-9]+", value.strip()): return int(Decimal(value.strip())) except ValueError: pass raise ValueError(f"{label} must be an integer")
def result_row(result): diff = result.difference bits = format_bit_ranges((span.first, span.last) for span in getattr(diff, "bit_ranges", ())) original, candidate = getattr(diff, "original", ""), getattr(diff, "candidate", "") if isinstance(original, int): original, candidate = hex(original), hex(candidate) return [integer_text(result.seed), result.verdict, getattr(diff, "location", ""), bits, original, candidate, result.reason or result.original.reason or result.candidate.reason or ""]
def task_from_inputs(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces=""): if not binary: raise ValueError("upload a binary or select an example") options = yaml_mapping(interfaces or "") allowed = {"original_prototype", "original_cc", "candidate_cc", "variadic_types", "callee_interfaces", "memory_ranges", "original_base"} if set(options) - allowed: raise ValueError("unknown interface settings: " + ", ".join(sorted(set(options) - allowed))) return Task(binary=Path(binary), function=parse_function(function), candidate=candidate, bindings=parse_bindings(bindings), candidate_symbol=candidate_symbol.strip(), seed_count=integer(seed_count, "seed count"), seed_start=integer(seed_start, "seed start"), instruction_budget=integer(instruction_budget, "instruction budget"), compiler=compiler, flags=tuple(shlex.split(flags)), **options)
def clear_outputs(): return "", [], None, None, "", ""
def show_assembly(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces=""): try: report = api.inspect(task_from_inputs(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces)) yield banner(report, preview=True), [], None, None, report.original_assembly, report.candidate_assembly except (ValueError, OSError) as error: raise gr.Error(str(error)) from error
def run_verification(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces="", *, report_directory=None): """Translate UI inputs, stream engine results, then supply the JSON download.""" try: task = task_from_inputs(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces) rows, detail = [], None with closing(api.verify(task, stream=True)) as iterator: for report in iterator: rows.append(result_row(report.results[-1])) if detail is None and report.first_mismatch is not None: detail = asdict(report.first_mismatch) yield banner(report), list(rows), detail, None, report.original_assembly, report.candidate_assembly output = report.to_json() directory = Path(report_directory) if report_directory else Path(tempfile.gettempdir()) / "decompile-verify-reports" directory.mkdir(parents=True, exist_ok=True) path = directory / (sha256(output.encode()).hexdigest() + ".json") # Atomic writes allow concurrent requests for the same deterministic report. with tempfile.NamedTemporaryFile(mode="w", dir=directory, delete=False) as stream: stream.write(output) temporary = Path(stream.name) temporary.replace(path) yield banner(report, complete=True), rows, detail, str(path), report.original_assembly, report.candidate_assembly except (ValueError, OSError) as error: raise gr.Error(str(error)) from error
class Workbench(gr.Blocks): """Apply the workbench theme even when a caller launches create_app() directly."""
def launch(self, **kwargs): kwargs.setdefault("theme", gr.themes.Base( primary_hue="teal", secondary_hue="teal", neutral_hue="slate", font=["system-ui", "sans-serif"], font_mono=["ui-monospace", "monospace"], )) kwargs.setdefault("css_paths", Path(__file__).with_name("workbench.css")) kwargs.setdefault("js", Path(__file__).with_name("workbench.js").read_text()) blocked = list(kwargs.pop("blocked_paths", ()) or ()) blocked.extend([str(Path(verifier.__file__).resolve().parent), str(ROOT / "core"), str(ROOT / ".git")]) kwargs["blocked_paths"] = blocked return super().launch(**kwargs)
def create_app(examples_directory=None): examples = prepare_examples(examples_directory or ROOT / "build" / "demo-examples") references = reference_sources() with Workbench(title="Decompiler verifier", analytics_enabled=False, fill_width=True, delete_cache=(3600, 86400)) as app: session = gr.State(UISession()) ticket = gr.State(None) reference_function = gr.State(None) gr.Markdown("# Decompiler verifier\nCompare a C candidate with a binary function across shared random seeds.", elem_id="intro") # Render inputs later so the example picker can sit above setup. binary = gr.File(label="Binary", type="filepath", file_count="single", render=False, elem_id="binary") function = gr.Textbox(label="Function start address", placeholder="0x401000", info="angr recovers the function's blocks using available symbols and control flow.", render=False) candidate_symbol = gr.Textbox(label="Candidate function name", value="target", render=False) candidate = gr.Code(label="Candidate C", language="c", lines=20, wrap_lines=False, buttons=["copy"], render=False, elem_id="candidate-source") bindings = gr.Code(label="Bindings (YAML)", language="yaml", lines=4, value="globals: {}\ncallees: {}\n", render=False) seed_count = gr.Number(label="Seed count", value=100, precision=0, minimum=1, render=False) seed_start = gr.Textbox(label="First seed", value="0", info="Nonnegative decimal or hex integer", render=False) instruction_budget = gr.Number(label="Instruction budget per run", value=100000, precision=0, minimum=1, render=False) compiler = gr.Dropdown(label="Candidate compiler", choices=["gcc", "clang"], value="gcc", render=False) flags = gr.Textbox(label="Candidate flags", value="-O2", info="Optimization/debug flags and selected C options; see docs/demo.md.", render=False) interfaces = gr.Code(label="Function interfaces and explicit memory ranges (YAML)", language="yaml", value="", lines=5, render=False) inputs = [binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces] example_picker = gr.Examples(examples=examples, inputs=inputs, label="Examples", example_labels=list(EXAMPLE_LABELS), examples_per_page=20, cache_examples=False, elem_id="examples") with gr.Row(elem_id="setup"): binary.render() function.render() candidate_symbol.render() with gr.Accordion("Bindings", open=False): bindings.render() interfaces.render() with gr.Accordion("Run settings", open=False): with gr.Row(): seed_count.render() seed_start.render() instruction_budget.render() compiler.render() flags.render() with gr.Row(elem_id="actions"): run = gr.Button("Verify", variant="primary") cancel = gr.Button("Cancel", interactive=False) verdict = gr.HTML(status("Ready · Choose an example or upload a binary"), elem_id="verdict", apply_default_css=False) with gr.Row(elem_id="workspace") as workspace: candidate.render() reference = gr.Code(label="Reference C", language="c", lines=20, interactive=False, wrap_lines=False, buttons=["copy"], visible=False, elem_id="reference-source") original_assembly = gr.Code(label="Original assembly", language=None, lines=20, interactive=False, wrap_lines=False, buttons=["copy"], show_line_numbers=False, elem_id="original-assembly") candidate_assembly = gr.Code(label="Candidate assembly", language=None, lines=20, interactive=False, wrap_lines=False, buttons=["copy"], show_line_numbers=False, elem_id="candidate-assembly") gr.Markdown("Compares ordered calls, non-frame memory at calls and return, typed returns, " "and termination. Bound callees use declared signatures and deterministic " "synthetic returns without memory effects. Frame-observing and unsupported " "calls are inconclusive.", elem_id="scope") with gr.Row(elem_id="results"): table = gr.Dataframe(headers=HEADERS, datatype=["str"] * len(HEADERS), interactive=False, label="Per-seed results", scale=2, min_width=320, elem_id="seed-table", max_height=340, column_widths=[90, 100, 100, 140, 120, 120, 240]) with gr.Column(scale=1, min_width=280): gr.Markdown("### First mismatch") summary = gr.HTML(mismatch_summary(None), apply_default_css=False, elem_id="mismatch-summary") with gr.Accordion("Full mismatch JSON", open=False): detail = gr.JSON(label="First mismatch") download = gr.DownloadButton(label="Download JSON report") outputs = [verdict, table, detail, download, original_assembly, candidate_assembly] buttons = [run, cancel]
def verify_ui(binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces, session, ticket): for update in stream_ui(run_verification, (binary, function, candidate, bindings, candidate_symbol, seed_count, seed_start, instruction_budget, compiler, flags, interfaces), session, ticket): yield update[0], update[1], json_detail(update[2]), *update[3:]
def reset_ui(session): reset_session(session) return clear_outputs()
def load_reference(example): index, values = example source = references[index] return (gr.update(value=source, visible=bool(source)), gr.update(elem_classes=["has-reference"] if source else []), values[1])
def clear_reference(): return gr.update(value="", visible=False), gr.update(elem_classes=[]), None
def clear_changed_reference(function, reference_function): if reference_function is not None and function != reference_function: return clear_reference() return (gr.skip(),) * 3
reference_outputs = [reference, workspace, reference_function]
# State inputs are private to Gradio and omitted from the public API signature. verify_start = run.click(begin_ui, [session, *inputs], [verdict, *buttons, ticket], queue=False, api_visibility="private", show_progress="hidden") preview_event = gr.on(triggers=[], fn=show_assembly, inputs=inputs, outputs=outputs, api_name="assembly", concurrency_limit=1, concurrency_id="workbench", show_progress="hidden") event = verify_start.then(verify_ui, [*inputs, session, ticket], outputs, api_name="verify", concurrency_limit=1, concurrency_id="workbench", show_progress="hidden") event.then(idle_controls, session, buttons, queue=False, api_visibility="private", show_progress="hidden") gr.on([binary.upload, binary.delete, binary.clear, *[component.input for component in inputs[1:]]], edit_inputs, [session, *inputs], verdict, queue=False, api_visibility="private", show_progress="hidden") detail.change(mismatch_summary, detail, summary, queue=False, api_visibility="private", show_progress="hidden") example_picker.dataset.click(reset_ui, session, outputs, queue=False, cancels=[event, preview_event], api_name="reset_outputs", api_visibility="undocumented", show_progress="hidden") example_picker.dataset.click(lambda: controls(False), outputs=buttons, queue=False, api_visibility="private", show_progress="hidden") example_picker.dataset.click(load_reference, example_picker.dataset, reference_outputs, queue=False, api_visibility="private", show_progress="hidden") gr.on([binary.upload, binary.delete, binary.clear, function.input], clear_reference, outputs=reference_outputs, queue=False, api_visibility="private", show_progress="hidden") # Gradio 6.9 Textbox.input fires on keypress; blur also catches paste/deletion. function.blur(clear_changed_reference, [function, reference_function], reference_outputs, queue=False, api_visibility="private", show_progress="hidden") cancel.click(cancel_session, session, verdict, cancels=[event, preview_event], queue=False, api_visibility="private", show_progress="hidden").then( idle_controls, session, buttons, queue=False, api_visibility="private", show_progress="hidden") return app.queue(max_size=16)
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--host", default="127.0.0.1") parser.add_argument("--port", type=int, default=7860) args = parser.parse_args() create_app().launch(server_name=args.host, server_port=args.port, share=False)
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647"""Load public, prepared examples without access to the private test suite."""
from hashlib import sha256import jsonfrom pathlib import Pathimport shutil
ROOT = Path(__file__).resolve().parents[1]ASSETS = ROOT / "examples"CATALOG = json.loads((ASSETS / "catalog.json").read_text())EXAMPLE_NAMES = tuple(item["name"] for item in CATALOG)EXAMPLE_LABELS = tuple(item["label"] for item in CATALOG)ORIGINAL_EXAMPLE_NAMES = tuple(name for name in EXAMPLE_NAMES if not name.startswith("ghidra-"))GHIDRA_EXAMPLE_NAMES = tuple(name for name in EXAMPLE_NAMES if name.startswith("ghidra-"))ORIGINAL_EXAMPLE_LABELS = tuple(item["label"] for item in CATALOG if not item["name"].startswith("ghidra-"))
def example_metadata(name): return next(item for item in CATALOG if item["name"] == name)
def ghidra_metadata(name): return example_metadata(name).get("ghidra")
def reference_sources(): return tuple(example_metadata(name)["reference"] for name in EXAMPLE_NAMES)
def prepare_examples(directory, *, include_ghidra=True): directory = Path(directory).resolve() directory.mkdir(parents=True, exist_ok=True) rows = [] names = EXAMPLE_NAMES if include_ghidra else ORIGINAL_EXAMPLE_NAMES for name in names: item = example_metadata(name) source = (ASSETS / item["binary"]).resolve() if not source.is_relative_to(ASSETS.resolve()): raise ValueError("example binary must be inside the public assets directory") if sha256(source.read_bytes()).hexdigest() != item["binary_sha256"]: raise ValueError(f"example binary checksum mismatch: {name}") binary = directory / source.name if source != binary: shutil.copyfile(source, binary) rows.append([str(binary), *item["inputs"]]) (directory / "examples.json").write_text(json.dumps(rows, indent=2) + "\n") return rows123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118"""Presentation of existing reports; no verification decisions live here."""
from html import escapefrom decimal import Decimalfrom verifier import integer_text
STALE_SLOT = "<!--stale-->"ABI_SLOT = "<!--abi-->"
def json_detail(value): """Display integers as exact text through JSON serialization and the browser.""" if isinstance(value, dict): return {key: json_detail(item) for key, item in value.items()} if isinstance(value, (list, tuple)): return [json_detail(item) for item in value] if type(value) is int: return integer_text(value) return value
def code(value): return f"<code>{escape(str(value))}</code>"
def status(label, tone="amber", progress=""): return (f'<div class="run-status" role="status" aria-live="polite">' f'<strong class="indicator {tone}">{escape(label)}</strong>{STALE_SLOT}' f'<span class="counts">{escape(progress)}</span></div>')
def with_stale(value, stale): marker = '<span class="indicator amber stale">Out of date</span>' if stale else "" return value.replace(STALE_SLOT, marker)
def format_bit_ranges(ranges): return ", ".join(str(first) if first == last else f"{first}–{last}" for first, last in ranges)
def abi_details(task): rows = [] for arg in task["inputs"]: location = code(arg["location"]) if arg["randomized"] is False: location += ' <span class="muted">(not randomized)</span>' rows.append(f'<tr><td>{code(arg["name"])}</td><td>{code(arg["type_name"])}</td>' f'<td>{location}</td></tr>') arguments = ('<table><thead><tr><th>Name</th><th>Type</th><th>Location</th></tr></thead>' f'<tbody>{"".join(rows)}</tbody></table>' if rows else '<p>No arguments.</p>') variadic = '<p class="muted">Includes explicitly typed variadic inputs.</p>' if task["variadic"] else "" original = task.get("original_interface") provenance = (f'<p>Original interface: {code(original["signature"])} · {code(original["calling_convention"])} · ' f'{code(original["source"])}' + (' (inferred)' if original["inferred"] else '') + '</p>') if original else "" output = task["output"] return (f'{ABI_SLOT}<div class="abi-details"><div><p class="section-label">Prototype</p>' f'{code(task["prototype"])}{provenance}</div><div><p class="section-label">Arguments · {escape(task.get("calling_convention", ""))}</p>' f'{arguments}{variadic}</div><div><p class="section-label">Return</p>' f'<p>{code(output["type_name"])} → {code(output["location"])} ' f'({output["width"]} bits)</p></div></div>')
def literal_details(task): bindings = task.get("literal_bindings", ()) if not bindings: return "" rows = [] for binding in bindings: address = binding["address"] detail = hex(address) if address is not None else { "ambiguous": "Several original addresses match; kept local", "unmatched": "No original match; kept local", "skipped": "Unsupported type or source range; kept local", }.get(binding["status"], "") if binding.get("reason") == "binding_introduces_imports": detail = "Binding would introduce library calls; kept local" rows.append(f'<tr><td>{code(binding["literal"])}</td><td>{escape(binding["status"])}</td>' f'<td>{escape(detail)}</td></tr>') return ('<details class="literal-details"><summary>String literal bindings</summary>' '<table><thead><tr><th>Literal</th><th>Status</th><th>Address / diagnostic</th></tr></thead>' f'<tbody>{"".join(rows)}</tbody></table></details>')
def banner(report, complete=False, preview=False): count = len(report.results) label = ("Completed · Assembly preview" if preview else f"Completed · {report.verdict.upper()}" if complete else f"Running {count}/{report.task['seed_count']}") tone = {"agree": "green", "mismatch": "red"}.get(report.verdict, "amber") if complete else "amber" counts = report.counts progress = "" if preview else (f"{counts['agree']} agree · {counts['mismatch']} mismatch · " f"{counts['inconclusive']} inconclusive") return status(label, tone, progress) + abi_details(report.task) + literal_details(report.task)
def mismatch_summary(detail): if not detail: return '<p class="muted">No mismatch to display.</p>' diff = detail.get("difference") or {} bits = format_bit_ranges((span["first"], span["last"]) for span in diff.get("bit_ranges", ())) values = [("Seed", detail["seed"]), ("Location", diff.get("location", "—")), ("Original value", diff.get("original", "—")), ("Candidate value", diff.get("candidate", "—")), ("Differing bits", bits or "—")] rows = [] for label, value in values: if (label.endswith("value") and isinstance(value, str) and "width" in diff and ("xor" not in diff or diff["xor"] is not None)): value = int(Decimal(value)) if label.endswith("value") and isinstance(value, int): value = hex(value) elif isinstance(value, int): value = integer_text(value) rows.append(f'<div><dt>{escape(label)}</dt><dd>{code(value)}</dd></div>') reason = detail.get("reason") return (f'<dl class="mismatch-summary">{"".join(rows)}</dl>' + (f'<p>{escape(reason)}</p>' if reason else ""))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104"""Private, per-browser state for displayed inputs and cancellable result streams."""
from contextlib import closingfrom threading import RLock
from demo.presentation import ABI_SLOT, status, with_stale
class UISession: def __init__(self): self.snapshot = self.current = None self.generation = 0 self.busy = False self.display = "" self.lock = RLock()
def __deepcopy__(self, memo): # Each Gradio session gets its own state and synchronization primitive. session = UISession() session.snapshot, session.current = self.snapshot, self.current session.generation, session.busy, session.display = self.generation, self.busy, self.display return session
def rendered(self): return with_stale(self.display, self.snapshot is not None and self.snapshot != self.current)
def edit_inputs(session, *values): with session.lock: session.current = tuple(values) return session.rendered()
def reset_session(session): with session.lock: session.generation += 1 session.snapshot = session.current = None session.busy = False session.display = ""
def cancel_session(session): with session.lock: session.generation += 1 session.busy = False _, separator, abi = session.display.partition(ABI_SLOT) session.display = status("Cancelled") + separator + abi return session.rendered()
def controls(busy): import gradio as gr
return gr.update(interactive=not busy), gr.update(interactive=busy)
def idle_controls(session): with session.lock: return controls(session.busy)
def begin_ui(session, *values): with session.lock: session.generation += 1 session.snapshot = session.current = tuple(values) session.busy = True session.display = status("Building") return session.rendered(), *controls(True), session.generation
def stream_ui(handler, values, session, ticket=None): """Keep the six API outputs while protecting this session from obsolete streams.""" with session.lock: if ticket is not None: if ticket != session.generation or not session.busy: return values = session.snapshot else: begin_ui(session, *values) generation = session.generation initial = session.rendered() try: yield initial, [], None, None, "", "" with closing(handler(*values)) as iterator: for update in iterator: with session.lock: if session.generation != generation: return session.display = update[0] rendered = session.rendered() yield (rendered, *update[1:]) except Exception: with session.lock: if session.generation == generation: session.display = status("Failed · Check inputs and try again", "red") rendered = session.rendered() else: return yield rendered, [], None, None, "", "" raise finally: with session.lock: if session.generation == generation: session.busy = False1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162.gradio-container { width: 100%; min-width: 0 !important; max-width: 1800px !important; margin: auto; }#intro { margin-bottom: 0; }#intro h1 { font-size: 1.65rem; letter-spacing: -.025em; }#scope { font-size: .85rem; color: var(--body-text-color-subdued); }#setup { align-items: stretch; }#binary { min-height: 110px; }#binary .wrap { min-height: 72px; }#actions { gap: 8px; }#actions button { flex: 0 1 160px; min-width: 160px; white-space: nowrap; }#workspace { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }#workspace.has-reference { grid-template-columns: repeat(4, minmax(0, 1fr)); }#workspace > * { min-width: 0 !important; width: 100%; }#workspace > .block { min-height: 418px; }#workspace .cm-editor { height: 390px; }#workspace .cm-scroller { overflow: auto !important; }#workspace .cm-content { white-space: pre !important; }#workspace .cm-line { line-height: 1.45; }#workspace .cm-gutters { line-height: 1.45; }#workspace .cm-editor, #workspace .cm-scroller { font-size: 12px; }#workspace .cm-scroller:focus-visible, #workspace button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px;}.run-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-color-primary); border-radius: 8px; background: var(--block-background-fill); }.indicator { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 5px; font-size: .9rem; font-weight: 600; }.indicator::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }.green { color: #166534; background: #dcfce7; }.red { color: #991b1b; background: #fee2e2; }.amber { color: #854d0e; background: #fef3c7; }.dark .green { color: #86efac; background: #143b2b; }.dark .red { color: #fca5a5; background: #451d26; }.dark .amber { color: #fde68a; background: #423519; }.counts, .muted { color: var(--body-text-color-subdued); font-size: .85rem; }.abi-details { display: grid; grid-template-columns: 1fr 1.4fr .7fr; gap: 24px; padding: 16px 2px 4px; font-size: .85rem; color: var(--body-text-color); }.abi-details > div { min-width: 0; overflow-x: auto; }.section-label { font-weight: 600; margin: 0 0 6px; }.abi-details table, .literal-details table { border-collapse: collapse; width: 100%; text-align: left; }.abi-details th, .abi-details td, .literal-details th, .literal-details td { padding: 4px 12px 4px 0; vertical-align: top; }.abi-details th, .literal-details th { font-weight: 500; color: var(--body-text-color-subdued); }.abi-details code, .mismatch-summary code, .literal-details code { font-family: var(--font-mono); }.literal-details { margin-top: 12px; overflow-x: auto; font-size: .85rem; }.literal-details summary { cursor: pointer; color: var(--body-text-color-subdued); }.abi-details p { margin-top: 0; }#results { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: stretch; }#results > * { min-width: 0 !important; }#seed-table { overflow-x: auto !important; }.mismatch-summary { margin: 0; color: var(--body-text-color); }.mismatch-summary > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-color-primary); }.mismatch-summary dt { color: var(--body-text-color-subdued); font-size: .85rem; }.mismatch-summary dd { margin: 0; overflow-wrap: anywhere; }@media (max-width: 1099px) { #workspace, #workspace.has-reference { grid-template-columns: minmax(0, 1fr); } #workspace > .block { min-height: 328px; } #workspace .cm-editor { height: 300px; } .abi-details { grid-template-columns: minmax(0, 1fr); gap: 12px; }}@media (max-width: 800px) { #results { grid-template-columns: minmax(0, 1fr); } }@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }1234567891011121314151617181920212223242526272829303132(() => { // Gradio's built-in Code copy controls have empty accessible names. const labelPanes = () => { for (const [id, label] of [ ["candidate-source", "Candidate C"], ["reference-source", "Reference C"], ["original-assembly", "Original assembly"], ["candidate-assembly", "Candidate assembly"], ]) { const pane = document.getElementById(id); if (!pane) continue; const copy = pane.querySelector("button.icon-button"); if (copy && copy.getAttribute("aria-label") !== `Copy ${label}`) { copy.setAttribute("aria-label", `Copy ${label}`); copy.setAttribute("title", `Copy ${label}`); } const content = pane.querySelector(".cm-content"); if (content && content.getAttribute("aria-label") !== label) { content.setAttribute("aria-label", label); } const scroller = pane.querySelector(".cm-scroller"); if (id !== "candidate-source" && scroller && scroller.tabIndex !== 0) { scroller.tabIndex = 0; scroller.setAttribute("aria-label", `${label} scroll area`); } } }; labelPanes(); new MutationObserver(labelPanes).observe(document.body, { childList: true, subtree: true, });})();123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license forsoftware and other kinds of works.
The licenses for most software and other practical works are designedto take away your freedom to share and change the works. By contrast,the GNU General Public License is intended to guarantee your freedom toshare and change all versions of a program--to make sure it remains freesoftware for all its users. We, the Free Software Foundation, use theGNU General Public License for most of our software; it applies also toany other work released this way by its authors. You can apply it toyour programs, too.
When we speak of free software, we are referring to freedom, notprice. Our General Public Licenses are designed to make sure that youhave the freedom to distribute copies of free software (and charge forthem if you wish), that you receive source code or can get it if youwant it, that you can change the software or use pieces of it in newfree programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying youthese rights or asking you to surrender the rights. Therefore, you havecertain responsibilities if you distribute copies of the software, or ifyou modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whethergratis or for a fee, you must pass on to the recipients the samefreedoms that you received. You must make sure that they, too, receiveor can get the source code. And you must show them these terms so theyknow their rights.
Developers that use the GNU GPL protect your rights with two steps:(1) assert copyright on the software, and (2) offer you this Licensegiving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explainsthat there is no warranty for this free software. For both users' andauthors' sake, the GPL requires that modified versions be marked aschanged, so that their problems will not be attributed erroneously toauthors of previous versions.
Some devices are designed to deny users access to install or runmodified versions of the software inside them, although the manufacturercan do so. This is fundamentally incompatible with the aim ofprotecting users' freedom to change the software. The systematicpattern of such abuse occurs in the area of products for individuals touse, which is precisely where it is most unacceptable. Therefore, wehave designed this version of the GPL to prohibit the practice for thoseproducts. If such problems arise substantially in other domains, westand ready to extend this provision to those domains in future versionsof the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.States should not allow patents to restrict development and use ofsoftware on general-purpose computers, but in those that do, we wish toavoid the special danger that patents applied to a free program couldmake it effectively proprietary. To prevent this, the GPL assures thatpatents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution andmodification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds ofworks, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under thisLicense. Each licensee is addressed as "you". "Licensees" and"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the workin a fashion requiring copyright permission, other than the making of anexact copy. The resulting work is called a "modified version" of theearlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work basedon the Program.
To "propagate" a work means to do anything with it that, withoutpermission, would make you directly or secondarily liable forinfringement under applicable copyright law, except executing it on acomputer or modifying a private copy. Propagation includes copying,distribution (with or without modification), making available to thepublic, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables otherparties to make or receive copies. Mere interaction with a user througha computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"to the extent that it includes a convenient and prominently visiblefeature that (1) displays an appropriate copyright notice, and (2)tells the user that there is no warranty for the work (except to theextent that warranties are provided), that licensees may convey thework under this License, and how to view a copy of this License. Ifthe interface presents a list of user commands or options, such as amenu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the workfor making modifications to it. "Object code" means any non-sourceform of a work.
A "Standard Interface" means an interface that either is an officialstandard defined by a recognized standards body, or, in the case ofinterfaces specified for a particular programming language, one thatis widely used among developers working in that language.
The "System Libraries" of an executable work include anything, otherthan the work as a whole, that (a) is included in the normal form ofpackaging a Major Component, but which is not part of that MajorComponent, and (b) serves only to enable use of the work with thatMajor Component, or to implement a Standard Interface for which animplementation is available to the public in source code form. A"Major Component", in this context, means a major essential component(kernel, window system, and so on) of the specific operating system(if any) on which the executable work runs, or a compiler used toproduce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means allthe source code needed to generate, install, and (for an executablework) run the object code and to modify the work, including scripts tocontrol those activities. However, it does not include the work'sSystem Libraries, or general-purpose tools or generally available freeprograms which are used unmodified in performing those activities butwhich are not part of the work. For example, Corresponding Sourceincludes interface definition files associated with source files forthe work, and the source code for shared libraries and dynamicallylinked subprograms that the work is specifically designed to require,such as by intimate data communication or control flow between thosesubprograms and other parts of the work.
The Corresponding Source need not include anything that userscan regenerate automatically from other parts of the CorrespondingSource.
The Corresponding Source for a work in source code form is thatsame work.
2. Basic Permissions.
All rights granted under this License are granted for the term ofcopyright on the Program, and are irrevocable provided the statedconditions are met. This License explicitly affirms your unlimitedpermission to run the unmodified Program. The output from running acovered work is covered by this License only if the output, given itscontent, constitutes a covered work. This License acknowledges yourrights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do notconvey, without conditions so long as your license otherwise remainsin force. You may convey covered works to others for the sole purposeof having them make modifications exclusively for you, or provide youwith facilities for running those works, provided that you comply withthe terms of this License in conveying all material for which you donot control copyright. Those thus making or running the covered worksfor you must do so exclusively on your behalf, under your directionand control, on terms that prohibit them from making any copies ofyour copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely underthe conditions stated below. Sublicensing is not allowed; section 10makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technologicalmeasure under any applicable law fulfilling obligations under article11 of the WIPO copyright treaty adopted on 20 December 1996, orsimilar laws prohibiting or restricting circumvention of suchmeasures.
When you convey a covered work, you waive any legal power to forbidcircumvention of technological measures to the extent such circumventionis effected by exercising rights under this License with respect tothe covered work, and you disclaim any intention to limit operation ormodification of the work as a means of enforcing, against the work'susers, your or third parties' legal rights to forbid circumvention oftechnological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as youreceive it, in any medium, provided that you conspicuously andappropriately publish on each copy an appropriate copyright notice;keep intact all notices stating that this License and anynon-permissive terms added in accord with section 7 apply to the code;keep intact all notices of the absence of any warranty; and give allrecipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications toproduce it from the Program, in the form of source code under theterms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independentworks, which are not by their nature extensions of the covered work,and which are not combined with it such as to form a larger program,in or on a volume of a storage or distribution medium, is called an"aggregate" if the compilation and its resulting copyright are notused to limit the access or legal rights of the compilation's usersbeyond what the individual works permit. Inclusion of a covered workin an aggregate does not cause this License to apply to the otherparts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the termsof sections 4 and 5, provided that you also convey themachine-readable Corresponding Source under the terms of this License,in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excludedfrom the Corresponding Source as a System Library, need not beincluded in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means anytangible personal property which is normally used for personal, family,or household purposes, or (2) anything designed or sold for incorporationinto a dwelling. In determining whether a product is a consumer product,doubtful cases shall be resolved in favor of coverage. For a particularproduct received by a particular user, "normally used" refers to atypical or common use of that class of product, regardless of the statusof the particular user or of the way in which the particular useractually uses, or expects or is expected to use, the product. A productis a consumer product regardless of whether the product has substantialcommercial, industrial or non-consumer uses, unless such uses representthe only significant mode of use of the product.
"Installation Information" for a User Product means any methods,procedures, authorization keys, or other information required to installand execute modified versions of a covered work in that User Product froma modified version of its Corresponding Source. The information mustsuffice to ensure that the continued functioning of the modified objectcode is in no case prevented or interfered with solely becausemodification has been made.
If you convey an object code work under this section in, or with, orspecifically for use in, a User Product, and the conveying occurs aspart of a transaction in which the right of possession and use of theUser Product is transferred to the recipient in perpetuity or for afixed term (regardless of how the transaction is characterized), theCorresponding Source conveyed under this section must be accompaniedby the Installation Information. But this requirement does not applyif neither you nor any third party retains the ability to installmodified object code on the User Product (for example, the work hasbeen installed in ROM).
The requirement to provide Installation Information does not include arequirement to continue to provide support service, warranty, or updatesfor a work that has been modified or installed by the recipient, or forthe User Product in which it has been modified or installed. Access to anetwork may be denied when the modification itself materially andadversely affects the operation of the network or violates the rules andprotocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,in accord with this section must be in a format that is publiclydocumented (and with an implementation available to the public insource code form), and must require no special password or key forunpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of thisLicense by making exceptions from one or more of its conditions.Additional permissions that are applicable to the entire Program shallbe treated as though they were included in this License, to the extentthat they are valid under applicable law. If additional permissionsapply only to part of the Program, that part may be used separatelyunder those permissions, but the entire Program remains governed bythis License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your optionremove any additional permissions from that copy, or from any part ofit. (Additional permissions may be written to require their ownremoval in certain cases when you modify the work.) You may placeadditional permissions on material, added by you to a covered work,for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material youadd to a covered work, you may (if authorized by the copyright holders ofthat material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "furtherrestrictions" within the meaning of section 10. If the Program as youreceived it, or any part of it, contains a notice stating that it isgoverned by this License along with a term that is a furtherrestriction, you may remove that term. If a license document containsa further restriction but permits relicensing or conveying under thisLicense, you may add to a covered work material governed by the termsof that license document, provided that the further restriction doesnot survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, youmust place, in the relevant source files, a statement of theadditional terms that apply to those files, or a notice indicatingwhere to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in theform of a separately written license, or stated as exceptions;the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expresslyprovided under this License. Any attempt otherwise to propagate ormodify it is void, and will automatically terminate your rights underthis License (including any patent licenses granted under the thirdparagraph of section 11).
However, if you cease all violation of this License, then yourlicense from a particular copyright holder is reinstated (a)provisionally, unless and until the copyright holder explicitly andfinally terminates your license, and (b) permanently, if the copyrightholder fails to notify you of the violation by some reasonable meansprior to 60 days after the cessation.
Moreover, your license from a particular copyright holder isreinstated permanently if the copyright holder notifies you of theviolation by some reasonable means, this is the first time you havereceived notice of violation of this License (for any work) from thatcopyright holder, and you cure the violation prior to 30 days afteryour receipt of the notice.
Termination of your rights under this section does not terminate thelicenses of parties who have received copies or rights from you underthis License. If your rights have been terminated and not permanentlyreinstated, you do not qualify to receive new licenses for the samematerial under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive orrun a copy of the Program. Ancillary propagation of a covered workoccurring solely as a consequence of using peer-to-peer transmissionto receive a copy likewise does not require acceptance. However,nothing other than this License grants you permission to propagate ormodify any covered work. These actions infringe copyright if you donot accept this License. Therefore, by modifying or propagating acovered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automaticallyreceives a license from the original licensors, to run, modify andpropagate that work, subject to this License. You are not responsiblefor enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of anorganization, or substantially all assets of one, or subdividing anorganization, or merging organizations. If propagation of a coveredwork results from an entity transaction, each party to thattransaction who receives a copy of the work also receives whateverlicenses to the work the party's predecessor in interest had or couldgive under the previous paragraph, plus a right to possession of theCorresponding Source of the work from the predecessor in interest, ifthe predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of therights granted or affirmed under this License. For example, you maynot impose a license fee, royalty, or other charge for exercise ofrights granted under this License, and you may not initiate litigation(including a cross-claim or counterclaim in a lawsuit) alleging thatany patent claim is infringed by making, using, selling, offering forsale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under thisLicense of the Program or a work on which the Program is based. Thework thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claimsowned or controlled by the contributor, whether already acquired orhereafter acquired, that would be infringed by some manner, permittedby this License, of making, using, or selling its contributor version,but do not include claims that would be infringed only as aconsequence of further modification of the contributor version. Forpurposes of this definition, "control" includes the right to grantpatent sublicenses in a manner consistent with the requirements ofthis License.
Each contributor grants you a non-exclusive, worldwide, royalty-freepatent license under the contributor's essential patent claims, tomake, use, sell, offer for sale, import and otherwise run, modify andpropagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any expressagreement or commitment, however denominated, not to enforce a patent(such as an express permission to practice a patent or covenant not tosue for patent infringement). To "grant" such a patent license to aparty means to make such an agreement or commitment not to enforce apatent against the party.
If you convey a covered work, knowingly relying on a patent license,and the Corresponding Source of the work is not available for anyoneto copy, free of charge and under the terms of this License, through apublicly available network server or other readily accessible means,then you must either (1) cause the Corresponding Source to be soavailable, or (2) arrange to deprive yourself of the benefit of thepatent license for this particular work, or (3) arrange, in a mannerconsistent with the requirements of this License, to extend the patentlicense to downstream recipients. "Knowingly relying" means you haveactual knowledge that, but for the patent license, your conveying thecovered work in a country, or your recipient's use of the covered workin a country, would infringe one or more identifiable patents in thatcountry that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction orarrangement, you convey, or propagate by procuring conveyance of, acovered work, and grant a patent license to some of the partiesreceiving the covered work authorizing them to use, propagate, modifyor convey a specific copy of the covered work, then the patent licenseyou grant is automatically extended to all recipients of the coveredwork and works based on it.
A patent license is "discriminatory" if it does not include withinthe scope of its coverage, prohibits the exercise of, or isconditioned on the non-exercise of one or more of the rights that arespecifically granted under this License. You may not convey a coveredwork if you are a party to an arrangement with a third party that isin the business of distributing software, under which you make paymentto the third party based on the extent of your activity of conveyingthe work, and under which the third party grants, to any of theparties who would receive the covered work from you, a discriminatorypatent license (a) in connection with copies of the covered workconveyed by you (or copies made from those copies), or (b) primarilyfor and in connection with specific products or compilations thatcontain the covered work, unless you entered into that arrangement,or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limitingany implied license or other defenses to infringement that mayotherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement orotherwise) that contradict the conditions of this License, they do notexcuse you from the conditions of this License. If you cannot convey acovered work so as to satisfy simultaneously your obligations under thisLicense and any other pertinent obligations, then as a consequence you maynot convey it at all. For example, if you agree to terms that obligate youto collect a royalty for further conveying from those to whom you conveythe Program, the only way you could satisfy both those terms and thisLicense would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you havepermission to link or combine any covered work with a work licensedunder version 3 of the GNU Affero General Public License into a singlecombined work, and to convey the resulting work. The terms of thisLicense will continue to apply to the part which is the covered work,but the special requirements of the GNU Affero General Public License,section 13, concerning interaction through a network will apply to thecombination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions ofthe GNU General Public License from time to time. Such new versions willbe similar in spirit to the present version, but may differ in detail toaddress new problems or concerns.
Each version is given a distinguishing version number. If theProgram specifies that a certain numbered version of the GNU GeneralPublic License "or any later version" applies to it, you have theoption of following the terms and conditions either of that numberedversion or of any later version published by the Free SoftwareFoundation. If the Program does not specify a version number of theGNU General Public License, you may choose any version ever publishedby the Free Software Foundation.
If the Program specifies that a proxy can decide which futureversions of the GNU General Public License can be used, that proxy'spublic statement of acceptance of a version permanently authorizes youto choose that version for the Program.
Later license versions may give you additional or differentpermissions. However, no additional obligations are imposed on anyauthor or copyright holder as a result of your choosing to follow alater version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BYAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHTHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTYOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAMIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OFALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITINGWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYSTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THEUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OFDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRDPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OFSUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability providedabove cannot be given local legal effect according to their terms,reviewing courts shall apply local law that most closely approximatesan absolute waiver of all civil liability in connection with theProgram, unless a warranty or assumption of liability accompanies acopy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatestpossible use to the public, the best way to achieve this is to make itfree software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safestto attach them to the start of each source file to most effectivelystate the exclusion of warranty; and each file should have at leastthe "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a shortnotice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriateparts of the General Public License. Of course, your program's commandsmight be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,if any, to sign a "copyright disclaimer" for the program, if necessary.For more information on this, and how to apply and follow the GNU GPL, see<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your programinto proprietary programs. If your program is a subroutine library, youmay consider it more useful to permit linking proprietary applications withthe library. If this is what you want to do, use the GNU Lesser GeneralPublic License instead of this License. But first, please read<https://www.gnu.org/licenses/why-not-lgpl.html>..dockerignoreAdded+11
.gitignoreAdded+6
.gitmodulesAdded+3
.python-versionAdded+1
DockerfileAdded+25
README.mdAdded+102
bootstrap.pyAdded+88
coreAdded+1
core-revision.jsonAdded+5
demo/__init__.pyAdded+1
demo/app.pyAdded+277
demo/examples.pyAdded+47
demo/presentation.pyAdded+118
demo/session.pyAdded+104
demo/workbench.cssAdded+62
demo/workbench.jsAdded+32
examples/COPYINGAdded+674
examples/binaries/byte-swap.elfAdded
examples/binaries/factorAdded
examples/binaries/float-identity.elfAdded
examples/binaries/format-string.elfAdded
examples/binaries/ghidra-byte-swap.elfAdded
examples/binaries/ghidra-float-identity.elfAdded
examples/binaries/ghidra-format-string.elfAdded
examples/binaries/ghidra-hello-goodbye.elfAdded
examples/binaries/ghidra-hello-world.elfAdded
examples/binaries/ghidra-identical.elfAdded
examples/binaries/ghidra-malloc.elfAdded
examples/binaries/ghidra-nan-payload.elfAdded
examples/binaries/ghidra-pointer-identity.elfAdded
examples/binaries/ghidra-population-count.elfAdded
examples/binaries/ghidra-sign-extension.elfAdded
examples/binaries/ghidra-signed-zero.elfAdded
examples/binaries/ghidra-struct-fields.elfAdded
examples/binaries/ghidra-struct-indirect.elfAdded
examples/binaries/ghidra-struct-padding.elfAdded
examples/binaries/ghidra-tail-call.elfAdded
examples/binaries/ghidra-transient-global.elfAdded
examples/binaries/ghidra-unsigned-maximum.elfAdded
examples/binaries/ghidra-void-memory.elfAdded
examples/binaries/ghidra-wide-integer.elfAdded
examples/binaries/hello-goodbye.elfAdded
examples/binaries/hello-world.elfAdded
examples/binaries/identical.elfAdded
examples/binaries/malloc.elfAdded
examples/binaries/nan-payload.elfAdded
examples/binaries/pointer-identity.elfAdded
examples/binaries/population-count.elfAdded
examples/binaries/rotate-vs-shift.elfAdded
examples/binaries/sign-extension.elfAdded