コード例 #1
0
ファイル: BaseRemote.cs プロジェクト: zshell/WheresMyImplant
        ////////////////////////////////////////////////////////////////////////////////
        public Boolean ReadProcessMemoryChecked(
            IntPtr lpBaseAddress,
            IntPtr lpBuffer,
            UInt32 dwSize,
            string sectionName
            )
        {
            UInt32  dwNumberOfBytesRead     = 0;
            Boolean readProcessMemoryResult = Unmanaged.ReadProcessMemory(
                hProcess, lpBaseAddress, lpBuffer, dwSize, ref dwNumberOfBytesRead
                );


            if (readProcessMemoryResult)
            {
                WriteOutputGood("Section " + sectionName.Trim() + " (" + dwNumberOfBytesRead + " bytes), Read From To " + lpBaseAddress.ToString("X4"));
                return(true);
            }
            else
            {
                WriteOutputBad(
                    "Unable to read process memory" +
                    "\n\tResult:                  " + readProcessMemoryResult +
                    "\n\tdwSize                   " + dwSize +
                    "\n\tlpBaseAddress            " + lpBaseAddress.ToString("X4") +
                    "\n\tlpBuffer                 " + lpBuffer.ToString("X4") +
                    "\n\tdwNumberOfBytesRead      " + dwNumberOfBytesRead
                    );
                //This is dumb
                return(false);
            }
        }
コード例 #2
0
ファイル: BaseRemote.cs プロジェクト: zshell/WheresMyImplant
        ////////////////////////////////////////////////////////////////////////////////
        public Boolean ReadProcessMemoryUnChecked(
            IntPtr lpBaseAddress,
            IntPtr lpBuffer,
            UInt32 dwSize,
            string sectionName
            )
        {
            UInt32  dwNumberOfBytesRead     = 0;
            Boolean readProcessMemoryResult = Unmanaged.ReadProcessMemory(
                hProcess, lpBaseAddress, lpBuffer, dwSize, ref dwNumberOfBytesRead
                );

            if (readProcessMemoryResult)
            {
                return(true);
            }
            else
            {
                WriteOutputNeutral("Unable to read process memory");
                return(false);
            }
        }