Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Runtime.Remoting.Channels.Ipc;
- using System.Runtime.Remoting;
- using EasyHook;
- using System.IO;
- using System.Threading;
- namespace HookManager.NetworkObserver
- {
- public class NetworkManager
- {
- private string ipcChannelName = null;
- private IpcServerChannel ipcChannel;
- private NetworkHook networkIncomingInterface;
- public NetworkManager(String startupPath)
- {
- // register dlls
- Config.Register("Hook",
- Path.Combine(startupPath, "HookManager.dll"),
- Path.Combine(startupPath, "NetworkIncomingHook.dll"),
- Path.Combine(startupPath, "NetworkOutgoingHook.dll")
- );
- // create ipc-server and get reference to the instance
- this.ipcChannel = RemoteHooking.IpcCreateServer<NetworkHook>(
- ref this.ipcChannelName,
- WellKnownObjectMode.Singleton
- );
- this.networkIncomingInterface = (NetworkHook) Activator.GetObject(typeof(NetworkHook), "ipc://" + this.ipcChannelName + "/" + this.ipcChannelName);
- }
- public void HookInstance(Int32 pid)
- {
- RemoteHooking.Inject(
- pid,
- "NetworkIncomingHook.dll",
- "NetworkIncomingHook.dll",
- this.ipcChannelName
- );
- RemoteHooking.Inject(
- pid,
- "NetworkOutgoingHook.dll",
- "NetworkOutgoingHook.dll",
- this.ipcChannelName
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement