diff --git a/src/Cutter.cpp b/src/Cutter.cpp index bd5ab385..c821ffb3 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -910,6 +910,57 @@ QList CutterCore::getRBinPluginDescriptions(const QString return ret; } +QList CutterCore::getRIOPluginDescriptions() +{ + QList ret; + + QJsonArray plugins = cmdj("oLj").object()["IO_Plugins"].toArray(); + for(QJsonValueRef pluginValue : plugins) + { + QJsonObject pluginObject = pluginValue.toObject(); + RIOPluginDescription plugin; + + plugin.name = pluginObject["Name"].toString(); + plugin.description = pluginObject["Description"].toString(); + plugin.license = pluginObject["License"].toString(); + plugin.permissions = pluginObject["Permissions"].toString(); + + ret << plugin; + } + + return ret; +} + +QList CutterCore::getRCorePluginDescriptions() +{ + QList ret; + + QJsonArray plugins = cmdj("Lsj").array(); + for(QJsonValueRef pluginValue : plugins) + { + QJsonObject pluginObject = pluginValue.toObject(); + RCorePluginDescription plugin; + + plugin.name = pluginObject["Name"].toString(); + plugin.description = pluginObject["Description"].toString(); + + ret << plugin; + } + + return ret; +} + +QStringList CutterCore::getRAsmPlugins() +{ + QStringList ret; + + QJsonArray plugins = cmdj("evj asm.arch").array()[0].toObject()["options"].toArray(); + for(QJsonValueRef pluginValue : plugins) + ret << pluginValue.toString(); + + return ret; +} + QList CutterCore::getAllFunctions() { CORE_LOCK(); diff --git a/src/Cutter.h b/src/Cutter.h index b6d4531c..00278fae 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -186,6 +186,20 @@ struct RBinPluginDescription QString type; }; +struct RIOPluginDescription +{ + QString name; + QString description; + QString license; + QString permissions; +}; + +struct RCorePluginDescription +{ + QString name; + QString description; +}; + struct DisassemblyLine { RVA offset; @@ -241,6 +255,8 @@ Q_DECLARE_METATYPE(FlagDescription) Q_DECLARE_METATYPE(XrefDescription) Q_DECLARE_METATYPE(EntrypointDescription) Q_DECLARE_METATYPE(RBinPluginDescription) +Q_DECLARE_METATYPE(RIOPluginDescription) +Q_DECLARE_METATYPE(RCorePluginDescription) Q_DECLARE_METATYPE(ClassMethodDescription) Q_DECLARE_METATYPE(ClassFieldDescription) Q_DECLARE_METATYPE(ClassDescription) @@ -371,6 +387,9 @@ public: static bool isProjectNameValid(const QString &name); QList getRBinPluginDescriptions(const QString &type = nullptr); + QList getRIOPluginDescriptions(); + QList getRCorePluginDescriptions(); + QStringList getRAsmPlugins(); QList getAllFunctions(); QList getAllImports(); diff --git a/src/Cutter.pro b/src/Cutter.pro index c879b745..7c6ecec3 100644 --- a/src/Cutter.pro +++ b/src/Cutter.pro @@ -140,7 +140,8 @@ SOURCES += \ utils/JupyterConnection.cpp \ widgets/JupyterWidget.cpp \ utils/PythonAPI.cpp \ - utils/NestedIPyKernel.cpp + utils/NestedIPyKernel.cpp \ + dialogs/R2PluginsDialog.cpp HEADERS += \ Cutter.h \ @@ -206,7 +207,8 @@ HEADERS += \ utils/JupyterConnection.h \ widgets/JupyterWidget.h \ utils/PythonAPI.h \ - utils/NestedIPyKernel.h + utils/NestedIPyKernel.h \ + dialogs/R2PluginsDialog.h FORMS += \ dialogs/AboutDialog.ui \ @@ -245,7 +247,8 @@ FORMS += \ widgets/VTablesWidget.ui \ widgets/TypesWidget.ui \ widgets/SearchWidget.ui \ - widgets/JupyterWidget.ui + widgets/JupyterWidget.ui \ + dialogs/R2PluginsDialog.ui RESOURCES += \ resources.qrc \ diff --git a/src/dialogs/AboutDialog.cpp b/src/dialogs/AboutDialog.cpp index 42521533..71374ba2 100644 --- a/src/dialogs/AboutDialog.cpp +++ b/src/dialogs/AboutDialog.cpp @@ -1,6 +1,7 @@ #include #include "AboutDialog.h" #include "ui_AboutDialog.h" +#include "R2PluginsDialog.h" #include "r_version.h" #include "utils/Configuration.h" @@ -53,3 +54,9 @@ void AboutDialog::on_showVersionButton_clicked() popup.setText(versionInformation); popup.exec(); } + +void AboutDialog::on_showPluginsButton_clicked() +{ + R2PluginsDialog dialog(this); + dialog.exec(); +} diff --git a/src/dialogs/AboutDialog.h b/src/dialogs/AboutDialog.h index 0ba86734..b99c77ca 100644 --- a/src/dialogs/AboutDialog.h +++ b/src/dialogs/AboutDialog.h @@ -20,6 +20,7 @@ public: private slots: void on_buttonBox_rejected(); void on_showVersionButton_clicked(); + void on_showPluginsButton_clicked(); private: std::unique_ptr ui; diff --git a/src/dialogs/AboutDialog.ui b/src/dialogs/AboutDialog.ui index 33aecd17..14e66f08 100644 --- a/src/dialogs/AboutDialog.ui +++ b/src/dialogs/AboutDialog.ui @@ -33,17 +33,37 @@ - - - - 0 - 0 - + + + QLayout::SetDefaultConstraint - - Show version information - - + + + + + 0 + 0 + + + + Show version information + + + + + + + + 0 + 0 + + + + Show plugin information + + + + diff --git a/src/dialogs/R2PluginsDialog.cpp b/src/dialogs/R2PluginsDialog.cpp new file mode 100644 index 00000000..985f3b5d --- /dev/null +++ b/src/dialogs/R2PluginsDialog.cpp @@ -0,0 +1,55 @@ +#include "R2PluginsDialog.h" +#include "ui_R2PluginsDialog.h" + +#include "Cutter.h" +#include "utils/Helpers.h" + +R2PluginsDialog::R2PluginsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::R2PluginsDialog) +{ + ui->setupUi(this); + + for(auto plugin : Core()->getRBinPluginDescriptions()) + { + QTreeWidgetItem* item = new QTreeWidgetItem(); + item->setText(0, plugin.name); + item->setText(1, plugin.description); + item->setText(2, plugin.license); + item->setText(3, plugin.type); + ui->RBinTreeWidget->addTopLevelItem(item); + } + qhelpers::adjustColumns(ui->RBinTreeWidget, 0); + + for(auto plugin : Core()->getRIOPluginDescriptions()) + { + QTreeWidgetItem* item = new QTreeWidgetItem(); + item->setText(0, plugin.name); + item->setText(1, plugin.description); + item->setText(2, plugin.license); + item->setText(3, plugin.permissions); + ui->RIOTreeWidget->addTopLevelItem(item); + } + qhelpers::adjustColumns(ui->RIOTreeWidget, 0); + + for(auto plugin : Core()->getRCorePluginDescriptions()) + { + QTreeWidgetItem* item = new QTreeWidgetItem(); + item->setText(0, plugin.name); + item->setText(1, plugin.description); + ui->RCoreTreeWidget->addTopLevelItem(item); + } + qhelpers::adjustColumns(ui->RCoreTreeWidget, 0); + + for(auto plugin : Core()->getRAsmPlugins()) + { + QTreeWidgetItem* item = new QTreeWidgetItem(); + item->setText(0, plugin); + ui->RAsmTreeWidget->addTopLevelItem(item); + } +} + +R2PluginsDialog::~R2PluginsDialog() +{ + delete ui; +} diff --git a/src/dialogs/R2PluginsDialog.h b/src/dialogs/R2PluginsDialog.h new file mode 100644 index 00000000..8e8a313a --- /dev/null +++ b/src/dialogs/R2PluginsDialog.h @@ -0,0 +1,26 @@ +#ifndef PLUGINSDIALOG_H +#define PLUGINSDIALOG_H + +#include +#include + +#include "Cutter.h" + +namespace Ui +{ + class R2PluginsDialog; +} + +class R2PluginsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit R2PluginsDialog(QWidget *parent = 0); + ~R2PluginsDialog(); + +private: + Ui::R2PluginsDialog *ui; +}; + +#endif // PLUGINSDIALOG_H diff --git a/src/dialogs/R2PluginsDialog.ui b/src/dialogs/R2PluginsDialog.ui new file mode 100644 index 00000000..8fca7041 --- /dev/null +++ b/src/dialogs/R2PluginsDialog.ui @@ -0,0 +1,142 @@ + + + R2PluginsDialog + + + radare2 plugin information + + + + + + + Name + + + + + Description + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + RIO plugins + + + + + + + RAsm plugins + + + + + + + + Name + + + + + + + + true + + + + Name + + + + + Description + + + + + License + + + + + Type + + + + + + + + + Name + + + + + Description + + + + + License + + + + + Permissions + + + + + + + + RCore plugins + + + + + + + RBin plugins + + + + + + + + + buttonBox + accepted() + R2PluginsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + +