|
[讨论] 大家七夕给女友准备了什么礼物?
绞尽钱包 |
|
|
|
[分享]疫情在家记了3个月的日语笔记
楼主还活在2020年4月啊 |
|
[原创]我洗个澡就绕过了杀软的防护
记得去年可以用反向创建注册表符号链接绕过360注册表防护创建自启动 |
|
|
|
|
|
[原创]使用winafl对迅雷的torrent解析逻辑进行fuzz
要对宅男下手了吗 |
|
|
|
[讨论] 今年过年你回家吗?
新闻都在吹风不让回,不知道再过几天会不会强制不让回 |
|
[求助]有没有大神知道cmd命令systeminfo具体实现的细节
命令调用的systeminfo.exe, 然后这个exe是通过WMI拿的数据。 |
|
[原创]祝大家 新年快乐,身体健康,万事顺利。
666666666666 |
|
|
|
[求助][求助]震惊这进程保护 原理是啥 pchuner 驱动级别都看不了内存!
有时候程序跑崩了会有这效果 |
|
如何通过编程实现,Kernel32.dll中导出函数的大小识别?
#define GE_X_LE(a,x,b) (((x)>=(a)) && ((x) <= (b))) #define GE_X_LS(a,x,b) (((x)>=(a)) && ((x) < (b))) #define GT_X_LE(a,x,b) (((x)> (a)) && ((x) <= (b))) #define GT_X_LS(a,x,b) (((x)> (a)) && ((x) < (b))) typedef struct range { DWORD startrva; DWORD dwsize; DWORD endrva; //endrva = startrva + dwsize - 1 }*prange; int myidgroup1[] = { X86_INS_JAE, X86_INS_JA, X86_INS_JBE, X86_INS_JB, X86_INS_JCXZ, X86_INS_JECXZ, X86_INS_JE, X86_INS_JGE, X86_INS_JG, X86_INS_JLE, X86_INS_JL, X86_INS_JNE, X86_INS_JNO, X86_INS_JNP, X86_INS_JNS, X86_INS_JO, X86_INS_JP, X86_INS_JRCXZ, X86_INS_JS, 0 }; int checkid(int id, int* myidset) { while (*myidset) { if (id == *myidset) { return true; } ++myidset; } return false; } bool comparer(range& ra, range& rb) { return ra.startrva < rb.startrva; } bool checkcommon(range& ra, range& rb) { if (ra.endrva < rb.startrva - 1 || rb.endrva < ra.startrva - 1) { return false; } return true; } int functionparser::getfuncrange(DWORD dwfuncrva, _Inout_ std::vector<range>& rangelist, BYTE* pebase) { csh handle; cs_insn* insn; size_t count; if (cs_open(CS_ARCH_X86, CS_MODE_64, &handle) != CS_ERR_OK) return CAPSTONE_FAIL; cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); DWORD dwprevrva = dwfuncrva; DWORD nextrva = 0; std::vector<DWORD> todorva; BYTE* tempdata = NULL; while (true) { for (int i = 0;;) { count = cs_disasm(handle, pebase + rva2fo(pebase, dwprevrva) + i, 0x10, dwprevrva + i, 1, &insn); if (count == 0) { tempdata = pebase + rva2fo(pebase, dwprevrva) + i; //capstone好像没支持这个指令, 我临时修补一下. //0F 01 FA monitorx rax, rcx, rdx if (tempdata[0] == 0xf && tempdata[1] == 0x1 && tempdata[2] == 0xfa) { i += 3; continue; } //0F 01 FB mwaitx rax, rcx, rbx if (tempdata[0] == 0xf && tempdata[1] == 0x1 && tempdata[2] == 0xfb) { i += 3; continue; } //F3 48 0F 1E CA rdsspq rdx if (*(DWORD*)tempdata == 0x1e0f48f3 && tempdata[4] == 0xca) { i += 5; continue; } } #pragma region α ////注意 跟β的顺序不能颠倒 //发现条件跳转 或 jmp if (checkid(insn[0].id,myidgroup1) || insn[0].id == X86_INS_JMP) { //得到跳转目标地址 DWORD dwdest = strtoul(insn[0].op_str, NULL, 16); //assert(dwdest != 0); if (GE_X_LE(dwprevrva, dwdest, dwprevrva + i + insn[0].size) == FALSE && dwdest != 0) { bool everbeenbefore = false; for (auto& fuck : rangelist) { if (GE_X_LE(fuck.startrva, dwdest, fuck.endrva)) { everbeenbefore = true; break; } } for (auto& fuck : todorva) { if (dwdest == fuck) { everbeenbefore = true; break; } } if (everbeenbefore == false) { todorva.push_back(dwdest); } } } #pragma endregion #pragma region β //发现终点, 保存本块区域, 看是否有其他路径点未遍历 if (cs_insn_group(handle, insn, CS_GRP_RET) || insn[0].id == X86_INS_JMP) { range temp = { 0 }; temp.startrva = dwprevrva; temp.endrva = dwprevrva + i + insn[0].size - 1; temp.dwsize = i + insn[0].size; rangelist.push_back(temp); //将todorva中, 本块走过的rva全部删除 for (auto damn = todorva.begin(); damn != todorva.end(); ) { if (GE_X_LE(dwprevrva, *damn, dwprevrva + i + insn[0].size - 1)) { damn = todorva.erase(damn); } else { ++damn; } } if (todorva.empty()) { //没有未遍历的了.. goto outofwhile; } else { nextrva = todorva.back(); todorva.pop_back(); goto outoffor; } } #pragma endregion i += insn[0].size; cs_free(insn, count); } outoffor: dwprevrva = nextrva; } cs_close(&handle); outofwhile: //开始合并rangelist //先对rangelist按照startrva升序排列 if (rangelist.size() > 1) { std::sort(rangelist.begin(), rangelist.end(), comparer); //因为已经排序过, 所以只需要判断相邻两个是否能合成即可 for (auto iter = rangelist.begin(); iter != rangelist.end() - 1;) { if (checkcommon(*iter, *(iter + 1))) { (*iter).startrva = min((*iter).startrva, (*(iter + 1)).startrva); (*iter).endrva = max((*iter).endrva, (*(iter + 1)).endrva); (*iter).dwsize = (*iter).endrva - (*iter).startrva + 1; iter = rangelist.erase(iter + 1); --iter; } else { ++iter; } } } return 0; } 我这代码对我当时研究的已经够用了, 你的可能得改改, 库用的capstone |
|
如何通过编程实现,Kernel32.dll中导出函数的大小识别?
我写过这个功能, 就输入一个起始地址, 然后输出函数范围的数组.
最后于 2020-10-12 10:49
被boursonjane编辑
,原因:
|
|
[求助]NtProtectVirtualMemory 失败的很奇怪
BaseAddress几个字节? |
|
[原创]用麒麟框架深入分析实模式二进制文件
https://blog.lazym.io/2020/09/05/Dive-deeper-Analyze-real-mode-binaries-like-a-Pro-with-Qiling-Framework/ 这是你英文博客? |
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值