mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Add entropy to Section widget (#480)
This commit is contained in:
parent
31c7289726
commit
eef5022469
@ -1164,7 +1164,10 @@ QList<SectionDescription> CutterCore::getAllSections()
|
||||
CORE_LOCK();
|
||||
QList<SectionDescription> ret;
|
||||
|
||||
QJsonArray sectionsArray = cmdj("Sj").array();
|
||||
QJsonDocument sectionsDoc = cmdj("iSj entropy");
|
||||
QJsonObject sectionsObj = sectionsDoc.object();
|
||||
QJsonArray sectionsArray = sectionsObj["sections"].toArray();
|
||||
|
||||
for (QJsonValue value : sectionsArray) {
|
||||
QJsonObject sectionObject = value.toObject();
|
||||
|
||||
@ -1179,6 +1182,7 @@ QList<SectionDescription> CutterCore::getAllSections()
|
||||
section.paddr = sectionObject["paddr"].toVariant().toULongLong();
|
||||
section.size = sectionObject["size"].toVariant().toULongLong();
|
||||
section.flags = sectionObject["flags"].toString();
|
||||
section.entropy = sectionObject["entropy"].toString();
|
||||
|
||||
ret << section;
|
||||
}
|
||||
|
@ -165,6 +165,7 @@ struct SectionDescription {
|
||||
RVA vsize;
|
||||
QString name;
|
||||
QString flags;
|
||||
QString entropy;
|
||||
};
|
||||
|
||||
struct EntrypointDescription {
|
||||
|
@ -58,6 +58,8 @@ QVariant SectionsModel::data(const QModelIndex &index, int role) const
|
||||
return RAddressString(section.vaddr);
|
||||
case SectionsModel::EndAddressColumn:
|
||||
return RAddressString(section.vaddr + section.size);
|
||||
case SectionsModel::EntropyColumn:
|
||||
return section.entropy;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -85,6 +87,8 @@ QVariant SectionsModel::headerData(int section, Qt::Orientation, int role) const
|
||||
return tr("Address");
|
||||
case SectionsModel::EndAddressColumn:
|
||||
return tr("EndAddress");
|
||||
case SectionsModel::EntropyColumn:
|
||||
return tr("Entropy");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -136,6 +140,9 @@ bool SectionsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri
|
||||
case SectionsModel::AddressColumn:
|
||||
case SectionsModel::EndAddressColumn:
|
||||
return leftSection.vaddr < rightSection.vaddr;
|
||||
case SectionsModel::EntropyColumn:
|
||||
return leftSection.entropy < rightSection.entropy;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ private:
|
||||
QList<SectionDescription> *sections;
|
||||
|
||||
public:
|
||||
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, ColumnCount };
|
||||
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, EntropyColumn, ColumnCount };
|
||||
enum Role { SectionDescriptionRole = Qt::UserRole };
|
||||
|
||||
SectionsModel(QList<SectionDescription> *sections, QObject *parent = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user