[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

进程内存写入工具-WriteProcessMemory

老刘制作——进程内存写入工具

用法:
        WriteProcessMemory      <ProcessID>     <BaseAddress>   <HEX>   ...
        ProcessID               指定需写入进程的PID
        BaseAddress             指定需写入进程内数据的起始地址
        HEXs                    需写入的数据(至少一个,数值范围:0~255)

提示:
传入数据时,十六进制请用"&H"前缀表示

姊妹工具:http://www.bathome.net/thread-45156-1-1.html
  1. Option Explicit
  2. Module WriteProcessMemory
  3. Public Class WriteProcessMemory_Main
  4. Public Shared Sub Main(ByVal cmdArgs() As String)
  5. Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
  6. Const PAGE_EXECUTE_READWRITE As Long = &H40
  7. If CmdArgs.Length > 2 Then
  8. If IsNumeric(cmdArgs(0)) And IsNumeric(cmdArgs(1)) Then
  9. Dim ProcessHandle,OldProtect,ReturnValue(2),Conter(1) As Long
  10. Dim Bytes() As Byte
  11. Conter(1) = 0
  12. Rem 获取HEXs并生成数组
  13. For Conter(0) = 2 to CmdArgs.Length - 1
  14. If IsNumeric(CmdArgs(Conter(0))) Then
  15. If CLng(CmdArgs(Conter(0))) >= 0 And _
  16. CLng(CmdArgs(Conter(0))) <= &HFF Then
  17. ReDim Preserve Bytes(Conter(1))
  18. Bytes(Conter(1)) = CByte(CmdArgs(Conter(0)))
  19. Conter(1) = Conter(1) + 1
  20. End If
  21. End If
  22. Next
  23. Rem 以最高权限附加到目标进程
  24. ProcessHandle = Win32.OpenProcess( _
  25. PROCESS_ALL_ACCESS, _
  26. False, _
  27. Clng(CmdArgs(0)))
  28. Rem 更改内存属性为读+写+执行
  29. ReturnValue(0) = Win32.VirtualProtectEx( _
  30. ProcessHandle, _
  31. Clng(CmdArgs(1)), _
  32. Conter(1), _
  33. PAGE_EXECUTE_READWRITE, _
  34. OldProtect)
  35. Rem 写入数据
  36. ReturnValue(1) = Win32.WriteProcessMemory( _
  37. ProcessHandle, _
  38. Clng(CmdArgs(1)), _
  39. Bytes,Conter(1),0)
  40. If ReturnValue(1) <> 1 Then
  41. Console.WriteLine("写入失败!")
  42. End If
  43. If ReturnValue(0) <> 0 Then
  44. Rem 还原内存属性
  45. ReturnValue(2) = Win32.VirtualProtectEx( _
  46. ProcessHandle, _
  47. Clng(CmdArgs(1)), _
  48. Conter(1), _
  49. OldProtect,0)
  50. End If
  51. Else
  52. Console.WriteLine("输入的值不合法!")
  53. End If
  54. Else
  55. Console.WriteLine("老刘制作——进程内存写入工具")
  56. Console.WriteLine()
  57. Console.WriteLine("用法:")
  58. Console.WriteLine(" WriteProcessMemory <ProcessID> <BaseAddress> <HEX> ...")
  59. Console.WriteLine(" ProcessID 指定需写入进程的PID")
  60. Console.WriteLine(" BaseAddress 指定需写入进程内数据的起始地址")
  61. Console.WriteLine(" HEXs 需写入的数据(至少一个,数值范围:0~255)")
  62. Console.WriteLine()
  63. Console.WriteLine("提示:")
  64. Console.WriteLine("传入数据时,十六进制请用""&H""前缀表示")
  65. End If
  66. End Sub
  67. End Class
  68. Public Class Win32
  69. Declare Function OpenProcess Lib "KERNEL32" ( _
  70. ByVal dwDesiredAccess As Long, _
  71. ByVal bInheritHandle As Long, _
  72. ByVal dwProcessId As Long ) _
  73. As Long
  74. Declare Function WriteProcessMemory Lib "KERNEL32" ( _
  75. ByVal hProcess As Long, _
  76. ByVal lpBaseAddress As Long, _
  77. ByVal lpBuffer As Byte(), _
  78. ByVal nSize As Long, _
  79. ByRef lpNumberOfBytesWritten As Long) _
  80. As Long
  81. Declare Function VirtualProtectEx Lib "KERNEL32" ( _
  82. ByVal hProcess As Long, _
  83. ByVal lpAddress As Long, _
  84. ByVal dwSize As Long, _
  85. ByVal flNewProtect As Long, _
  86. ByRef lpflOldProtect As Long) _
  87. As Long
  88. End Class
  89. End Module
复制代码
链接: https://pan.baidu.com/s/1YCSEiRd7Y6dbdz47QmASZA?pwd=3rwf
1

评分人数

回复 1# 老刘1号
不错,好工具,你的体积越来越小了,也做到了几KB。可以用来游戏作弊了。

TOP

回复 2# happy886rr


    感谢支持
哈哈,表面看来是几kb,其实windows自带着几G的运行库
游戏修改的话

水果忍者红叉修改

植物大战僵尸,NOP掉种植物时的阳光耗费机制
1

评分人数

TOP

返回列表