├── README.md ├── xdataconvertorwidget.pri ├── xdataconvertorwidget.cmake ├── LICENSE ├── dialogxdataconvertor.h ├── dialogxdataconvertor.ui ├── dialogxdataconvertor.cpp ├── xdataconvertorwidget.h ├── xdataconvertorwidget.cpp └── xdataconvertorwidget.ui /README.md: -------------------------------------------------------------------------------- 1 | # XDataConvertorWidget 2 | -------------------------------------------------------------------------------- /xdataconvertorwidget.pri: -------------------------------------------------------------------------------- 1 | QT += concurrent 2 | 3 | INCLUDEPATH += $$PWD 4 | DEPENDPATH += $$PWD 5 | 6 | HEADERS += \ 7 | $$PWD/dialogxdataconvertor.h \ 8 | $$PWD/xdataconvertorwidget.h 9 | 10 | SOURCES += \ 11 | $$PWD/dialogxdataconvertor.cpp \ 12 | $$PWD/xdataconvertorwidget.cpp 13 | 14 | FORMS += \ 15 | $$PWD/dialogxdataconvertor.ui \ 16 | $$PWD/xdataconvertorwidget.ui 17 | 18 | !contains(XCONFIG, xdataconvertor) { 19 | XCONFIG += xdataconvertor 20 | include($$PWD/../Formats/xdataconvertor.pri) 21 | } 22 | 23 | DISTFILES += \ 24 | $$PWD/LICENSE \ 25 | $$PWD/README.md \ 26 | $$PWD/xdataconvertorwidget.cmake 27 | -------------------------------------------------------------------------------- /xdataconvertorwidget.cmake: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | if (NOT DEFINED XDATACONVERTOR_SOURCES) 4 | include(${CMAKE_CURRENT_LIST_DIR}/../Formats/xdataconvertor.cmake) 5 | set(XDATACONVERTORWIDGET_SOURCES ${XDATACONVERTORWIDGET_SOURCES} ${XDATACONVERTOR_SOURCES}) 6 | endif() 7 | 8 | set(XDATACONVERTORWIDGET_SOURCES 9 | ${XDATACONVERTORWIDGET_SOURCES} 10 | ${CMAKE_CURRENT_LIST_DIR}/xdataconvertorwidget.cpp 11 | ${CMAKE_CURRENT_LIST_DIR}/xdataconvertorwidget.h 12 | ${CMAKE_CURRENT_LIST_DIR}/xdataconvertorwidget.ui 13 | ${CMAKE_CURRENT_LIST_DIR}/dialogxdataconvertor.cpp 14 | ${CMAKE_CURRENT_LIST_DIR}/dialogxdataconvertor.h 15 | ${CMAKE_CURRENT_LIST_DIR}/dialogxdataconvertor.ui 16 | ) 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-2025 hors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dialogxdataconvertor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DIALOGXDATACONVERTOR_H 22 | #define DIALOGXDATACONVERTOR_H 23 | 24 | #include "xshortcutsdialog.h" 25 | 26 | namespace Ui { 27 | class DialogXDataConvertor; 28 | } 29 | 30 | class DialogXDataConvertor : public XShortcutsDialog { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit DialogXDataConvertor(QWidget *pParent = nullptr); 35 | ~DialogXDataConvertor(); 36 | 37 | virtual void adjustView(); 38 | void setData(QIODevice *pDevice); 39 | 40 | virtual void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 41 | 42 | private slots: 43 | void on_pushButtonOK_clicked(); 44 | 45 | protected: 46 | virtual void registerShortcuts(bool bState); 47 | 48 | private: 49 | Ui::DialogXDataConvertor *ui; 50 | }; 51 | 52 | #endif // DIALOGXDATACONVERTOR_H 53 | -------------------------------------------------------------------------------- /dialogxdataconvertor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogXDataConvertor 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 935 13 | 462 14 | 15 | 16 | 17 | Data convertor 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Qt::Horizontal 39 | 40 | 41 | 42 | 40 43 | 20 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | OK 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | XDataConvertorWidget 62 | QWidget 63 |
xdataconvertorwidget.h
64 | 1 65 |
66 |
67 | 68 | 69 |
70 | -------------------------------------------------------------------------------- /dialogxdataconvertor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dialogxdataconvertor.h" 22 | #include "ui_dialogxdataconvertor.h" 23 | 24 | DialogXDataConvertor::DialogXDataConvertor(QWidget *pParent) : XShortcutsDialog(pParent, true), ui(new Ui::DialogXDataConvertor) 25 | { 26 | ui->setupUi(this); 27 | } 28 | 29 | DialogXDataConvertor::~DialogXDataConvertor() 30 | { 31 | delete ui; 32 | } 33 | 34 | void DialogXDataConvertor::adjustView() 35 | { 36 | } 37 | 38 | void DialogXDataConvertor::setData(QIODevice *pDevice) 39 | { 40 | ui->widgetDataConvertor->setData(pDevice); 41 | } 42 | 43 | void DialogXDataConvertor::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 44 | { 45 | ui->widgetDataConvertor->setGlobal(pShortcuts, pXOptions); 46 | 47 | XShortcutsDialog::setGlobal(pShortcuts, pXOptions); 48 | } 49 | 50 | void DialogXDataConvertor::on_pushButtonOK_clicked() 51 | { 52 | this->close(); 53 | } 54 | 55 | void DialogXDataConvertor::registerShortcuts(bool bState) 56 | { 57 | Q_UNUSED(bState) 58 | } 59 | -------------------------------------------------------------------------------- /xdataconvertorwidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef XDATACONVERTORWIDGET_H 22 | #define XDATACONVERTORWIDGET_H 23 | 24 | #include "xshortcutswidget.h" 25 | #include 26 | 27 | #include "xbinary.h" 28 | #include "xoptions.h" 29 | #include "xhexview.h" 30 | #include "xdialogprocess.h" 31 | #include "xdataconvertor.h" 32 | 33 | namespace Ui { 34 | class XDataConvertorWidget; 35 | } 36 | 37 | class XDataConvertorWidget : public XShortcutsWidget { 38 | Q_OBJECT 39 | 40 | enum CMETHOD { 41 | CMETHOD_UNKNOWN = 0, 42 | CMETHOD_NONE, 43 | CMETHOD_XOR, 44 | CMETHOD_ADDSUB, 45 | CMETHOD_BASE64, 46 | // TODO more 47 | }; 48 | 49 | enum SM { 50 | SM_BYTE = 0, 51 | SM_WORD, 52 | SM_DWORD, 53 | SM_QWORD 54 | }; 55 | 56 | public: 57 | explicit XDataConvertorWidget(QWidget *pParent = nullptr); 58 | ~XDataConvertorWidget(); 59 | 60 | virtual void adjustView(); 61 | 62 | void setData(QIODevice *pDevice); 63 | 64 | virtual void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 65 | virtual void reloadData(bool bSaveSelection); 66 | 67 | private slots: 68 | void on_listWidgetMethods_itemClicked(QListWidgetItem *pItem); 69 | void on_listWidgetMethods_currentItemChanged(QListWidgetItem *pCurrent, QListWidgetItem *pPrevious); 70 | void on_comboBoxXORmethod_currentIndexChanged(int nIndex); 71 | void on_pushButtonXOR_clicked(); 72 | void on_comboBoxADDSUBmethod_currentIndexChanged(int nIndex); 73 | void on_pushButtonADD_clicked(); 74 | void on_pushButtonSUB_clicked(); 75 | void on_pushButtonBase64Encode_clicked(); 76 | void on_pushButtonBase64Decode_clicked(); 77 | void on_pushButtonDumpInput_clicked(); 78 | void on_pushButtonDumpOutput_clicked(); 79 | 80 | private: 81 | void _addMethod(const QString &sName, CMETHOD method); 82 | void showMethod(CMETHOD method); 83 | void process(CMETHOD method, XDataConvertor::CMETHOD methodConvertor, const XDataConvertor::OPTIONS &options); 84 | 85 | protected: 86 | virtual void registerShortcuts(bool bState); 87 | 88 | private: 89 | Ui::XDataConvertorWidget *ui; 90 | QIODevice *m_pDevice; 91 | XBinaryView::OPTIONS m_hexOptions; 92 | QMap m_mapData; 93 | }; 94 | 95 | #endif // XDATACONVERTORWIDGET_H 96 | -------------------------------------------------------------------------------- /xdataconvertorwidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "xdataconvertorwidget.h" 22 | #include "ui_xdataconvertorwidget.h" 23 | 24 | XDataConvertorWidget::XDataConvertorWidget(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::XDataConvertorWidget) 25 | { 26 | ui->setupUi(this); 27 | 28 | m_pDevice = nullptr; 29 | ui->lineEditSizeInput->setReadOnly(true); 30 | ui->lineEditSizeOutput->setReadOnly(true); 31 | ui->lineEditEntropyInput->setReadOnly(true); 32 | ui->lineEditEntropyOutput->setReadOnly(true); 33 | 34 | ui->listWidgetMethods->blockSignals(true); 35 | 36 | _addMethod(QString(""), CMETHOD_NONE); 37 | _addMethod(QString("XOR"), CMETHOD_XOR); 38 | _addMethod(QString("ADD/SUB"), CMETHOD_ADDSUB); 39 | _addMethod(QString("Base64"), CMETHOD_BASE64); 40 | 41 | XOptions::adjustListWidgetSize(ui->listWidgetMethods); 42 | 43 | ui->listWidgetMethods->blockSignals(false); 44 | 45 | m_hexOptions = {}; 46 | ui->widgetHexInput->setContextMenuEnable(false); 47 | ui->widgetHexOutput->setContextMenuEnable(false); 48 | 49 | ui->stackedWidgetOptions->setCurrentWidget(ui->pageOriginal); 50 | 51 | { 52 | ui->comboBoxXORmethod->blockSignals(true); 53 | 54 | ui->comboBoxXORmethod->addItem("BYTE", SM_BYTE); 55 | ui->comboBoxXORmethod->addItem("WORD", SM_WORD); 56 | ui->comboBoxXORmethod->addItem("DWORD", SM_DWORD); 57 | ui->comboBoxXORmethod->addItem("QWORD", SM_QWORD); 58 | 59 | ui->lineEditXORValue->setValidatorModeValue(XLineEditValidator::MODE_HEX_8, 0); 60 | 61 | ui->comboBoxXORmethod->blockSignals(false); 62 | } 63 | { 64 | ui->comboBoxADDSUBmethod->blockSignals(true); 65 | 66 | ui->comboBoxADDSUBmethod->addItem("BYTE", SM_BYTE); 67 | ui->comboBoxADDSUBmethod->addItem("WORD", SM_WORD); 68 | ui->comboBoxADDSUBmethod->addItem("DWORD", SM_DWORD); 69 | ui->comboBoxADDSUBmethod->addItem("QWORD", SM_QWORD); 70 | 71 | ui->lineEditADDSUBValue->setValidatorModeValue(XLineEditValidator::MODE_HEX_8, 0); 72 | 73 | ui->comboBoxADDSUBmethod->blockSignals(false); 74 | } 75 | } 76 | 77 | XDataConvertorWidget::~XDataConvertorWidget() 78 | { 79 | delete ui; 80 | } 81 | 82 | void XDataConvertorWidget::adjustView() 83 | { 84 | // TODO 85 | } 86 | 87 | void XDataConvertorWidget::setData(QIODevice *pDevice) 88 | { 89 | m_pDevice = pDevice; 90 | 91 | ui->widgetHexInput->setData(pDevice, m_hexOptions, true); 92 | 93 | XDataConvertor::OPTIONS options = {}; 94 | process(CMETHOD_NONE, XDataConvertor::CMETHOD_NONE, options); 95 | 96 | ui->listWidgetMethods->setCurrentRow(0); 97 | } 98 | 99 | void XDataConvertorWidget::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 100 | { 101 | ui->widgetHexInput->setGlobal(pShortcuts, pXOptions); 102 | ui->widgetHexOutput->setGlobal(pShortcuts, pXOptions); 103 | 104 | XShortcutsWidget::setGlobal(pShortcuts, pXOptions); 105 | } 106 | 107 | void XDataConvertorWidget::reloadData(bool bSaveSelection) 108 | { 109 | Q_UNUSED(bSaveSelection) 110 | } 111 | 112 | void XDataConvertorWidget::_addMethod(const QString &sName, CMETHOD method) 113 | { 114 | QListWidgetItem *pItem = new QListWidgetItem(sName); 115 | pItem->setData(Qt::UserRole, method); 116 | 117 | ui->listWidgetMethods->addItem(pItem); 118 | 119 | XDataConvertor::DATA _data = {}; 120 | _data.bValid = false; 121 | 122 | m_mapData.insert(method, _data); 123 | } 124 | 125 | void XDataConvertorWidget::showMethod(CMETHOD method) 126 | { 127 | XDataConvertor::DATA _data = m_mapData.value(method); 128 | 129 | ui->lineEditEntropyOutput->setValue_double(_data.dEntropy); 130 | 131 | if (method == CMETHOD_NONE) { 132 | ui->lineEditEntropyInput->setValue_double(_data.dEntropy); 133 | ui->lineEditSizeInput->setValue_uint64(m_pDevice->size(), XLineEditHEX::_MODE_SIZE); 134 | ui->widgetHexOutput->setData(m_pDevice, m_hexOptions, true); 135 | ui->lineEditSizeOutput->setValue_uint64(m_pDevice->size(), XLineEditHEX::_MODE_SIZE); 136 | } else if (_data.bValid) { 137 | ui->widgetHexOutput->setData(_data.pTmpFile, m_hexOptions, true); 138 | ui->lineEditSizeOutput->setValue_uint64(_data.pTmpFile->size(), XLineEditHEX::_MODE_SIZE); 139 | } else { 140 | ui->widgetHexOutput->reset(); 141 | ui->lineEditSizeOutput->setValue_uint64(0, XLineEditHEX::_MODE_SIZE); 142 | } 143 | 144 | if (method == CMETHOD_NONE) { 145 | ui->stackedWidgetOptions->setCurrentWidget(ui->pageOriginal); 146 | } else if (method == CMETHOD_XOR) { 147 | ui->stackedWidgetOptions->setCurrentWidget(ui->pageXOR); 148 | } else if (method == CMETHOD_ADDSUB) { 149 | ui->stackedWidgetOptions->setCurrentWidget(ui->pageADDSUB); 150 | } else if (method == CMETHOD_BASE64) { 151 | ui->stackedWidgetOptions->setCurrentWidget(ui->pageBASE64); 152 | } 153 | } 154 | 155 | void XDataConvertorWidget::process(CMETHOD method, XDataConvertor::CMETHOD methodConvertor, const XDataConvertor::OPTIONS &options) 156 | { 157 | XDataConvertor::DATA _data = {}; 158 | 159 | XDataConvertor dataConverter; 160 | XDialogProcess dcp(this, &dataConverter); 161 | dcp.setGlobal(getShortcuts(), getGlobalOptions()); 162 | dataConverter.setData(m_pDevice, &_data, methodConvertor, options, dcp.getPdStruct()); 163 | dcp.start(); 164 | 165 | if (dcp.showDialogDelay() == QDialog::Accepted) { 166 | if (m_mapData[method].pTmpFile) { 167 | delete m_mapData[method].pTmpFile; 168 | } 169 | 170 | m_mapData[method] = _data; 171 | } 172 | 173 | showMethod(method); 174 | } 175 | 176 | void XDataConvertorWidget::registerShortcuts(bool bState) 177 | { 178 | Q_UNUSED(bState) 179 | } 180 | 181 | void XDataConvertorWidget::on_listWidgetMethods_itemClicked(QListWidgetItem *pItem) 182 | { 183 | CMETHOD method = (CMETHOD)(pItem->data(Qt::UserRole).toInt()); 184 | 185 | showMethod(method); 186 | } 187 | 188 | void XDataConvertorWidget::on_listWidgetMethods_currentItemChanged(QListWidgetItem *pCurrent, QListWidgetItem *pPrevious) 189 | { 190 | Q_UNUSED(pPrevious) 191 | 192 | CMETHOD method = (CMETHOD)(pCurrent->data(Qt::UserRole).toInt()); 193 | 194 | showMethod(method); 195 | } 196 | 197 | void XDataConvertorWidget::on_comboBoxXORmethod_currentIndexChanged(int nIndex) 198 | { 199 | Q_UNUSED(nIndex) 200 | 201 | SM sm = (SM)(ui->comboBoxXORmethod->currentData(Qt::UserRole).toUInt()); 202 | 203 | if (sm == SM_BYTE) { 204 | ui->lineEditXORValue->setValidatorMode(XLineEditValidator::MODE_HEX_8); 205 | } else if (sm == SM_WORD) { 206 | ui->lineEditXORValue->setValidatorMode(XLineEditValidator::MODE_HEX_16); 207 | } else if (sm == SM_DWORD) { 208 | ui->lineEditXORValue->setValidatorMode(XLineEditValidator::MODE_HEX_32); 209 | } else if (sm == SM_QWORD) { 210 | ui->lineEditXORValue->setValidatorMode(XLineEditValidator::MODE_HEX_64); 211 | } 212 | } 213 | 214 | void XDataConvertorWidget::on_pushButtonXOR_clicked() 215 | { 216 | XDataConvertor::CMETHOD methodConvertor = XDataConvertor::CMETHOD_UNKNOWN; 217 | XDataConvertor::OPTIONS options = {}; 218 | 219 | SM sm = (SM)(ui->comboBoxXORmethod->currentData(Qt::UserRole).toUInt()); 220 | 221 | if (sm == SM_BYTE) { 222 | methodConvertor = XDataConvertor::CMETHOD_XOR_BYTE; 223 | options.varKey = ui->lineEditXORValue->getValue_uint8(); 224 | } else if (sm == SM_WORD) { 225 | methodConvertor = XDataConvertor::CMETHOD_XOR_WORD; 226 | options.varKey = ui->lineEditXORValue->getValue_uint16(); 227 | } else if (sm == SM_DWORD) { 228 | methodConvertor = XDataConvertor::CMETHOD_XOR_DWORD; 229 | options.varKey = ui->lineEditXORValue->getValue_uint32(); 230 | } else if (sm == SM_QWORD) { 231 | methodConvertor = XDataConvertor::CMETHOD_XOR_QWORD; 232 | options.varKey = ui->lineEditXORValue->getValue_uint64(); 233 | } 234 | 235 | process(CMETHOD_XOR, methodConvertor, options); 236 | } 237 | 238 | void XDataConvertorWidget::on_comboBoxADDSUBmethod_currentIndexChanged(int nIndex) 239 | { 240 | Q_UNUSED(nIndex) 241 | 242 | SM sm = (SM)(ui->comboBoxADDSUBmethod->currentData(Qt::UserRole).toUInt()); 243 | 244 | if (sm == SM_BYTE) { 245 | ui->lineEditADDSUBValue->setValidatorMode(XLineEditValidator::MODE_HEX_8); 246 | } else if (sm == SM_WORD) { 247 | ui->lineEditADDSUBValue->setValidatorMode(XLineEditValidator::MODE_HEX_16); 248 | } else if (sm == SM_DWORD) { 249 | ui->lineEditADDSUBValue->setValidatorMode(XLineEditValidator::MODE_HEX_32); 250 | } else if (sm == SM_QWORD) { 251 | ui->lineEditADDSUBValue->setValidatorMode(XLineEditValidator::MODE_HEX_64); 252 | } 253 | } 254 | 255 | void XDataConvertorWidget::on_pushButtonADD_clicked() 256 | { 257 | XDataConvertor::CMETHOD methodConvertor = XDataConvertor::CMETHOD_UNKNOWN; 258 | XDataConvertor::OPTIONS options = {}; 259 | 260 | SM sm = (SM)(ui->comboBoxADDSUBmethod->currentData(Qt::UserRole).toUInt()); 261 | 262 | if (sm == SM_BYTE) { 263 | methodConvertor = XDataConvertor::CMETHOD_ADD_BYTE; 264 | options.varKey = ui->lineEditADDSUBValue->getValue_uint8(); 265 | } else if (sm == SM_WORD) { 266 | methodConvertor = XDataConvertor::CMETHOD_ADD_WORD; 267 | options.varKey = ui->lineEditADDSUBValue->getValue_uint16(); 268 | } else if (sm == SM_DWORD) { 269 | methodConvertor = XDataConvertor::CMETHOD_ADD_DWORD; 270 | options.varKey = ui->lineEditADDSUBValue->getValue_uint32(); 271 | } else if (sm == SM_QWORD) { 272 | methodConvertor = XDataConvertor::CMETHOD_ADD_QWORD; 273 | options.varKey = ui->lineEditADDSUBValue->getValue_uint64(); 274 | } 275 | 276 | process(CMETHOD_ADDSUB, methodConvertor, options); 277 | } 278 | 279 | void XDataConvertorWidget::on_pushButtonSUB_clicked() 280 | { 281 | XDataConvertor::CMETHOD methodConvertor = XDataConvertor::CMETHOD_UNKNOWN; 282 | XDataConvertor::OPTIONS options = {}; 283 | 284 | SM sm = (SM)(ui->comboBoxADDSUBmethod->currentData(Qt::UserRole).toUInt()); 285 | 286 | if (sm == SM_BYTE) { 287 | methodConvertor = XDataConvertor::CMETHOD_SUB_BYTE; 288 | options.varKey = ui->lineEditADDSUBValue->getValue_uint8(); 289 | } else if (sm == SM_WORD) { 290 | methodConvertor = XDataConvertor::CMETHOD_SUB_WORD; 291 | options.varKey = ui->lineEditADDSUBValue->getValue_uint16(); 292 | } else if (sm == SM_DWORD) { 293 | methodConvertor = XDataConvertor::CMETHOD_SUB_DWORD; 294 | options.varKey = ui->lineEditADDSUBValue->getValue_uint32(); 295 | } else if (sm == SM_QWORD) { 296 | methodConvertor = XDataConvertor::CMETHOD_SUB_QWORD; 297 | options.varKey = ui->lineEditADDSUBValue->getValue_uint64(); 298 | } 299 | 300 | process(CMETHOD_ADDSUB, methodConvertor, options); 301 | } 302 | 303 | void XDataConvertorWidget::on_pushButtonBase64Encode_clicked() 304 | { 305 | XDataConvertor::OPTIONS options = {}; 306 | process(CMETHOD_BASE64, XDataConvertor::CMETHOD_BASE64_ENCODE, options); 307 | } 308 | 309 | void XDataConvertorWidget::on_pushButtonBase64Decode_clicked() 310 | { 311 | XDataConvertor::OPTIONS options = {}; 312 | process(CMETHOD_BASE64, XDataConvertor::CMETHOD_BASE64_DECODE, options); 313 | } 314 | 315 | void XDataConvertorWidget::on_pushButtonDumpInput_clicked() 316 | { 317 | ui->widgetHexInput->dumpMemory(tr("Input")); 318 | } 319 | 320 | void XDataConvertorWidget::on_pushButtonDumpOutput_clicked() 321 | { 322 | ui->widgetHexOutput->dumpMemory(tr("Output")); 323 | } 324 | -------------------------------------------------------------------------------- /xdataconvertorwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | XDataConvertorWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 883 10 | 547 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 0 37 | 38 | 39 | 40 | Method 41 | 42 | 43 | 44 | 0 45 | 46 | 47 | 2 48 | 49 | 50 | 2 51 | 52 | 53 | 2 54 | 55 | 56 | 2 57 | 58 | 59 | 60 | 61 | 62 | 0 63 | 0 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 0 78 | 0 79 | 80 | 81 | 82 | 83 | 16777215 84 | 60 85 | 86 | 87 | 88 | 2 89 | 90 | 91 | 92 | 93 | 0 94 | 0 95 | 96 | 97 | 98 | 99 | 0 100 | 101 | 102 | 0 103 | 104 | 105 | 0 106 | 107 | 108 | 0 109 | 110 | 111 | 112 | 113 | 114 | 80 115 | 0 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 120 125 | 0 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Qt::Horizontal 134 | 135 | 136 | 137 | 439 138 | 20 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | XOR 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 0 156 | 157 | 158 | 0 159 | 160 | 161 | 0 162 | 163 | 164 | 0 165 | 166 | 167 | 168 | 169 | 170 | 80 171 | 0 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 120 181 | 0 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | Qt::Horizontal 190 | 191 | 192 | 193 | 71 194 | 20 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | ADD 203 | 204 | 205 | 206 | 207 | 208 | 209 | SUB 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 0 219 | 220 | 221 | 0 222 | 223 | 224 | 0 225 | 226 | 227 | 0 228 | 229 | 230 | 231 | 232 | Qt::Horizontal 233 | 234 | 235 | 236 | 301 237 | 20 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | Encode 246 | 247 | 248 | 249 | 250 | 251 | 252 | Decode 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 0 266 | 0 267 | 268 | 269 | 270 | Input 271 | 272 | 273 | 274 | 0 275 | 276 | 277 | 2 278 | 279 | 280 | 2 281 | 282 | 283 | 2 284 | 285 | 286 | 2 287 | 288 | 289 | 290 | 291 | 292 | 0 293 | 0 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | Size 304 | 305 | 306 | 307 | 2 308 | 309 | 310 | 2 311 | 312 | 313 | 2 314 | 315 | 316 | 2 317 | 318 | 319 | 320 | 321 | 322 | 0 323 | 0 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | Entropy 335 | 336 | 337 | 338 | 2 339 | 340 | 341 | 2 342 | 343 | 344 | 2 345 | 346 | 347 | 2 348 | 349 | 350 | 351 | 352 | 353 | 0 354 | 0 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | Qt::Vertical 366 | 367 | 368 | 369 | 20 370 | 40 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | Dump 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 0 392 | 0 393 | 394 | 395 | 396 | Output 397 | 398 | 399 | 400 | 0 401 | 402 | 403 | 2 404 | 405 | 406 | 2 407 | 408 | 409 | 2 410 | 411 | 412 | 2 413 | 414 | 415 | 416 | 417 | 418 | 0 419 | 0 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | Size 430 | 431 | 432 | 433 | 2 434 | 435 | 436 | 2 437 | 438 | 439 | 2 440 | 441 | 442 | 2 443 | 444 | 445 | 446 | 447 | 448 | 0 449 | 0 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | Entropy 461 | 462 | 463 | 464 | 2 465 | 466 | 467 | 2 468 | 469 | 470 | 2 471 | 472 | 473 | 2 474 | 475 | 476 | 477 | 478 | 479 | 0 480 | 0 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | Qt::Vertical 492 | 493 | 494 | 495 | 20 496 | 40 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | Dump 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | XHexView 522 | QWidget 523 |
xhexview.h
524 | 1 525 |
526 | 527 | XLineEditHEX 528 | QLineEdit 529 |
xlineedithex.h
530 |
531 |
532 | 533 | 534 |
535 | --------------------------------------------------------------------------------