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.InteropServices;
- namespace ShareLoader
- {
- class Program
- {
- static void Main(string[] args)
- {
- STARTUPINFO si = new STARTUPINFO();
- PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
- CreateProcess("share.exe", null,
- IntPtr.Zero, IntPtr.Zero, false,
- ProcessCreationFlags.CREATE_SUSPENDED,
- IntPtr.Zero, null, ref si, out pi);
- int written;
- byte[] buffer = new byte[1];
- WriteProcessMemory(pi.hProcess, 0x004B06B9, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x0049B225, buffer, 1, out written);
- buffer[0] = 0xeb;
- WriteProcessMemory(pi.hProcess, 0x0049B523, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x0049D1B8, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x0049B4B4, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x004B06C4, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x0049B236, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x004B0743, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x004B0785, buffer, 1, out written);
- WriteProcessMemory(pi.hProcess, 0x004B0821, buffer, 1, out written);
- ResumeThread(pi.hThread);
- }
- [DllImport("kernel32.dll")]
- static extern bool WriteProcessMemory(IntPtr hProcess, int lpBaseAddress,
- byte[] lpBuffer, uint nSize, out int lpNumberOfBytesWritten);
- [DllImport("kernel32.dll")]
- static extern bool CreateProcess(string lpApplicationName,
- string lpCommandLine, IntPtr lpProcessAttributes,
- IntPtr lpThreadAttributes,
- bool bInheritHandles, ProcessCreationFlags dwCreationFlags,
- IntPtr lpEnvironment, string lpCurrentDirectory,
- ref STARTUPINFO lpStartupInfo,
- out PROCESS_INFORMATION lpProcessInformation);
- [DllImport("kernel32.dll")]
- static extern uint ResumeThread(IntPtr hThread);
- }
- public struct STARTUPINFO
- {
- public uint cb;
- public string lpReserved;
- public string lpDesktop;
- public string lpTitle;
- public uint dwX;
- public uint dwY;
- public uint dwXSize;
- public uint dwYSize;
- public uint dwXCountChars;
- public uint dwYCountChars;
- public uint dwFillAttribute;
- public uint dwFlags;
- public short wShowWindow;
- public short cbReserved2;
- public IntPtr lpReserved2;
- public IntPtr hStdInput;
- public IntPtr hStdOutput;
- public IntPtr hStdError;
- }
- public struct PROCESS_INFORMATION
- {
- public IntPtr hProcess;
- public IntPtr hThread;
- public uint dwProcessId;
- public uint dwThreadId;
- }
- [Flags]
- public enum ProcessCreationFlags : uint
- {
- ZERO_FLAG = 0x00000000,
- CREATE_BREAKAWAY_FROM_JOB = 0x01000000,
- CREATE_DEFAULT_ERROR_MODE = 0x04000000,
- CREATE_NEW_CONSOLE = 0x00000010,
- CREATE_NEW_PROCESS_GROUP = 0x00000200,
- CREATE_NO_WINDOW = 0x08000000,
- CREATE_PROTECTED_PROCESS = 0x00040000,
- CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000,
- CREATE_SEPARATE_WOW_VDM = 0x00001000,
- CREATE_SHARED_WOW_VDM = 0x00001000,
- CREATE_SUSPENDED = 0x00000004,
- CREATE_UNICODE_ENVIRONMENT = 0x00000400,
- DEBUG_ONLY_THIS_PROCESS = 0x00000002,
- DEBUG_PROCESS = 0x00000001,
- DETACHED_PROCESS = 0x00000008,
- EXTENDED_STARTUPINFO_PRESENT = 0x00080000,
- INHERIT_PARENT_AFFINITY = 0x00010000
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement