Exemplo n.º 1
0
        /// <summary>Peek into the Memory</summary>
        /// <param name="startDumpAddress">The Hex offset to start dump Example:0xC0000000 </param>
        /// <param name="dumpLength">The Length or size of dump Example:0xFFFFFF </param>
        /// <param name="memoryAddress">The memory address to peek Example:0xC5352525 </param>
        /// <param name="peekSize">The byte size to peek Example: "0x4" or "4"</param>
        /// <returns>Return the hex string of the value</returns>
        private string Peek(uint startDumpAddress, uint dumpLength, uint memoryAddress, int peekSize)
        {
            var total = (memoryAddress - startDumpAddress);

            if (memoryAddress > (startDumpAddress + dumpLength) || memoryAddress < startDumpAddress)
            {
                throw new Exception("Memory Address Out of Bounds");
            }

            if (!Connect())
            {
                return(null);            //Call function - If not connected return
            }
            if (!GetMeMex(startDumpAddress, dumpLength))
            {
                return(null);                                         //call function - If not connected or if somethign wrong return
            }
            var readWriter = new RWStream();

            try
            {
                var data = new byte[1026]; //byte chuncks

                //Writing each byte chuncks========
                for (var i = 0; i < dumpLength / 1024; i++)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, 1024);
                }
                //Write whatever is left
                var extra = (int)(dumpLength % 1024);
                if (extra > 0)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, extra);
                }
                readWriter.Flush();
                readWriter.Position = total;
                var value = readWriter.ReadBytes(peekSize);
                return(Functions.Functions.ToHexString(value));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                readWriter.Close(true);
                _tcp.Close(); //close connection
                _connected            = false;
                _memexValidConnection = false;
            }
        }
Exemplo n.º 2
0
        public void Dump(string filename, uint startDumpAddress, uint dumpLength)
        {
            if (!Connect())
            {
                return;             //Call function - If not connected return
            }
            if (!GetMeMex(startDumpAddress, dumpLength))
            {
                return;                                          //call function - If not connected or if something wrong return
            }
            var readWriter = new RWStream(filename);

            try
            {
                var data = new byte[1026]; //byte chuncks
                //Writing each byte chuncks========
                for (var i = 0; i < dumpLength / 1024; i++)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, 1024);
                    ReportProgress(0, (int)(dumpLength / 1024), (i + 1), "Dumping Memory...");
                }
                //Write whatever is left
                var extra = (int)(dumpLength % 1024);
                if (extra > 0)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, extra);
                }
                readWriter.Flush();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                readWriter.Close(false);
                _tcp.Close(); //close connection
                _connected            = false;
                _memexValidConnection = false;
            }
        }
Exemplo n.º 3
0
        /// <summary>Peek into the Memory</summary>
        /// <param name="startDumpAddress">The Hex offset to start dump Example:0xC0000000 </param>
        /// <param name="dumpLength">The Length or size of dump Example:0xFFFFFF </param>
        /// <param name="memoryAddress">The memory address to peek Example:0xC5352525 </param>
        /// <param name="peekSize">The byte size to peek Example: "0x4" or "4"</param>
        /// <returns>Return the hex string of the value</returns>
        private string Peek(uint startDumpAddress, uint dumpLength, uint memoryAddress, int peekSize)
        {
            var total = (memoryAddress - startDumpAddress);
            if (memoryAddress > (startDumpAddress + dumpLength) || memoryAddress < startDumpAddress)
                throw new Exception("Memory Address Out of Bounds");

            if (!Connect()) return null; //Call function - If not connected return
            if (!GetMeMex(startDumpAddress, dumpLength)) return null; //call function - If not connected or if somethign wrong return

            var readWriter = new RWStream();
            try
            {
                var data = new byte[1026]; //byte chuncks

                //Writing each byte chuncks========
                for (var i = 0; i < dumpLength / 1024; i++)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, 1024);
                }
                //Write whatever is left
                var extra = (int)(dumpLength % 1024);
                if (extra > 0)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, extra);
                }
                readWriter.Flush();
                readWriter.Position = total;
                var value = readWriter.ReadBytes(peekSize);
                return Functions.Functions.ToHexString(value);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                readWriter.Close(true);
                _tcp.Close(); //close connection
                _connected = false;
                _memexValidConnection = false;
            }
        }
