可以用VB来编写类似于WPE网络封包截取吗?
意思就是说可以用VB来编写一个像WPE差不多一样的东西吗?用其它的编写软件也可以,请说明下!!...
意思就是说可以用VB来编写一个像WPE差不多一样的东西吗?
用其它的编写软件也可以,请说明下!! 展开
用其它的编写软件也可以,请说明下!! 展开
3个回答
展开全部
无论什么语言编写 要写一个类似于wpe的软件就必须用到 hook
先编写 一个标准的dll 文件
在用一个exe文件调用控制dll
如果vb稍微麻烦一点 建议使用 powerbasic 编写 dll在用vb编写 exe调用他,简单的举个例子
Function thFun(ByVal hWnd As Dword,ByVal Func As Dword Ptr,Opt ByVal Params As Dword Ptr,Opt PSize As Dword) As Long
Local hProcess As Dword ,hThread As Dword ,lOB As Dword ,Pid As Dword, ThreadAddr As Dword,PAddr As Dword
GetWindowThreadProcessId(hWnd, Pid)
hProcess = OpenProcess(%PROCESS_ALL_ACCESS, %False, Pid)
ThreadAddr = VirtualAllocEx(hProcess, ByVal 0&, 4096, %MEM_COMMIT, %PAGE_READWRITE)
WriteProcessMemory(hProcess, ByVal ThreadAddr, ByVal VarPtr(@Func), 4096,lOB)
PAddr = VirtualAllocEx(hProcess, ByVal 0&, PSize, %MEM_COMMIT, %PAGE_READWRITE)
WriteProcessMemory(hProcess, ByVal PAddr, ByVal VarPtr(@Params), PSize, lOB)
hThread = CreateRemoteThread(hProcess, ByVal 0&, 0, ByVal ThreadAddr,ByVal PAddr, 0, lOB)
WaitForSingleObject(hThread, %INFINITE)
VirtualFreeEx(hProcess, ByVal ThreadAddr, 0, %MEM_RELEASE)
VirtualFreeEx(hProcess, ByVal PAddr, 0, %MEM_RELEASE)
CloseHandle(hThread)
CloseHandle(hProcess)
End Function
先编写 一个标准的dll 文件
在用一个exe文件调用控制dll
如果vb稍微麻烦一点 建议使用 powerbasic 编写 dll在用vb编写 exe调用他,简单的举个例子
Function thFun(ByVal hWnd As Dword,ByVal Func As Dword Ptr,Opt ByVal Params As Dword Ptr,Opt PSize As Dword) As Long
Local hProcess As Dword ,hThread As Dword ,lOB As Dword ,Pid As Dword, ThreadAddr As Dword,PAddr As Dword
GetWindowThreadProcessId(hWnd, Pid)
hProcess = OpenProcess(%PROCESS_ALL_ACCESS, %False, Pid)
ThreadAddr = VirtualAllocEx(hProcess, ByVal 0&, 4096, %MEM_COMMIT, %PAGE_READWRITE)
WriteProcessMemory(hProcess, ByVal ThreadAddr, ByVal VarPtr(@Func), 4096,lOB)
PAddr = VirtualAllocEx(hProcess, ByVal 0&, PSize, %MEM_COMMIT, %PAGE_READWRITE)
WriteProcessMemory(hProcess, ByVal PAddr, ByVal VarPtr(@Params), PSize, lOB)
hThread = CreateRemoteThread(hProcess, ByVal 0&, 0, ByVal ThreadAddr,ByVal PAddr, 0, lOB)
WaitForSingleObject(hThread, %INFINITE)
VirtualFreeEx(hProcess, ByVal ThreadAddr, 0, %MEM_RELEASE)
VirtualFreeEx(hProcess, ByVal PAddr, 0, %MEM_RELEASE)
CloseHandle(hThread)
CloseHandle(hProcess)
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询