mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Added rop gadget search (#403)
This commit is contained in:
parent
c6245125e5
commit
0a252bda7b
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user