Exemplo n.º 4
0
        public BindingList<Types.SearchResults> FindHexOffset(string pointer)
        {
            if (pointer == null)
                throw new Exception("Empty Search string!");
            if (!Functions.Functions.IsHex(pointer))
                throw new Exception(string.Format("{0} is not a valid Hex string.", pointer));
            if (!Connect()) return null; //Call function - If not connected return
            if (!GetMeMex()) return null; //call function - If not connected or if something wrong return

            try
            {
                //LENGTH or Size = Length of the dump
                var size = _startDumpLength;
                _readWriter = new RWStream();
                _readWriter.ReportProgress += new UpdateProgressBarHandler(ReportProgress);
                var data = new byte[1026]; //byte chuncks

                //Writing each byte chuncks========
                //No need to mess with it :D
                for (var i = 0; i < size / 1024; i++)
                {
                    if (_stopSearch) return null;
                    _tcp.Client.Receive(data);
                    _readWriter.WriteBytes(data, 2, 1024);
                    ReportProgress(0, (int)(size / 1024), (i + 1), "Dumping Memory...");
                }
                //Write whatever is left
                var extra = (int)(size % 1024);
                if (extra > 0)
                {
                    if (_stopSearch) return null;
                    _tcp.Client.Receive(data);
                    _readWriter.WriteBytes(data, 2, extra);
                }
                _readWriter.Flush();
                //===================================
                //===================================
                if (_stopSearch) return null;
                _readWriter.Position = 0;
                var values = _readWriter.SearchHexString(Functions.Functions.StringToByteArray(pointer), _startDumpOffset);
                return values;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _readWriter.Close(true);
                _tcp.Close(); //close connection
                _connected = false;
                _memexValidConnection = false;
                ReportProgress(0, 100, 0,"Idle");
            }
        }
Exemplo n.º 5
0
        public void Dump(string filename, uint startDumpAddress, uint dumpLength)
        {
            if (!Connect()) return; //Call function - If not connected return
            if (!GetMeMex(startDumpAddress, dumpLength)) return; //call function - If not connected or if something wrong return

            var readWriter = new RWStream(filename);
            try
            {
                var data = new byte[1026]; //byte chuncks
                //Writing each byte chuncks========
                for (var i = 0; i < dumpLength / 1024; i++)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, 1024);
                    ReportProgress(0, (int)(dumpLength / 1024), (i + 1), "Dumping Memory...");
                }
                //Write whatever is left
                var extra = (int)(dumpLength % 1024);
                if (extra > 0)
                {
                    _tcp.Client.Receive(data);
                    readWriter.WriteBytes(data, 2, extra);
                }
                readWriter.Flush();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                readWriter.Close(false);
                _tcp.Close(); //close connection
                _connected = false;
                _memexValidConnection = false;
            }
        }
Exemplo n.º 6
0
        public BindingList <Types.SearchResults> FindHexOffset(string pointer)
        {
            if (pointer == null)
            {
                throw new Exception("Empty Search string!");
            }
            if (!Functions.Functions.IsHex(pointer))
            {
                throw new Exception(string.Format("{0} is not a valid Hex string.", pointer));
            }
            if (!Connect())
            {
                return(null);            //Call function - If not connected return
            }
            if (!GetMeMex())
            {
                return(null);             //call function - If not connected or if something wrong return
            }
            try
            {
                //LENGTH or Size = Length of the dump
                var size = _startDumpLength;
                _readWriter = new RWStream();
                _readWriter.ReportProgress += new UpdateProgressBarHandler(ReportProgress);
                var data = new byte[1026]; //byte chuncks

                //Writing each byte chuncks========
                //No need to mess with it :D
                for (var i = 0; i < size / 1024; i++)
                {
                    if (_stopSearch)
                    {
                        return(null);
                    }
                    _tcp.Client.Receive(data);
                    _readWriter.WriteBytes(data, 2, 1024);
                    ReportProgress(0, (int)(size / 1024), (i + 1), "Dumping Memory...");
                }
                //Write whatever is left
                var extra = (int)(size % 1024);
                if (extra > 0)
                {
                    if (_stopSearch)
                    {
                        return(null);
                    }
                    _tcp.Client.Receive(data);
                    _readWriter.WriteBytes(data, 2, extra);
                }
                _readWriter.Flush();
                //===================================
                //===================================
                if (_stopSearch)
                {
                    return(null);
                }
                _readWriter.Position = 0;
                var values = _readWriter.SearchHexString(Functions.Functions.StringToByteArray(pointer), _startDumpOffset);
                return(values);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _readWriter.Close(true);
                _tcp.Close(); //close connection
                _connected            = false;
                _memexValidConnection = false;
                ReportProgress(0, 100, 0, "Idle");
            }
        }