-
大小: 854KB文件类型: .zip金币: 1下载: 0 次发布日期: 2021-05-11
- 语言: C#
- 标签: C#EasyHook easyhook
资源简介
C#EasyHook使用demo,拦截其它程序方法的神器,向其它程序注入自己的代码。。。dll程序集需要签名,否则会注入失败。
代码片段和文件信息
using System;
using System.Text;
using System.Runtime.InteropServices;
using EasyHook;
using System.Threading;
using System.Windows.Forms;
namespace ClassLibrary1
{
[Serializable]
public class HookParameter
{
public string Msg { get; set; }
public int HostProcessId { get; set; }
}
public class Main : IEntryPoint
{
public LocalHook MessageBoxWHook = null;
public LocalHook MessageBoxAHook = null;
public LocalHook ShowWindowAsyncHook = null;
public LocalHook ShowWindowHook = null;
public LocalHook SendMessageHook = null;
public Main(RemoteHooking.IContext context string channelName HookParameter parameter)
{
MessageBox.Show(parameter.Msg “Hooked“);
}
public void Run(
RemoteHooking.IContext context
string channelName
HookParameter parameter
)
{
try
{
//MessageBoxWHook = LocalHook.Create(
// LocalHook.GetProcAddress(“user32.dll“ “MessageBoxW“)
// new DMessageBoxW(MessageBoxW_Hooked)
// this);
//MessageBoxWHook.ThreadACL.SetExclusiveACL(new int[1]);
//MessageBoxAHook = LocalHook.Create(
// LocalHook.GetProcAddress(“user32.dll“ “MessageBoxA“)
// new DMessageBoxW(MessageBoxA_Hooked)
// this);
//MessageBoxAHook.ThreadACL.SetExclusiveACL(new int[1]);
ShowWindowAsyncHook = LocalHook.Create(
LocalHook.GetProcAddress(“user32.dll“ “ShowWindowAsync“)
new DShowWindowAsync(ShowWindowAsync_Hooked)
this);
ShowWindowAsyncHook.ThreadACL.SetExclusiveACL(new int[1]);
ShowWindowHook = LocalHook.Create(
LocalHook.GetProcAddress(“user32.dll“ “ShowWindow“)
new DShowWindowAsync(ShowWindowAsync_Hooked)
this);
ShowWindowHook.ThreadACL.SetExclusiveACL(new int[1]);
SendMessageHook = LocalHook.Create(
LocalHook.GetProcAddress(“user32.dll“ “SendMessageA“)
new DSendMessage(SendMessage_Hooked)
this);
SendMessageHook.ThreadACL.SetExclusiveACL(new int[1]);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
try
{
while (true)
{
Thread.Sleep(10);
}
}
catch
{
}
}
#region MessageBoxW
[DllImport(“user32.dll“ EntryPoint = “MessageBoxW“ CharSet = CharSet.Unicode)]
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-07-24 14:56 easyhook\
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\.vs\
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\.vs\WindowsFormsApplication8\
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\.vs\WindowsFormsApplication8\v14\
文件 111616 2020-07-29 17:22 easyhook\C#EasyHook\.vs\WindowsFormsApplication8\v14\.suo
目录 0 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\
文件 2976 2018-03-05 15:16 easyhook\C#EasyHook\ClassLibrary1\ClassLibrary1.csproj
文件 5134 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\Main.cs
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\ClassLibrary1\Properties\
文件 1358 2017-09-27 15:47 easyhook\C#EasyHook\ClassLibrary1\Properties\AssemblyInfo.cs
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\ClassLibrary1\RefLib\
文件 49152 2017-09-27 15:50 easyhook\C#EasyHook\ClassLibrary1\RefLib\EasyHook.dll
文件 596 2017-09-27 16:10 easyhook\C#EasyHook\ClassLibrary1\SN.snk
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\ClassLibrary1\bin\
目录 0 2020-07-28 04:55 easyhook\C#EasyHook\ClassLibrary1\bin\Debug\
文件 8192 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\bin\Debug\ClassLibrary1.dll
文件 13824 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\bin\Debug\ClassLibrary1.pdb
文件 49152 2017-09-27 15:50 easyhook\C#EasyHook\ClassLibrary1\bin\Debug\EasyHook.dll
目录 0 2020-08-14 17:46 easyhook\C#EasyHook\ClassLibrary1\bin\Release\
目录 0 2018-03-11 15:22 easyhook\C#EasyHook\ClassLibrary1\obj\
目录 0 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\
文件 2608 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\ClassLibrary1.csproj.FileListAbsolute.txt
文件 6657 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\ClassLibrary1.csprojResolveAssemblyReference.cache
文件 8192 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\ClassLibrary1.dll
文件 13824 2020-07-29 15:49 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\ClassLibrary1.pdb
文件 867 2020-07-29 15:30 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6801 2020-07-24 14:57 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
目录 0 2020-08-14 17:46 easyhook\C#EasyHook\ClassLibrary1\obj\Debug\TempPE\
目录 0 2020-07-29 15:51 easyhook\C#EasyHook\WindowsFormsApplication8\
文件 49152 2017-09-27 16:22 easyhook\C#EasyHook\WindowsFormsApplication8\EasyHook.dll
............此处省略95个文件信息
- 上一篇:c#串口和socket开发源码
- 下一篇:ASP.NET实验室预约系统
评论
共有 条评论