diff --git a/src/Cutter.cpp b/src/Cutter.cpp index eade247f..8867f28a 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -1466,20 +1466,40 @@ QList CutterCore::getAllSearch(QString search_for, QString sp QJsonArray searchArray = cmdj(space + QString(" ") + search_for).array(); - foreach (QJsonValue value, searchArray) + if (space == "/Rj") { - QJsonObject searchObject = value.toObject(); + foreach (QJsonValue value, searchArray) + { + QJsonObject searchObject = value.toObject(); + SearchDescription exp; + exp.code = QString(""); + foreach (QJsonValue value2, searchObject["opcodes"].toArray()) + { + QJsonObject gadget = value2.toObject(); + exp.code += gadget["opcode"].toString() + "; "; + } - SearchDescription exp; + exp.offset = searchObject["opcodes"].toArray().first().toObject()["offset"].toVariant().toULongLong(); + exp.size = searchObject["size"].toVariant().toULongLong(); - exp.offset = searchObject["offset"].toVariant().toULongLong(); - exp.size = searchObject["len"].toVariant().toULongLong(); - exp.code = searchObject["code"].toString(); - exp.data = searchObject["data"].toString(); - - ret << exp; + ret << exp; + } } + else + { + foreach (QJsonValue value, searchArray) + { + QJsonObject searchObject = value.toObject(); + SearchDescription exp; + exp.offset = searchObject["offset"].toVariant().toULongLong(); + exp.size = searchObject["len"].toVariant().toULongLong(); + exp.code = searchObject["code"].toString(); + exp.data = searchObject["data"].toString(); + + ret << exp; + } + } return ret; } diff --git a/src/widgets/SearchWidget.cpp b/src/widgets/SearchWidget.cpp index 60b4f882..e9e0b0d0 100644 --- a/src/widgets/SearchWidget.cpp +++ b/src/widgets/SearchWidget.cpp @@ -173,6 +173,7 @@ void SearchWidget::refreshSearchspaces() ui->searchspaceCombo->addItem(tr("asm code"), QVariant("/cj")); ui->searchspaceCombo->addItem(tr("string"), QVariant("/j")); ui->searchspaceCombo->addItem(tr("hex string"), QVariant("/xj")); + ui->searchspaceCombo->addItem(tr("ROP gadgets"), QVariant("/Rj")); if (cur_idx > 0) ui->searchspaceCombo->setCurrentIndex(cur_idx);