Added rop gadget search (#403)

This commit is contained in:
fcasal 2018-03-16 09:07:41 +00:00 committed by xarkes
parent c6245125e5
commit 0a252bda7b
2 changed files with 30 additions and 9 deletions

View File

@ -1466,20 +1466,40 @@ QList<SearchDescription> 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;
}

View File

@ -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);