mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Download and install sigdb option (#2949)
* Download and install sigdb option and disable swift demangler when libswift is installed * Remove dir.prefix and use rz_core_analysis_sigdb_list for sigdb * Use a different color for flirts * Updated to rizin dev * Use rz_path_set_prefix to set the prefix path on OSX bundle
This commit is contained in:
parent
2e6fd46127
commit
247ab94b71
3
.github/workflows/ccpp.yml
vendored
3
.github/workflows/ccpp.yml
vendored
@ -120,6 +120,7 @@ jobs:
|
||||
-DCUTTER_USE_BUNDLED_RIZIN=ON \
|
||||
-DCUTTER_APPIMAGE_BUILD=ON \
|
||||
-DCUTTER_ENABLE_PACKAGING=ON \
|
||||
-DCUTTER_ENABLE_SIGDB=ON \
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
|
||||
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
|
||||
@ -185,6 +186,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
|
||||
-DCUTTER_USE_BUNDLED_RIZIN=ON \
|
||||
-DCUTTER_ENABLE_PACKAGING=ON \
|
||||
-DCUTTER_ENABLE_SIGDB=ON \
|
||||
-DCUTTER_PACKAGE_DEPENDENCIES=ON \
|
||||
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
|
||||
@ -225,6 +227,7 @@ jobs:
|
||||
-DCUTTER_ENABLE_PYTHON=ON ^
|
||||
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
|
||||
-DCUTTER_ENABLE_PACKAGING=ON ^
|
||||
-DCUTTER_ENABLE_SIGDB=ON ^
|
||||
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
|
||||
-DCUTTER_PACKAGE_RZ_GHIDRA=ON ^
|
||||
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON ^
|
||||
|
@ -23,6 +23,7 @@ set(SHIBOKEN_EXTRA_OPTIONS "" CACHE STRING "Extra options for shiboken generator
|
||||
set(CUTTER_EXTRA_PLUGIN_DIRS "" CACHE STRING "List of addition plugin locations")
|
||||
option(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS "Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by rizin build." OFF)
|
||||
option(CUTTER_ENABLE_PACKAGING "Enable building platform-specific packages for distributing" OFF)
|
||||
option(CUTTER_ENABLE_SIGDB "Downloads and installs sigdb (only available when CUTTER_USE_BUNDLED_RIZIN=ON)." OFF)
|
||||
option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party dependencies." OFF)
|
||||
option(CUTTER_PACKAGE_RZ_GHIDRA "Compile and install rz-ghidra during install step." OFF)
|
||||
option(CUTTER_PACKAGE_RZ_LIBSWIFT, "Compile and install rz-libswift demangler during the install step." OFF)
|
||||
@ -123,6 +124,9 @@ message(STATUS "")
|
||||
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
|
||||
message(STATUS "Options:")
|
||||
message(STATUS "- Bundled rizin: ${CUTTER_USE_BUNDLED_RIZIN}")
|
||||
if(CUTTER_USE_BUNDLED_RIZIN)
|
||||
message(STATUS "- Bundled sigdb: ${CUTTER_ENABLE_SIGDB}")
|
||||
endif()
|
||||
message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}")
|
||||
message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}")
|
||||
message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}")
|
||||
|
@ -18,6 +18,14 @@ if (CUTTER_ENABLE_PACKAGING)
|
||||
list(APPEND MESON_OPTIONS "-Dportable=true")
|
||||
endif()
|
||||
|
||||
if (CUTTER_ENABLE_SIGDB)
|
||||
list(APPEND MESON_OPTIONS "-Dinstall_sigdb=true")
|
||||
endif()
|
||||
|
||||
if (CUTTER_PACKAGE_RZ_LIBSWIFT AND CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
list(APPEND MESON_OPTIONS "-Duse_swift_demangler=false")
|
||||
endif()
|
||||
|
||||
find_program(MESON meson)
|
||||
if(NOT MESON)
|
||||
message(FATAL_ERROR "Failed to find meson, which is required to build bundled rizin")
|
||||
|
8
dist/CMakeLists.txt
vendored
8
dist/CMakeLists.txt
vendored
@ -92,7 +92,7 @@ if(APPLE)
|
||||
|
||||
get_filename_component(QT_PREFIX "${MACDEPLOYQT_PATH}/../.." ABSOLUTE)
|
||||
list(APPEND RZ_GHIDRA_PREFIX_PATH "${QT_PREFIX}")
|
||||
set(RIZIN_INSTALL_PLUGDIR "share/rizin/plugins") # escaped backslash on purpose, should be evaluated later
|
||||
set(RIZIN_INSTALL_PLUGDIR "lib/rizin/plugins") # escaped backslash on purpose, should be evaluated later
|
||||
|
||||
if (CUTTER_PACKAGE_JSDEC AND CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
|
||||
install(CODE "
|
||||
@ -139,11 +139,7 @@ if(CUTTER_PACKAGE_RZ_GHIDRA)
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
if (WIN32)
|
||||
set (GHIDRA_OPTIONS "
|
||||
\"-DRIZIN_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/${RIZIN_INSTALL_PLUGDIR}\"
|
||||
-DCUTTER_INSTALL_PLUGDIR=plugins/native")
|
||||
elseif (APPLE)
|
||||
if (WIN32 OR APPLE)
|
||||
set (GHIDRA_OPTIONS "
|
||||
\"-DRIZIN_INSTALL_PLUGDIR=\${CMAKE_INSTALL_PREFIX}/${RIZIN_INSTALL_PLUGDIR}\"
|
||||
-DCUTTER_INSTALL_PLUGDIR=plugins/native")
|
||||
|
2
rizin
2
rizin
@ -1 +1 @@
|
||||
Subproject commit 0950e823a4502677cbf77cfd0266e8de64875fc0
|
||||
Subproject commit 7665d0f30ef7771b305329502d94842ec4a97a62
|
@ -177,11 +177,11 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
||||
{
|
||||
auto rzprefix = QDir(QCoreApplication::applicationDirPath()); // Contents/MacOS
|
||||
rzprefix.cdUp(); // Contents
|
||||
rzprefix.cd("Resources"); // Contents/Resources/rz
|
||||
rzprefix.cd("Resources"); // Contents/Resources/
|
||||
|
||||
auto sleighHome = rzprefix;
|
||||
sleighHome.cd(
|
||||
"share/rizin/plugins/rz_ghidra_sleigh"); // Contents/Resources/rz/share/rizin/plugins/rz_ghidra_sleigh
|
||||
"lib/rizin/plugins/rz_ghidra_sleigh"); // Contents/Resources/lib/rizin/plugins/rz_ghidra_sleigh
|
||||
Core()->setConfig("ghidra.sleighhome", sleighHome.absolutePath());
|
||||
}
|
||||
#endif
|
||||
|
@ -37,7 +37,8 @@ ColorThemeWorker::ColorThemeWorker(QObject *parent) : QObject(parent)
|
||||
QDir().mkpath(customRzThemesLocationPath);
|
||||
}
|
||||
|
||||
QDir currDir { QStringLiteral("%1%2%3").arg(rz_path_prefix(nullptr), RZ_SYS_DIR, RZ_THEMES) };
|
||||
char *theme_dir = rz_path_prefix(RZ_THEMES);
|
||||
QDir currDir { theme_dir };
|
||||
if (currDir.exists()) {
|
||||
standardRzThemesLocationPath = currDir.absolutePath();
|
||||
} else {
|
||||
@ -46,6 +47,7 @@ ColorThemeWorker::ColorThemeWorker(QObject *parent) : QObject(parent)
|
||||
"Most likely, Rizin is not properly installed.")
|
||||
.arg(currDir.path()));
|
||||
}
|
||||
free(theme_dir);
|
||||
}
|
||||
|
||||
QColor ColorThemeWorker::mergeColors(const QColor &upper, const QColor &lower) const
|
||||
|
@ -46,6 +46,8 @@ const QHash<QString, QHash<ColorFlags, QColor>> Configuration::cutterOptionColor
|
||||
{ { DarkFlag, QColor(0x9b, 0x9b, 0x9b) }, { LightFlag, QColor(0x9b, 0x9b, 0x9b) } } },
|
||||
{ "gui.main",
|
||||
{ { DarkFlag, QColor(0x21, 0xd8, 0x93) }, { LightFlag, QColor(0x00, 0x80, 0x00) } } },
|
||||
{ "gui.flirt",
|
||||
{ { DarkFlag, QColor(0xd8, 0xbb, 0x21) }, { LightFlag, QColor(0xf1, 0xc4, 0x0f) } } },
|
||||
{ "gui.item_unsafe",
|
||||
{ { DarkFlag, QColor(0xff, 0x81, 0x7b) }, { LightFlag, QColor(0xff, 0x81, 0x7b) } } },
|
||||
{ "gui.navbar.seek",
|
||||
|
@ -188,11 +188,13 @@ CutterCore *CutterCore::instance()
|
||||
|
||||
void CutterCore::initialize(bool loadPlugins)
|
||||
{
|
||||
auto prefix = QDir(QCoreApplication::applicationDirPath());
|
||||
|
||||
#if defined(CUTTER_ENABLE_PACKAGING) && defined(Q_OS_WIN)
|
||||
auto prefixBytes = prefix.absolutePath().toUtf8();
|
||||
rz_path_prefix(prefixBytes.constData());
|
||||
#if defined(MACOS_RZ_BUNDLED)
|
||||
auto app_path = QDir(QCoreApplication::applicationDirPath());
|
||||
app_path.cdUp();
|
||||
app_path.cd("Resources");
|
||||
qInfo() << "Setting Rizin prefix =" << app_path.absolutePath()
|
||||
<< " for macOS Application Bundle.";
|
||||
rz_path_set_prefix(app_path.absolutePath().toUtf8().constData());
|
||||
#endif
|
||||
|
||||
rz_cons_new(); // initialize console
|
||||
@ -203,34 +205,11 @@ void CutterCore::initialize(bool loadPlugins)
|
||||
|
||||
rz_event_hook(core_->analysis->ev, RZ_EVENT_ALL, cutterREventCallback, this);
|
||||
|
||||
#if defined(APPIMAGE) || defined(MACOS_RZ_BUNDLED)
|
||||
# ifdef APPIMAGE
|
||||
// Executable is in appdir/bin
|
||||
prefix.cdUp();
|
||||
qInfo() << "Setting Rizin prefix =" << prefix.absolutePath() << " for AppImage.";
|
||||
# else // MACOS_RZ_BUNDLED
|
||||
// Executable is in Contents/MacOS, prefix is Contents/Resources/rz
|
||||
prefix.cdUp();
|
||||
prefix.cd("Resources");
|
||||
qInfo() << "Setting Rizin prefix =" << prefix.absolutePath()
|
||||
<< " for macOS Application Bundle.";
|
||||
setConfig("dir.prefix", prefix.absolutePath());
|
||||
# endif
|
||||
|
||||
auto pluginsDir = prefix;
|
||||
if (pluginsDir.cd("share/rizin/plugins")) {
|
||||
qInfo() << "Setting Rizin plugins dir =" << pluginsDir.absolutePath();
|
||||
setConfig("dir.plugins", pluginsDir.absolutePath());
|
||||
} else {
|
||||
qInfo() << "Rizin plugins dir under" << pluginsDir.absolutePath() << "does not exist!";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!loadPlugins) {
|
||||
setConfig("cfg.plugins", 0);
|
||||
}
|
||||
if (getConfigi("cfg.plugins")) {
|
||||
if (loadPlugins) {
|
||||
setConfig("cfg.plugins", true);
|
||||
rz_core_loadlibs(this->core_, RZ_CORE_LOADLIBS_ALL);
|
||||
} else {
|
||||
setConfig("cfg.plugins", false);
|
||||
}
|
||||
// IMPLICIT rz_bin_iobind (core_->bin, core_->io);
|
||||
|
||||
@ -3166,10 +3145,16 @@ QList<HeaderDescription> CutterCore::getAllHeaders()
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sigdb_insert_element_into_qlist(RzList *list, QList<FlirtDescription> &sigdb)
|
||||
QList<FlirtDescription> CutterCore::getSignaturesDB()
|
||||
{
|
||||
CORE_LOCK();
|
||||
|
||||
void *ptr = NULL;
|
||||
RzListIter *iter = NULL;
|
||||
QList<FlirtDescription> sigdb;
|
||||
|
||||
RzList *list = rz_core_analysis_sigdb_list(core, true);
|
||||
|
||||
rz_list_foreach(list, iter, ptr)
|
||||
{
|
||||
RzSigDBEntry *sig = static_cast<RzSigDBEntry *>(ptr);
|
||||
@ -3185,28 +3170,6 @@ static void sigdb_insert_element_into_qlist(RzList *list, QList<FlirtDescription
|
||||
sigdb << flirt;
|
||||
}
|
||||
rz_list_free(list);
|
||||
}
|
||||
|
||||
QList<FlirtDescription> CutterCore::getSignaturesDB()
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<FlirtDescription> sigdb;
|
||||
RzList *list = nullptr;
|
||||
|
||||
char *system_sigdb = rz_path_system(RZ_SIGDB);
|
||||
if (RZ_STR_ISNOTEMPTY(system_sigdb) && rz_file_is_directory(system_sigdb)) {
|
||||
list = rz_sign_sigdb_load_database(system_sigdb, true);
|
||||
sigdb_insert_element_into_qlist(list, sigdb);
|
||||
}
|
||||
free(system_sigdb);
|
||||
|
||||
const char *sigdb_path = rz_config_get(core->config, "flirt.sigdb.path");
|
||||
if (RZ_STR_ISEMPTY(sigdb_path)) {
|
||||
return sigdb;
|
||||
}
|
||||
|
||||
list = rz_sign_sigdb_load_database(sigdb_path, true);
|
||||
sigdb_insert_element_into_qlist(list, sigdb);
|
||||
|
||||
return sigdb;
|
||||
}
|
||||
|
@ -274,6 +274,8 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant(ConfigColor("gui.imports"));
|
||||
} else if (functionIsMain(function.offset)) {
|
||||
return QVariant(ConfigColor("gui.main"));
|
||||
} else if (function.name.startsWith("flirt.")) {
|
||||
return QVariant(ConfigColor("gui.flirt"));
|
||||
}
|
||||
|
||||
return QVariant(this->property("color"));
|
||||
|
Loading…
Reference in New Issue
Block a user