mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 10:35:25 +00:00
Add sha256 and crc32 to the hexdump widget (#2006)
* Add SHA256 and CRC32 to hexdump widget * Fix layout * Add copied-to-clipboard messages
This commit is contained in:
parent
b3776a6b73
commit
3eeb631c68
@ -29,6 +29,8 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) :
|
||||
|
||||
ui->copyMD5->setIcon(QIcon(":/img/icons/copy.svg"));
|
||||
ui->copySHA1->setIcon(QIcon(":/img/icons/copy.svg"));
|
||||
ui->copySHA256->setIcon(QIcon(":/img/icons/copy.svg"));
|
||||
ui->copyCRC32->setIcon(QIcon(":/img/icons/copy.svg"));
|
||||
|
||||
|
||||
ui->splitter->setChildrenCollapsible(false);
|
||||
@ -51,10 +53,14 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) :
|
||||
showSidePanel(true);
|
||||
});
|
||||
|
||||
ui->bytesMD5->setPlaceholderText("Select bytes to display information");
|
||||
ui->bytesEntropy->setPlaceholderText("Select bytes to display information");
|
||||
ui->bytesSHA1->setPlaceholderText("Select bytes to display information");
|
||||
ui->hexDisasTextEdit->setPlaceholderText("Select bytes to display information");
|
||||
// Set placeholders for the line-edit components
|
||||
QString placeholder = tr("Select bytes to display information");
|
||||
ui->bytesMD5->setPlaceholderText(placeholder);
|
||||
ui->bytesEntropy->setPlaceholderText(placeholder);
|
||||
ui->bytesSHA1->setPlaceholderText(placeholder);
|
||||
ui->bytesSHA256->setPlaceholderText(placeholder);
|
||||
ui->bytesCRC32->setPlaceholderText(placeholder);
|
||||
ui->hexDisasTextEdit->setPlaceholderText(placeholder);
|
||||
|
||||
setupFonts();
|
||||
|
||||
@ -190,6 +196,8 @@ void HexdumpWidget::clearParseWindow()
|
||||
ui->bytesEntropy->setText("");
|
||||
ui->bytesMD5->setText("");
|
||||
ui->bytesSHA1->setText("");
|
||||
ui->bytesSHA256->setText("");
|
||||
ui->bytesCRC32->setText("");
|
||||
}
|
||||
|
||||
void HexdumpWidget::showSidePanel(bool show)
|
||||
@ -271,9 +279,13 @@ void HexdumpWidget::updateParseWindow(RVA start_address, int size)
|
||||
// Fill the information tab hashes and entropy
|
||||
ui->bytesMD5->setText(Core()->cmd("ph md5 " + argument).trimmed());
|
||||
ui->bytesSHA1->setText(Core()->cmd("ph sha1 " + argument).trimmed());
|
||||
ui->bytesSHA256->setText(Core()->cmd("ph sha256 " + argument).trimmed());
|
||||
ui->bytesCRC32->setText(Core()->cmd("ph crc32 " + argument).trimmed());
|
||||
ui->bytesEntropy->setText(Core()->cmd("ph entropy " + argument).trimmed());
|
||||
ui->bytesMD5->setCursorPosition(0);
|
||||
ui->bytesSHA1->setCursorPosition(0);
|
||||
ui->bytesSHA256->setCursorPosition(0);
|
||||
ui->bytesCRC32->setCursorPosition(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,8 +345,7 @@ void HexdumpWidget::on_copyMD5_clicked()
|
||||
QString md5 = ui->bytesMD5->text();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(md5);
|
||||
// FIXME
|
||||
// this->main->addOutput("MD5 copied to clipboard: " + md5);
|
||||
Core()->message("MD5 copied to clipboard: " + md5);
|
||||
}
|
||||
|
||||
void HexdumpWidget::on_copySHA1_clicked()
|
||||
@ -342,10 +353,24 @@ void HexdumpWidget::on_copySHA1_clicked()
|
||||
QString sha1 = ui->bytesSHA1->text();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(sha1);
|
||||
// FIXME
|
||||
// this->main->addOutput("SHA1 copied to clipboard: " + sha1);
|
||||
Core()->message("SHA1 copied to clipboard: " + sha1);
|
||||
}
|
||||
|
||||
void HexdumpWidget::on_copySHA256_clicked()
|
||||
{
|
||||
QString sha256 = ui->bytesSHA256->text();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(sha256);
|
||||
Core()->message("SHA256 copied to clipboard: " + sha256);
|
||||
}
|
||||
|
||||
void HexdumpWidget::on_copyCRC32_clicked()
|
||||
{
|
||||
QString crc32 = ui->bytesCRC32->text();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(crc32);
|
||||
Core()->message("CRC32 copied to clipboard: " + crc32);
|
||||
}
|
||||
|
||||
void HexdumpWidget::selectHexPreview()
|
||||
{
|
||||
|
@ -79,6 +79,8 @@ private slots:
|
||||
void on_hexSideTab_2_currentChanged(int index);
|
||||
void on_copyMD5_clicked();
|
||||
void on_copySHA1_clicked();
|
||||
void on_copySHA256_clicked();
|
||||
void on_copyCRC32_clicked();
|
||||
};
|
||||
|
||||
#endif // HEXDUMPWIDGET_H
|
||||
|
@ -57,7 +57,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
@ -334,52 +334,185 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabHistogram_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string notr="true">Information</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelSHA256">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SHA256:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="bytesMD5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSHA1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SHA1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" alignment="Qt::AlignRight">
|
||||
<widget class="QToolButton" name="copySHA256">
|
||||
<property name="toolTip">
|
||||
<string>Copy SHA256</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="copySHA1">
|
||||
<property name="toolTip">
|
||||
<string notr="true">Copy SHA1</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="bytesCRC32">
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" alignment="Qt::AlignRight">
|
||||
<widget class="QToolButton" name="copyCRC32">
|
||||
<property name="toolTip">
|
||||
<string>Copy CRC32</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="bytesEntropy">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="labelEntropy">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Entropy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="bytesSHA1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelMD5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -389,96 +522,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="bytesMD5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyMD5">
|
||||
<property name="toolTip">
|
||||
<string notr="true">Copy MD5</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>SHA1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="bytesSHA1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="copySHA1">
|
||||
<property name="toolTip">
|
||||
<string notr="true">Copy SHA1</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Entropy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="bytesEntropy">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelCRC32">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CRC32:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="copyMD5">
|
||||
<property name="toolTip">
|
||||
<string notr="true">Copy MD5</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="bytesSHA256">
|
||||
<property name="frame">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
@ -487,6 +563,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user