aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2021-09-11 14:36:20 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2021-09-11 14:41:15 +0200
commit147aadea4420c83b18c8373ad611a5d9e0ab4b6d (patch)
tree4de8bd17153a83c770a20834bdac62cb4a3a41d4 /ui/qt
parent21339ceed0eed9c00e3609a98999ab071df87e2a (diff)
Qt: Add Decode as Hex Digits in Show Packet Bytes
Non-hex character in the data are skipped, enabling the decoding to continue converting all hex digits found.
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/show_packet_bytes_dialog.cpp6
-rw-r--r--ui/qt/show_packet_bytes_dialog.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/ui/qt/show_packet_bytes_dialog.cpp b/ui/qt/show_packet_bytes_dialog.cpp
index 5d330f1297..0d6052c7d3 100644
--- a/ui/qt/show_packet_bytes_dialog.cpp
+++ b/ui/qt/show_packet_bytes_dialog.cpp
@@ -59,6 +59,7 @@ ShowPacketBytesDialog::ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf) :
ui->cbDecodeAs->addItem(tr("None"), DecodeAsNone);
ui->cbDecodeAs->addItem(tr("Base64"), DecodeAsBASE64);
ui->cbDecodeAs->addItem(tr("Compressed"), DecodeAsCompressed);
+ ui->cbDecodeAs->addItem(tr("Hex Digits"), DecodeAsHexDigits);
ui->cbDecodeAs->addItem(tr("Quoted-Printable"), DecodeAsQuotedPrintable);
ui->cbDecodeAs->addItem(tr("ROT13"), DecodeAsROT13);
ui->cbDecodeAs->blockSignals(false);
@@ -549,6 +550,11 @@ void ShowPacketBytesDialog::updateFieldBytes(bool initialization)
break;
}
+ case DecodeAsHexDigits:
+ bytes = tvb_get_ptr(finfo_->ds_tvb, start, -1);
+ field_bytes_ = QByteArray::fromHex(QByteArray::fromRawData((const char *)bytes, length));
+ break;
+
case DecodeAsQuotedPrintable:
bytes = tvb_get_ptr(finfo_->ds_tvb, start, -1);
field_bytes_ = decodeQuotedPrintable(bytes, length);
diff --git a/ui/qt/show_packet_bytes_dialog.h b/ui/qt/show_packet_bytes_dialog.h
index b52850d171..4b9252e9ae 100644
--- a/ui/qt/show_packet_bytes_dialog.h
+++ b/ui/qt/show_packet_bytes_dialog.h
@@ -68,6 +68,7 @@ private:
DecodeAsNone,
DecodeAsBASE64,
DecodeAsCompressed,
+ DecodeAsHexDigits,
DecodeAsQuotedPrintable,
DecodeAsROT13
};