From 3006c68e108a18f9b8782bc937dc9ec7e2cb3b54 Mon Sep 17 00:00:00 2001 From: kat Date: Wed, 23 Oct 2024 21:56:29 -0400 Subject: Initial commit of the alpha dyld_shared_cache view API Plugin. This is an early release of our DSC processing plugin. We're still hard at work improving this feature. You should be able to just drop in a dyld_shared_cache and use the 'Shared Cache Triage' view to load and analyze images. --- view/sharedcache/ui/dscpicker.cpp | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 view/sharedcache/ui/dscpicker.cpp (limited to 'view/sharedcache/ui/dscpicker.cpp') diff --git a/view/sharedcache/ui/dscpicker.cpp b/view/sharedcache/ui/dscpicker.cpp new file mode 100644 index 00000000..33877675 --- /dev/null +++ b/view/sharedcache/ui/dscpicker.cpp @@ -0,0 +1,42 @@ +// +// Created by kat on 5/22/23. +// + +#include "dscpicker.h" +#include +#include "progresstask.h" + +#include + +using namespace BinaryNinja; + +void DisplayDSCPicker(UIContext* ctx, Ref dscView) +{ + BackgroundThread::create(ctx ? ctx->mainWindow() : nullptr)->thenBackground( + [dscView=dscView](QVariant var) { + QStringList entries; + SharedCacheAPI::SCRef cache = new SharedCacheAPI::SharedCache(dscView); + + for (const auto& img : cache->GetAvailableImages()) + entries.push_back(QString::fromStdString(img)); + + return entries; + })->thenMainThread([ctx](QVariant var){ + QStringList entries = var.toStringList(); + + auto choiceDialog = new MetadataChoiceDialog(ctx ? ctx->mainWindow() : nullptr, "Pick Image", "Select", entries); + choiceDialog->AddWidthRequiredByItem(ctx, 300); + choiceDialog->AddHeightRequiredByItem(ctx, 150); + choiceDialog->exec(); + + if (choiceDialog->GetChosenEntry().has_value()) + return QVariant(QString::fromStdString(entries.at((qsizetype)choiceDialog->GetChosenEntry().value().idx).toStdString())); + else + return QVariant(""); + })->thenBackground([dscView=dscView](QVariant var){ + if (var.toString().isEmpty()) + return; + SharedCacheAPI::SCRef cache = new SharedCacheAPI::SharedCache(dscView); + cache->LoadImageWithInstallName(var.toString().toStdString()); + })->start(); +} -- cgit v1.3.1