diff --git a/src/OpenArk/coderkit/coderkit.cpp b/src/OpenArk/coderkit/coderkit.cpp index 70f31d8..0c2b5b5 100644 --- a/src/OpenArk/coderkit/coderkit.cpp +++ b/src/OpenArk/coderkit/coderkit.cpp @@ -50,6 +50,27 @@ CoderKit::CoderKit(QWidget* parent, int tabid) : ui.setupUi(this); connect(OpenArkLanguage::Instance(), &OpenArkLanguage::languageChaned, this, [this]() {ui.retranslateUi(this); }); + radio_group_type_.addButton(ui.nullRadio_2, 0); + radio_group_type_.addButton(ui.spaceRadio_2, 1); + radio_group_type_.addButton(ui.slashxRadio_2, 2); + radio_group_type_.addButton(ui.assembleRadio, 3); + + radio_group_interval_.addButton(ui.byteRadio, 0); + radio_group_interval_.addButton(ui.twoBytesRadio, 1); + radio_group_interval_.addButton(ui.fourBytesRadio, 2); + + ui.nullRadio_2->setChecked(true); + ui.byteRadio->setChecked(true); + + connect(ui.nullRadio_2, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.spaceRadio_2, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.slashxRadio_2, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.assembleRadio, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + + connect(ui.byteRadio, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.twoBytesRadio, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.fourBytesRadio, SIGNAL(clicked()), this, SLOT(onFormatChanged())); + connect(ui.textEdit, SIGNAL(textChanged()), this, SLOT(onCodeTextChanged())); connect(ui.defaultEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onCodeTextChanged(const QString &))); connect(ui.asciiEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onCodeTextChanged(const QString &))); @@ -70,6 +91,8 @@ CoderKit::CoderKit(QWidget* parent, int tabid) : connect(ui.msgidBtn, SIGNAL(clicked()), this, SLOT(onMessageId())); alg_idx_ = 0; + is_user_ = false; + is_format_changed_ = false; onAlgIndexChanged(alg_idx_); ui.typeBox->insertItem(IDX.base64, "Base64"); ui.typeBox->insertItem(IDX.crc32, "CRC32"); @@ -101,8 +124,9 @@ void CoderKit::onCodeTextChanged() std::wstring data; std::string str; QObject* sender = QObject::sender(); - if (sender == ui.textEdit) { + if (sender == ui.textEdit || is_format_changed_) { data = ui.textEdit->toPlainText().toStdWString(); + is_format_changed_ = false; } UpdateEditCodeText(data, sender); @@ -123,7 +147,23 @@ void CoderKit::onCodeTextChanged(const QString & text) UNONE::StrReplaceA(input, "\\x"); sender->setText(StrToQ(input)); }; - InputFilter(str); + is_user_ = ui.defaultEdit->isModified() + || ui.asciiEdit->isModified() + || ui.unicodeEdit->isModified() + || ui.utf7Edit->isModified() + || ui.utf8Edit->isModified() + || ui.utf16Edit->isModified() + || ui.butf16Edit->isModified() + || ui.utf32Edit->isModified() + || ui.butf32Edit->isModified() + || ui.gbkEdit->isModified() + || ui.big5Edit->isModified() + || ui.cp866Edit->isModified(); + if (is_user_) { + InputFilter(str); + } else { + return; + } str = UNONE::StrHexStrToStreamA(str); if (sender == ui.defaultEdit) { data = UNONE::StrACPToWide(str); @@ -223,6 +263,12 @@ void CoderKit::onAlgPlainChanged() } } +void CoderKit::onFormatChanged() +{ + is_format_changed_ = true; + onCodeTextChanged(); +} + void CoderKit::InitAsmToolsView() { ui.splitter->setStretchFactor(0, 1); @@ -332,50 +378,77 @@ void CoderKit::UpdateEditCodeText(const std::wstring& data, QObject* ignored_obj } }; + is_user_ = false; + + int interval = 2; + int id_interval = radio_group_interval_.checkedId(); + if (id_interval == 0) interval = 2; + else if (id_interval == 1) interval = 4; + else if (id_interval == 1) interval = 8; + + std::string format = ""; + int id_format = radio_group_type_.checkedId(); + if (id_format == 0) format = ""; + else if (id_format == 1) format = " "; + else if (id_format == 2) format = "\\x"; + else if (id_format == 3) format = "h, ", interval = 2; + std::string text; text = UNONE::StrWideToUTF8(data); SetText(ui.textEdit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToACP(data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.defaultEdit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrACPToCode(437, UNONE::StrToA(data))); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.asciiEdit, text); text = UNONE::StrStreamToHexStrA(std::string((char*)data.c_str(), data.size() * 2)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.unicodeEdit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToCode(CP_UTF7, data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.utf7Edit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToCode(CP_UTF8, data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.utf8Edit, text); text = UNONE::StrStreamToHexStrA(std::string((char*)data.c_str(), data.size() * 2)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.utf16Edit, text); auto stream = std::string((char*)data.c_str(), data.size() * 2); stream = UNONE::StrReverseA(stream, 2); text = UNONE::StrStreamToHexStrA(stream); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.butf16Edit, text); U32Convert cvt32; auto utf32 = cvt32.from_bytes(UNONE::StrWideToCode(CP_UTF8, data)); stream = std::string((char*)utf32.c_str(), utf32.size() * 4); text = UNONE::StrStreamToHexStrA(stream); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.utf32Edit, text); stream = UNONE::StrReverseA(stream, 4); text = UNONE::StrStreamToHexStrA(stream); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.butf32Edit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToCode(936, data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.gbkEdit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToCode(950, data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.big5Edit, text); text = UNONE::StrStreamToHexStrA(UNONE::StrWideToCode(866, data)); + SolveCodeTextFormat(text, format, interval, id_format); SetText(ui.cp866Edit, text); } @@ -422,4 +495,16 @@ QString CoderKit::NasmDisasm(const std::string &data, int bits) if (!ret) return tr("start ndisasm error"); UNONE::StrLowerW(out); return WStrToQ(out); +} + +void CoderKit::SolveCodeTextFormat(std::string &text, std::string &format, int interval, int id) +{ + + if (id == 3) { + // assemble + text = UNONE::StrInsertA(text, interval, format); + text = text + "h"; + } else { + text = format + UNONE::StrInsertA(text, interval, format); + } } \ No newline at end of file diff --git a/src/OpenArk/coderkit/coderkit.h b/src/OpenArk/coderkit/coderkit.h index 9d16ee6..af683cf 100644 --- a/src/OpenArk/coderkit/coderkit.h +++ b/src/OpenArk/coderkit/coderkit.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include "ui_coderkit.h" @@ -44,6 +45,7 @@ private slots: void onMessageId(); void onAlgIndexChanged(int index); void onAlgPlainChanged(); + void onFormatChanged(); private: void InitAsmToolsView(); @@ -52,10 +54,15 @@ private slots: void UpdateEditCodeText(const std::wstring& data, QObject* ignored_obj); QString NasmAsm(std::string data, int bits, const std::string &format); QString NasmDisasm(const std::string &data, int bits); + void SolveCodeTextFormat(std::string &text, std::string &format, int interval, int id); private: Ui::CoderKit ui; OpenArk* parent_; std::mutex upt_mutex_; int alg_idx_; + bool is_user_; + bool is_format_changed_; + QButtonGroup radio_group_type_; + QButtonGroup radio_group_interval_; }; \ No newline at end of file diff --git a/src/OpenArk/openark_zh.ts b/src/OpenArk/openark_zh.ts index 865129f..0afa1b0 100644 --- a/src/OpenArk/openark_zh.ts +++ b/src/OpenArk/openark_zh.ts @@ -178,207 +178,231 @@ p, li { white-space: pre-wrap; } 文字编码 - + Text: 文字: - + Default: 默认编码: - + ASCII: - + UNICODE: - + UTF-7: - + UTF-8: - + UTF-16: - + UTF-16BE: - + UTF-32: - + UTF-32BE: - + GBK: - + BIG5: - + CP866: - + + assemble + 汇编 + + + + 1 byte + 1字节 + + + Constants 常量信息 - + Windows Error Windows错误码 - + DosError: - + NTSTATUS: - + HRESULT: - + Message: 错误消息: - + Windows GUI Windows界面 - + Message ID 查看消息ID - + Algorithms 加密算法 - + Type: 类型: - + PlainText: 明文: - + Key: 密钥: - + CipherText: 密文: - + AsmTools 汇编工具 - + Assemble 汇编 - + Disassemble 反汇编 - + Platform: 平台: - + 64-bit 64位 - + 32-bit 32位 - + 16-bit 16位 - + + Format: 格式: - + + null - + + 2 bytes + 2字节 + + + + 4 bytes + 4字节 + + + + space 空格 - + + \x - + Open console to view result 打开控制台查看结果 - + Warning 警告 - + Your input data so much(suggest less 10 KB), it'll be very slowly, continue? 你输入的数据太多(建议小于10KB),反汇编会很慢,是否继续? - + Compile Error: -------------------------------------------------------------- @@ -387,12 +411,12 @@ p, li { white-space: pre-wrap; } - + start nasm error 启动nasm错误 - + start ndisasm error 启动ndisasm错误 @@ -414,12 +438,12 @@ p, li { white-space: pre-wrap; } [内核模式] 连接成功... - + [KernelMode] not initialized... [内核模式] 未初始化... - + Enter KernelMode @@ -506,18 +530,18 @@ p, li { white-space: pre-wrap; } 对象类型表 - + ObjectSections 内存区对象 - + Path: InputPath: 路径: - + ShowHold 查看占用 @@ -550,12 +574,12 @@ p, li { white-space: pre-wrap; } 内存管理 - + MemoryRegion 内存区域 - + Storage Manager Storage 存储管理 @@ -588,23 +612,23 @@ p, li { white-space: pre-wrap; } 对象管理 - + Memory Manager 内存管理 - + MemoryReadWrite MemoryView 内存读写 - + FileFilter 文件过滤 - + FileUnlock 文件解锁 @@ -613,42 +637,42 @@ p, li { white-space: pre-wrap; } 选择文件... - + KillProcess 结束进程 - + Unlock 解锁 - + Unlock All 解锁全部 - + Network Manager 网络管理 - + WFP - + TDI - + NDIS - + Port @@ -673,7 +697,7 @@ p, li { white-space: pre-wrap; } - + Name 名称 @@ -713,32 +737,32 @@ p, li { white-space: pre-wrap; } 副服务包 - + R3 AddressRange R3地址空间 - + R0 AddressRange R0地址空间 - + Page Size 页面大小 - + Physical Memory 物理内存 - + CPU Count CPU核数 - + SystemRoot 系统根目录 @@ -751,8 +775,8 @@ p, li { white-space: pre-wrap; } 基址 - - + + Path 路径 @@ -761,41 +785,41 @@ p, li { white-space: pre-wrap; } 顺序 - - + + Description 描述 - + Version 版本 - + Company 公司 - - + + Refresh 刷新 - + Copy 复制 - - + + Explore File 定位到文件 - - + + Sendto Scanner 扫描文件 @@ -815,8 +839,8 @@ p, li { white-space: pre-wrap; } [内核模式] 使用(热键/回调/内存)等功能时需要进入内核模式... - - + + Properties... 属性... @@ -829,26 +853,26 @@ p, li { white-space: pre-wrap; } 驱动文件 (*.sys);;所有文件 (*.*) - - + + CreateProcess - - + + CreateThread - - + + LoadImage - - + + CmpCallback @@ -891,57 +915,62 @@ p, li { white-space: pre-wrap; } [内核模式] 你需要启用内核模式来安装驱动... - + Callback Entry 回调入口 - + Type 类型 - + Delete Notify 删除回调 - + Disassemble Notify 反汇编回调入口 - + Memory Read-Write 内存读写 - + PID.TID 进程ID.线程ID - + Hotkey 热键 - + + HotkeyObject + + + + HotkeyID 热键ID - + HWND 句柄 - + Title 标题 - + ClassName 类名 @@ -950,12 +979,12 @@ p, li { white-space: pre-wrap; } 错误 - + Delete Hotkey 删除热键 - + [-] Driver file not existed! [-] 驱动文件不存在! @@ -1094,40 +1123,67 @@ p, li { white-space: pre-wrap; } KernelObject - + TypeObject 类型对象 - + TypeIndex 类型索引 - + TypeName 类型名称 - + TotalObjectsNum 关联对象数 - + TotalHandlesNum 关联句柄数 - + + Refresh 刷新 - + + Copy 复制 + + + SectionDirectory + + + + + SectionName + + + + + SectionSize + + + + + SessionID + + + + + SessionName + + KernelStorage @@ -1186,13 +1242,13 @@ p, li { white-space: pre-wrap; } - + Address: 地址: - + 0xFFFFF78000000000 0xfffff780`00000000 @@ -1213,47 +1269,57 @@ p, li { white-space: pre-wrap; } 写入内存 - + + WriteString + + + + Size: 大小: - + 0x200 - + Region: 区域: - + Unknown... 未知... - + ReadMemory 读取内存 - + + DumpToFile + + + + PID: 进程ID: - + 4 - + ProcessName: 进程名: - + SYSTEM diff --git a/src/OpenArk/res/lang/openark_zh.qm b/src/OpenArk/res/lang/openark_zh.qm index c9cabf5..54c05cc 100644 Binary files a/src/OpenArk/res/lang/openark_zh.qm and b/src/OpenArk/res/lang/openark_zh.qm differ diff --git a/src/OpenArk/ui/coderkit.ui b/src/OpenArk/ui/coderkit.ui index bcea3f0..e99ae9a 100644 --- a/src/OpenArk/ui/coderkit.ui +++ b/src/OpenArk/ui/coderkit.ui @@ -54,24 +54,36 @@ CodePoints - - + + - 10 75 true - Text: + Format: - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + 0 + + + + + 16777215 + 130 + - + @@ -88,10 +100,10 @@ - + - + @@ -108,10 +120,10 @@ - + - + @@ -128,10 +140,10 @@ - + - + @@ -148,10 +160,10 @@ - + - + @@ -168,10 +180,10 @@ - + - + @@ -188,10 +200,10 @@ - + - + @@ -208,10 +220,10 @@ - + - + @@ -228,10 +240,10 @@ - + - + @@ -248,10 +260,10 @@ - + - + @@ -268,10 +280,10 @@ - + - + @@ -288,10 +300,10 @@ - + - + @@ -308,22 +320,89 @@ - + - - - - - 0 - 0 - + + + + + + null + + + + + + + \x + + + + + + + space + + + + + + + assemble + + + + + + + 1 byte + + + + + + + 2 bytes + + + + + + + 4 bytes + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 10 + 75 + true + - - - 16777215 - 130 - + + Text: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter