Last active
August 29, 2015 14:11
-
-
Save evilz/35372712265e5a71c231 to your computer and use it in GitHub Desktop.
Infector review1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DllInjection.Services; | |
using EasyHook; | |
using System; | |
using System.CodeDom.Compiler; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Runtime.Remoting; | |
namespace DllInfector | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string ChannelName = CreateIpcServer(); | |
var pi = Process.Start(new ProcessStartInfo(Environment.CurrentDirectory + @"\TargetManagedProcess.exe") | |
{ | |
UseShellExecute = false, | |
RedirectStandardOutput = true | |
}); | |
Hook(ChannelName, pi.Id); | |
while (!pi.StandardOutput.EndOfStream) | |
{ | |
string line = pi.StandardOutput.ReadLine(); | |
Console.WriteLine(line); | |
} | |
pi.WaitForExit(); | |
} | |
private static string CreateIpcServer() | |
{ | |
string ChannelName = null; | |
RemoteHooking.IpcCreateServer<MessengerService>(ref ChannelName, WellKnownObjectMode.Singleton); | |
return ChannelName; | |
} | |
private static void Hook(string ChannelName, int processId) | |
{ | |
RemoteHooking.Inject( | |
processId, | |
Environment.CurrentDirectory + @"\DllInjection.dll", // 32 bits | |
Environment.CurrentDirectory + @"\DllInjection.dll", // 64 bits | |
ChannelName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment