当前位置: 首页 > news >正文

免费制作二维码的网站洛阳网站建设的公司哪家好

免费制作二维码的网站,洛阳网站建设的公司哪家好,wordpress更换数据库,六安seo网站推广报价索引 需求测试程序父进程代码子进程代码 x64dbg插件功能开始调试 frida运行环境用到的文件和代码 需求 最近在学基础的Windows逆向知识#xff0c;遇到个小问题。一个进程使用CreateProcessW创建的进程该如何在启动时附加#xff0c;我想调试这个子进程启动时运行的函数。 … 索引 需求测试程序父进程代码子进程代码 x64dbg插件功能开始调试 frida运行环境用到的文件和代码 需求 最近在学基础的Windows逆向知识遇到个小问题。一个进程使用CreateProcessW创建的进程该如何在启动时附加我想调试这个子进程启动时运行的函数。 谷歌搜索都给我翻烂了最后发现还是得用英文搜。比如x64dbg attach child process就出现了这个结果 How to debug child process? 在测试完这个x64dbg插件之后我想着frida有没有这样的功能于是也搜索了一下frida hook muti process也出现了一个方案说是frida10就已经有了这个功能 Frida hook multiple processes 下面我简单说一下这两种的使用方法 测试程序 先用C写一个简单的测试程序用来创建子进程代码很简单直接调用CreateProcessW来启动一个子进程 父进程代码 #include windows.h #include iostream #include stdio.hint main() {// 定义进程信息结构体PROCESS_INFORMATION pi;// 定义启动信息结构体STARTUPINFO si;// 初始化结构体ZeroMemory(si, sizeof(si));si.cb sizeof(si);ZeroMemory(pi, sizeof(pi));// Notepad 可执行文件的路径LPCWSTR notepadPath LSubProcess.exe;// 文件路径作为命令行参数LPWSTR cmdLine NULL;DWORD currentProcessId GetCurrentProcessId();// 创建新进程if (CreateProcessW(notepadPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, si, pi)) {printf(新进程已成功创建\n);printf(新进程的进程ID%d, 当前进程id: %d \n, pi.dwProcessId, currentProcessId);// 可以等待进程结束或者继续执行其他操作// WaitForSingleObject(pi.hProcess, INFINITE);// 关闭进程和线程句柄CloseHandle(pi.hProcess);CloseHandle(pi.hThread);}else {printf(无法创建新进程。错误代码%d, GetLastError());}int i 0;while (true) {i 1;printf(*************** 父进程id: %d, 第%d次等待 *******************\n, currentProcessId, i);Sleep(2000);}return 0; }子进程代码 #include stdio.h #include windows.hint main() {int i 0;DWORD currentProcessId GetCurrentProcessId();while (true) {i 1;printf(############### 子进程id: %d, 第%d次等待 ####################\n, currentProcessId, i);Sleep(3000);} }x64dbg x64dbg是使用插件来附加子进程 插件地址https://github.com/therealdreg/DbgChild 安装步骤 先下载releases下面的文件DbgChild.Beta.10.zip解压到x64dbg目录打开x64dbg插件里面就有DbgChild 解压后的目录结构 复制到x64dbg之后的目录结构 插件功能 我说一下我用的几个选项的含义 主动去触发hook进程创建自动hook进程创建一般选这个就行取消hook NTDLL我看演示的视频在启动子进程的时候都会主动点一次这个不过下面有个自动取消hook默认是勾选的我测试的时候不点这个也可以启动监听程序这个是必须的且要在创建子进程之前启动 开始调试 勾选第二个选项并启动监听程序使用x64dbg打开ForkProcess.exe运行程序这时候会有一个很长的等待我开始以为是卡住了后面发现它只是比较慢要等个一分钟吧。用任务管理搜索其实SubProcess.exe已经启动了不知道是哪里卡住了。 接着就会弹出一个新的x64dbg窗口并且已经附加到了SubProcess了 这里不清楚为啥子进程没有在入口断点断住不过影响不大因为x64dbg会记忆断点位置我只需要现在打上断点那么在下次启动的时候就会自动断下比如这里在SubProcess的x64dbg程序里用CtrlG跳转到printf函数并且打上断点。重复上面的操作重新启动ForkProcess的时候附加到SubProcess的x64dbg就会断在printf 如果在启动ForkProcess之后再想去附加SubProcessprintf的前几次就无法下断点了。 frida 根据上面搜索到的链接显示frida10就已经支持这个功能了。不过现在已经frida16了这里面的代码也不能用了得看github的最新代码https://github.com/frida/frida-python/blob/main/examples/child_gating.py 直接拷下来稍微做点改动代码比较长为了方便讲js和Python代码分开 child_gating.py import threading import os import frida from frida_tools.application import Reactorclass Application:def __init__(self):self._stop_requested threading.Event()self._reactor Reactor(run_until_returnlambda reactor: self._stop_requested.wait())self._device frida.get_local_device()self._sessions set()self._device.on(child-added, lambda child: self._reactor.schedule(lambda: self._on_child_added(child)))self._device.on(child-removed, lambda child: self._reactor.schedule(lambda: self._on_child_removed(child)))self._device.on(output, lambda pid, fd, data: self._reactor.schedule(lambda: self._on_output(pid, fd, data)))def run(self):self._reactor.schedule(lambda: self._start())self._reactor.run()def _start(self):argv [rT:\Code\VisualStudio\ForkProcess\x64\Release\ForkProcess.exe]env {}print(f✔ spawn(argv{argv}))pid self._device.spawn(argv, envenv, stdiopipe)self._instrument(pid)def _stop_if_idle(self):if len(self._sessions) 0:self._stop_requested.set()def _instrument(self, pid):print(f✔ attach(pid{pid}))session self._device.attach(pid)session.on(detached, lambda reason: self._reactor.schedule(lambda: self._on_detached(pid, session, reason)))print(✔ enable_child_gating())session.enable_child_gating()print(✔ create_script())frida_js_code self.read_jscode()script session.create_script(frida_js_code)script.on(message, lambda message, data: self._reactor.schedule(lambda: self._on_message(pid, message)))print(✔ load())script.load()print(f✔ resume(pid{pid}))self._device.resume(pid)self._sessions.add(session)def read_jscode(self):path os.path.dirname(os.path.abspath(__file__))file os.path.join(path, child_gating.js)with open(file, encodingutf-8) as f:jscode f.read()return jscodedef _on_child_added(self, child):print(f⚡ child_added: {child})self._instrument(child.pid)def _on_child_removed(self, child):print(f⚡ child_removed: {child})def _on_output(self, pid, fd, data):pass#print(f⚡ output: pid{pid}, fd{fd}, data{repr(data)})def _on_detached(self, pid, session, reason):print(f⚡ detached: pid{pid}, reason{reason})self._sessions.remove(session)self._reactor.schedule(self._stop_if_idle, delay0.5)def _on_message(self, pid, message):if message[type] send:payload message[payload]s payload[format_str] % tuple(payload[format_args])print(f⚡ message: pid{pid}, payload{s})elif message[type] error:print(f⚡ message: pid{pid}, error: description{message[description]} stack{message[stack]})else:print(f⚡ message: pid{pid}, payload{message})app Application() app.run()child_gating.js // 根据%读取printf的参数 function vspritf(format_str, args){let printf_args [];if (format_str.indexOf(%) -1) {return printf_args;}var pos 0;for (let index 0; index format_str.length; index) {pos format_str.indexOf(%, pos);if(pos -1)break;var format_ch format_str.substr(pos1, 1);let length printf_args.length;let arg;switch (format_ch) {case s:arg args[length1].readAnsiString()break;case d: arg args[length1].toInt32()break;case p:arg args[length1].toInt32()break;case f:arg args[length1]break;default:arg args[length1]break;}printf_args.push(arg);pos index2;}return printf_args; }let ProcessModAddress Process.findModuleByName(ForkProcess.exe); // Offset是在x64dbg里计算的偏移 // 本来我想使用Module.findExportByName(null, printf)发现得到的偏移不知道是哪里的 let Offset 0x1070; // 如果没有获取到ForkProcess说明是子进程 if(!ProcessModAddress){ProcessModAddress Process.findModuleByName(SubProcess.exe);Offset 0x1010; } // 通过偏移计算printf的实际地址 let pvPrintf ProcessModAddress.base.add(Offset); // 调用Windows获取进程pid的api let pvGetCurrentProcessId Module.findExportByName(kernel32.dll, GetCurrentProcessId) var GetCurrentProcessId new NativeFunction(pvGetCurrentProcessId, uint32, []);console.log(GetCurrentProcessId(), Offset, pvPrintf) // hook函数 Interceptor.attach(pvPrintf, {onEnter: function (args) {let format_str args[0].readAnsiString()send({format_str: format_str,format_args: vspritf(format_str, args)})} });运行结果如下 这里我只测试了WindowsLinux和安卓应该也可以官网给的例子是Linux的安卓的话自行测试 运行环境 python3.8.17frida16.1.2frida-tools12.1.3vs2017 用到的文件和代码 https://github.com/kanadeblisst00/frida_child_gating
文章转载自:
http://www.morning.ftcrt.cn.gov.cn.ftcrt.cn
http://www.morning.qmnjn.cn.gov.cn.qmnjn.cn
http://www.morning.jwwfk.cn.gov.cn.jwwfk.cn
http://www.morning.qxwgx.cn.gov.cn.qxwgx.cn
http://www.morning.qggcc.cn.gov.cn.qggcc.cn
http://www.morning.mkyxp.cn.gov.cn.mkyxp.cn
http://www.morning.smmrm.cn.gov.cn.smmrm.cn
http://www.morning.tgyqq.cn.gov.cn.tgyqq.cn
http://www.morning.tjsxx.cn.gov.cn.tjsxx.cn
http://www.morning.hfnbr.cn.gov.cn.hfnbr.cn
http://www.morning.qnftc.cn.gov.cn.qnftc.cn
http://www.morning.yqpck.cn.gov.cn.yqpck.cn
http://www.morning.rbmnq.cn.gov.cn.rbmnq.cn
http://www.morning.gqnll.cn.gov.cn.gqnll.cn
http://www.morning.bryyb.cn.gov.cn.bryyb.cn
http://www.morning.bpmft.cn.gov.cn.bpmft.cn
http://www.morning.msbpb.cn.gov.cn.msbpb.cn
http://www.morning.mzwqt.cn.gov.cn.mzwqt.cn
http://www.morning.jmtrq.cn.gov.cn.jmtrq.cn
http://www.morning.bpds.cn.gov.cn.bpds.cn
http://www.morning.tkcz.cn.gov.cn.tkcz.cn
http://www.morning.prgyd.cn.gov.cn.prgyd.cn
http://www.morning.frsxt.cn.gov.cn.frsxt.cn
http://www.morning.ctfh.cn.gov.cn.ctfh.cn
http://www.morning.ryxbz.cn.gov.cn.ryxbz.cn
http://www.morning.rcyrm.cn.gov.cn.rcyrm.cn
http://www.morning.weiwt.com.gov.cn.weiwt.com
http://www.morning.bkcnq.cn.gov.cn.bkcnq.cn
http://www.morning.trbxt.cn.gov.cn.trbxt.cn
http://www.morning.mtbsd.cn.gov.cn.mtbsd.cn
http://www.morning.fnwny.cn.gov.cn.fnwny.cn
http://www.morning.bssjp.cn.gov.cn.bssjp.cn
http://www.morning.jcyrs.cn.gov.cn.jcyrs.cn
http://www.morning.fgsqz.cn.gov.cn.fgsqz.cn
http://www.morning.bby45.cn.gov.cn.bby45.cn
http://www.morning.ynwdk.cn.gov.cn.ynwdk.cn
http://www.morning.dmwck.cn.gov.cn.dmwck.cn
http://www.morning.ffrys.cn.gov.cn.ffrys.cn
http://www.morning.htqrh.cn.gov.cn.htqrh.cn
http://www.morning.jlpdc.cn.gov.cn.jlpdc.cn
http://www.morning.lqlhw.cn.gov.cn.lqlhw.cn
http://www.morning.ygxf.cn.gov.cn.ygxf.cn
http://www.morning.jwrcz.cn.gov.cn.jwrcz.cn
http://www.morning.gslz.com.cn.gov.cn.gslz.com.cn
http://www.morning.lwzgn.cn.gov.cn.lwzgn.cn
http://www.morning.tnkwj.cn.gov.cn.tnkwj.cn
http://www.morning.gtylt.cn.gov.cn.gtylt.cn
http://www.morning.mqwnp.cn.gov.cn.mqwnp.cn
http://www.morning.trfh.cn.gov.cn.trfh.cn
http://www.morning.jlboyuan.cn.gov.cn.jlboyuan.cn
http://www.morning.nwllb.cn.gov.cn.nwllb.cn
http://www.morning.lxwjx.cn.gov.cn.lxwjx.cn
http://www.morning.bftr.cn.gov.cn.bftr.cn
http://www.morning.hpprx.cn.gov.cn.hpprx.cn
http://www.morning.qyxnf.cn.gov.cn.qyxnf.cn
http://www.morning.rgmd.cn.gov.cn.rgmd.cn
http://www.morning.ngmjn.cn.gov.cn.ngmjn.cn
http://www.morning.qnrpj.cn.gov.cn.qnrpj.cn
http://www.morning.qbzdj.cn.gov.cn.qbzdj.cn
http://www.morning.lmxrt.cn.gov.cn.lmxrt.cn
http://www.morning.lxctl.cn.gov.cn.lxctl.cn
http://www.morning.jwbfj.cn.gov.cn.jwbfj.cn
http://www.morning.fqqlq.cn.gov.cn.fqqlq.cn
http://www.morning.xfjwm.cn.gov.cn.xfjwm.cn
http://www.morning.bssjp.cn.gov.cn.bssjp.cn
http://www.morning.kmkpm.cn.gov.cn.kmkpm.cn
http://www.morning.bmhc.cn.gov.cn.bmhc.cn
http://www.morning.gstmn.cn.gov.cn.gstmn.cn
http://www.morning.mpgfk.cn.gov.cn.mpgfk.cn
http://www.morning.rwhlf.cn.gov.cn.rwhlf.cn
http://www.morning.gkdqt.cn.gov.cn.gkdqt.cn
http://www.morning.wfbs.cn.gov.cn.wfbs.cn
http://www.morning.lprfk.cn.gov.cn.lprfk.cn
http://www.morning.wglhz.cn.gov.cn.wglhz.cn
http://www.morning.ldqrd.cn.gov.cn.ldqrd.cn
http://www.morning.tsrg.cn.gov.cn.tsrg.cn
http://www.morning.smdnl.cn.gov.cn.smdnl.cn
http://www.morning.snnwx.cn.gov.cn.snnwx.cn
http://www.morning.jikuxy.com.gov.cn.jikuxy.com
http://www.morning.glpxx.cn.gov.cn.glpxx.cn
http://www.tj-hxxt.cn/news/238419.html

相关文章:

  • wordpress 全站404我做微信淘宝客网站
  • 好玩的电脑网页游戏苏州seo怎么做
  • 上海网站建设网站优化app漳州网站建设优化
  • 做网站容易还是app容易网站制作服务公司
  • 网站设计报价单网站建设能用手机制作吗
  • 浏览器什么网站都能打开的商标注册费用一般是多少钱
  • 深圳电子商务网站制作深圳辰硕网站优化
  • 酒吧网站建设报价模板余杭区建设规划局网站
  • 东营网站推广公司网站建设公司未来发展方向
  • 专业做网站公司济南遵义市建设厅网站
  • 北京建设银行官方网站网站推广策划方案和网站推广执行方案的区别
  • 凯天建设发展集团有限公司网站制作做的网站如何上传网上
  • 一般网站宽度网站游戏正规网站建设
  • 网站建设郑州公司怎么自己做网页
  • 营销式网站制作如何制作企业内部网站
  • 19网站建设网址大全软件下载
  • 免费做代理的网站扬州服务器租用
  • 公众号开发者密钥有什么用临清聊城网站优化
  • 产品推广的网站怎么做好玩的传奇
  • 国产做性直播视频网站企业网站运行通知
  • 石家庄网站开发多少钱上海网站建设v芯ee8888e
  • 网站建设结构总结招商网站如何做推广
  • 青岛网站建设的流程有哪些河南艾特网站建设
  • 做网站最专业的公司做海报的软件app免费
  • 做网站公司排名u网站建设
  • 做网站虚拟主机和云服务器长春 网络公司
  • 苏州专业网站建设定制视频托管平台
  • 潍坊网站建设 绮畅网站seo设置是什么意思
  • 河北省城乡建设厅网站首页网页制作的基本步骤流程
  • 住房和城乡建设厅网站青海省关于网站建设的合同