private string ReadMemoryIdString(ProcessMemoryReader pReader, string stringType, string prefix, int memOffset)
        {
            string str  = "";
            string str2 = "";

            try
            {
                byte[] buffer;
                int    num;
                switch (stringType.ToLower())
                {
                case "utorrent_key":
                    buffer = pReader.ReadProcessMemory((IntPtr)memOffset, 4, out num);
                    return(string.Format("{0:X}{1:X}{2:X}{3:X}", new object[] { buffer[3], buffer[2], buffer[1], buffer[0] }));

                case "utorrent_peerid":
                    buffer = pReader.ReadProcessMemory((IntPtr)memOffset, 20, out num);
                    str    = Encoding.GetEncoding(0x6faf).GetString(buffer);
                    str2   = str.Replace(prefix, "");
                    if (str2.Length < str.Length)
                    {
                        return(str2);
                    }
                    return("");
                }
                str = "";
            }
            catch (Exception exception)
            {
                currentRMIns.AddLogLine("ClientsEnum : " + exception.ToString());
            }
            return(str);
        }
Ejemplo n.º 2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     timer1.Enabled = false;
     RefreshProcs();
     if (MapleProcess != null && PinCrackerProcess != null) //both are open
     {
         label1.Text       = "Both found and injected!";
         checkBox1.Enabled = true;
         System.Threading.Thread.Sleep(10);
         pReader.ReadProcess = MapleProcess;
         pReader.OpenProcess();
         byte[] dialogValue = pReader.ReadProcessMemory((IntPtr)0x8530B0, 4, out out2);
         if (BitConverter.ToInt32(dialogValue, 0) == 0) //maple's at a "connection ended" or another dialog
         {
             timer2.Enabled = false;
             ReloadMaple();
             timer2.Enabled = true;
         }
     }
     else
     {
         label1.Text       = "Maple/Cracker not found.";
         checkBox1.Checked = false;
     }
     timer1.Enabled = true;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            ProcessMemoryReader pReader = GetLithtechProcess();

            if (pReader != null)
            {
                pReader.OpenProcess();

                Console.WriteLine("Executable Name: " + pReader.GetProcessName() + " Base Addr: " + pReader.GetBaseAddress().ToString("X"));
                ProcessModule temp = pReader.GetModule("object.lto");

                if (temp != null)
                {
                    int    bytesRead = 0;
                    byte[] buffer    = new byte[4];
                    buffer = pReader.ReadProcessMemory(temp.BaseAddress, (uint)buffer.Length, out bytesRead);


                    //Get our modules correct offset
                    IntPtr finalOffset = temp.BaseAddress - pReader.GetBaseAddress();

                    //Add our static offset
                    IntPtr newOffset = (IntPtr)pReader.GetBaseAddress() + (int)finalOffset + 0x92128;

                    //Setup our multi level pointer
                    int[] offsetList = { 0x58c };

                    //Use our multi level pointer to get the correct pointer address
                    int finalPtrAddr = pReader.GetPointerAddress(newOffset, offsetList);
                    Console.WriteLine(String.Format("Final Offset Pointer Address: {0}", finalPtrAddr.ToString("x")));

                    while (true)
                    {
                        //check if we lost our object.lto and regain control
                        if (temp != null)
                        {
                            //Get our level name
                            string levelName = pReader.ReadProcessMemoryString((IntPtr)finalPtrAddr, 64, out bytesRead);
                            Console.WriteLine(String.Format("Level loaded: {0}", levelName));
                            System.Threading.Thread.Sleep(200);
                            Console.CursorTop--;
                            Console.CursorVisible = false;
                        }
                        else
                        {
                            //We lost it, so try and get it again
                            temp = pReader.GetModule("object.lto");
                        }
                    }
                }
            }

            Console.ReadLine();
        }
        private int ReadMemoryAddress(int offset, uint bytelength)
        {
            int bytesReadSize;

            IntPtr readAddress = IntPtr.Add(ProcessBaseAddress, offset);

            byte[] mem = reader.ReadProcessMemory(readAddress, bytelength, out bytesReadSize);

            int i = ByteToInt(mem, bytesReadSize);

            return(i);
        }
Ejemplo n.º 5
0
        private void Run()
        {
            bool isStopped             = false;
            ProcessMemoryReader reader = new ProcessMemoryReader();

            reader.ReadProcess = mainProcess;
            UInt64 readSize = 4 * 4 * 4;

            byte[] readBuffer = new byte[readSize];
            reader.OpenProcess();

            Mutex mutex = new Mutex(false, "Dirt5MatrixProviderMutex");


            using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew("Dirt5MatrixProvider", 10000))
            {
                while (!isStopped)
                {
                    try
                    {
                        Int64 byteReadSize;
                        reader.ReadProcessMemory((IntPtr)memoryAddress, readSize, out byteReadSize, readBuffer);

                        if (byteReadSize == 0)
                        {
                            continue;
                        }

                        float[] floats = new float[4 * 4];

                        Buffer.BlockCopy(readBuffer, 0, floats, 0, readBuffer.Length);

                        SetRichTextBoxThreadSafe(matrixBox, "" + floats[0] + " " + floats[1] + " " + floats[2] + " " + floats[3] + "\n" + floats[4] + " " + floats[5] + " " + floats[6] + " " + floats[7] + "\n" + floats[8] + " " + floats[9] + " " + floats[10] + " " + floats[11] + "\n" + floats[12] + " " + floats[13] + " " + floats[14] + " " + floats[15]);

                        mutex.WaitOne();

                        using (MemoryMappedViewStream stream = mmf.CreateViewStream())
                        {
                            BinaryWriter writer = new BinaryWriter(stream);
                            writer.Write(readBuffer);
                        }
                        mutex.ReleaseMutex();

                        Thread.Sleep(1000 / 100);
                    }
                    catch (Exception e)
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            var procs = Process.GetProcesses();
            var ms    = procs.FirstOrDefault(p => p.ProcessName == "MineSweeper");

            reader = new ProcessMemoryReader()
            {
                ReadProcess = ms
            };

            reader.OpenProcess();
            int read = -1;

            data2 = reader.ReadProcessMemory((IntPtr)0x10000, 57344, out read);
        }
Ejemplo n.º 7
0
        private int ReadMemoryAddress(int offset, uint bytelength)
        {
            int bytesReadSize;

            ProcessMemoryReader reader = new ProcessMemoryReader();

            reader.ReadProcess = FF8Process;
            reader.OpenProcess();

            IntPtr readAddress = IntPtr.Add(GameBaseAddress, offset);

            byte[] mem = reader.ReadProcessMemory(readAddress, bytelength, out bytesReadSize);

            int i = ByteToInt(mem, bytesReadSize);

            return(i);
        }
Ejemplo n.º 8
0
 private static float ReadSingle(ProcessMemoryReader memoryReader, int baseaddress, int offset)
 {
     return(BitConverter.ToSingle(memoryReader.ReadProcessMemory((IntPtr)(baseaddress + offset), 4, out int _), 0));
 }
Ejemplo n.º 9
0
 private static int ReadInt(ProcessMemoryReader memoryReader, int baseaddress, int offset)
 {
     return(BitConverter.ToInt32(memoryReader.ReadProcessMemory((IntPtr)(baseaddress + offset), 4, out int _), 0));
 }
Ejemplo n.º 10
0
 private static byte[] GetEntities(ProcessMemoryReader memoryReader)
 {
     return(memoryReader.ReadProcessMemory((IntPtr)(Offsets.ClientBaseAddress + Offsets.EntityListBaseAddress), (uint)(Offsets.MaxEntities * Offsets.EntityLength), out int _));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// The thread funktion to poll the telemetry data and send TelemetryUpdated events.
        /// </summary>
        private void Run()
        {
            isStopped = false;

            WFSTAPI lastTelemetryData = new WFSTAPI();

            lastTelemetryData.Reset();
            Matrix4x4 lastTransform  = Matrix4x4.Identity;
            bool      lastFrameValid = false;
            Vector3   lastVelocity   = Vector3.Zero;
            float     lastYaw        = 0.0f;
            Stopwatch sw             = new Stopwatch();

            sw.Start();

            NestedSmooth accXSmooth = new NestedSmooth(3, 6, 0.5f);
            NestedSmooth accYSmooth = new NestedSmooth(3, 6, 0.5f);
            NestedSmooth accZSmooth = new NestedSmooth(3, 6, 0.5f);

            KalmanFilter velXFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.02f, 0.0f);
            KalmanFilter velZFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.02f, 0.0f);

            NoiseFilter velXSmooth = new NoiseFilter(6, 0.5f);
            NoiseFilter velZSmooth = new NoiseFilter(6, 0.5f);

            KalmanFilter yawRateFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.02f, 0.0f);
            NoiseFilter  yawRateSmooth = new NoiseFilter(6, 0.5f);

            NoiseFilter pitchFilter = new NoiseFilter(3);
            NoiseFilter rollFilter  = new NoiseFilter(3);
            NoiseFilter yawFilter   = new NoiseFilter(3);

            KalmanFilter posXFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.1f, 0.0f);
            KalmanFilter posYFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.1f, 0.0f);
            KalmanFilter posZFilter = new KalmanFilter(1, 1, 0.02f, 1, 0.1f, 0.0f);

            NestedSmooth posXSmooth = new NestedSmooth(12, 6, 0.5f);
            NestedSmooth posYSmooth = new NestedSmooth(12, 6, 0.5f);
            NestedSmooth posZSmooth = new NestedSmooth(12, 6, 0.5f);



            NoiseFilter slipAngleSmooth = new NoiseFilter(6, 0.25f);

            ProcessMemoryReader reader = new ProcessMemoryReader();

            reader.ReadProcess = wfstProcess;
            uint readSize = 4 * 4 * 4;

            byte[] readBuffer = new byte[readSize];
            reader.OpenProcess();

            while (!isStopped)
            {
                try
                {
                    float dt = (float)sw.ElapsedMilliseconds / 1000.0f;


                    int byteReadSize;
                    reader.ReadProcessMemory((IntPtr)memoryAddress, readSize, out byteReadSize, readBuffer);


                    if (byteReadSize == 0)
                    {
                        continue;
                    }

                    float[] floats = new float[4 * 4];

                    Buffer.BlockCopy(readBuffer, 0, floats, 0, readBuffer.Length);

                    Matrix4x4 transform = new Matrix4x4(floats[0], floats[1], floats[2], floats[3]
                                                        , floats[4], floats[5], floats[6], floats[7]
                                                        , floats[8], floats[9], floats[10], floats[11]
                                                        , floats[12], floats[13], floats[14], floats[15]);



                    Vector3 rht = new Vector3(transform.M11, transform.M12, transform.M13);
                    Vector3 up  = new Vector3(transform.M21, transform.M22, transform.M23);
                    Vector3 fwd = new Vector3(transform.M31, transform.M32, transform.M33);

                    float rhtMag = rht.Length();
                    float upMag  = up.Length();
                    float fwdMag = fwd.Length();

                    //reading garbage
                    if (rhtMag < 0.9f || upMag < 0.9f || fwdMag < 0.9f)
                    {
                        IsConnected = false;
                        IsRunning   = false;
                        TelemetryLost();
                        break;
                    }

                    if (!lastFrameValid)
                    {
                        lastTransform  = transform;
                        lastFrameValid = true;
                        lastVelocity   = Vector3.Zero;
                        lastYaw        = 0.0f;
                        continue;
                    }

                    WFSTAPI telemetryData = new WFSTAPI();

                    if (dt <= 0)
                    {
                        dt = 1.0f;
                    }


                    Vector3 worldVelocity = (transform.Translation - lastTransform.Translation) / dt;
                    lastTransform = transform;

                    Matrix4x4 rotation = new Matrix4x4();
                    rotation     = transform;
                    rotation.M41 = 0.0f;
                    rotation.M42 = 0.0f;
                    rotation.M43 = 0.0f;

                    Matrix4x4 rotInv = new Matrix4x4();
                    Matrix4x4.Invert(rotation, out rotInv);

                    Vector3 localVelocity = Vector3.Transform(worldVelocity, rotInv);

                    telemetryData.velX = worldVelocity.X;
                    telemetryData.velZ = worldVelocity.Z;

                    Vector3 localAcceleration = localVelocity - lastVelocity;
                    lastVelocity = localVelocity;


                    telemetryData.accX = localAcceleration.X * 10.0f;
                    telemetryData.accY = localAcceleration.Y * 100.0f;
                    telemetryData.accZ = localAcceleration.Z * 10.0f;


                    float pitch = (float)Math.Asin(-fwd.Y);
                    float yaw   = (float)Math.Atan2(fwd.X, fwd.Z);

                    float   roll     = 0.0f;
                    Vector3 rhtPlane = rht;
                    rhtPlane.Y = 0;
                    rhtPlane   = Vector3.Normalize(rhtPlane);
                    if (rhtPlane.Length() <= float.Epsilon)
                    {
                        roll = -(float)(Math.Sign(rht.Y) * Math.PI * 0.5f);
                    }
                    else
                    {
                        roll = -(float)Math.Asin(Vector3.Dot(up, rhtPlane));
                    }

                    telemetryData.pitchPos = pitch;
                    telemetryData.yawPos   = yaw;
                    telemetryData.rollPos  = roll;

                    telemetryData.yawRate = CalculateAngularChange(lastYaw, yaw) * (180.0f / (float)Math.PI);
                    lastYaw = yaw;

                    // otherwise we are connected
                    IsConnected = true;

                    if (IsConnected)
                    {
                        IsRunning = true;


                        WFSTAPI telemetryToSend = new WFSTAPI();
                        telemetryToSend.Reset();

                        telemetryToSend.CopyFields(telemetryData);

                        telemetryToSend.accX = accXSmooth.Filter(telemetryData.accX);
                        telemetryToSend.accY = accYSmooth.Filter(telemetryData.accY);
                        telemetryToSend.accZ = accZSmooth.Filter(telemetryData.accZ);


                        telemetryToSend.pitchPos = pitchFilter.Filter(telemetryData.pitchPos);
                        telemetryToSend.rollPos  = rollFilter.Filter(telemetryData.rollPos);
                        telemetryToSend.yawPos   = yawFilter.Filter(telemetryData.yawPos);

                        telemetryToSend.velX = velXSmooth.Filter(velXFilter.Filter(telemetryData.velX));
                        telemetryToSend.velZ = velZSmooth.Filter(velZFilter.Filter(telemetryData.velZ));

                        telemetryToSend.yawRate = yawRateSmooth.Filter(yawRateFilter.Filter(telemetryData.yawRate));

                        telemetryToSend.yawAcc = slipAngleSmooth.Filter(telemetryToSend.CalculateSlipAngle());

                        sw.Restart();

                        TelemetryEventArgs args = new TelemetryEventArgs(
                            new WFSTTelemetryInfo(telemetryToSend, lastTelemetryData));
                        RaiseEvent(OnTelemetryUpdate, args);

                        lastTelemetryData = telemetryToSend;
                        Thread.Sleep(1000 / 100);
                    }
                    else if (sw.ElapsedMilliseconds > 500)
                    {
                        IsRunning = false;
                    }
                }
                catch (Exception e)
                {
                    LogError("WFSTTelemetryProvider Exception while processing data", e);
                    IsConnected = false;
                    IsRunning   = false;
                    Thread.Sleep(1000);
                }
            }

            IsConnected = false;
            IsRunning   = false;
            reader.CloseHandle();
        }
Ejemplo n.º 12
0
        private void btnGet_Click(object sender, EventArgs e)
        {
            iWidthAddress    = 0x1005334;
            iHeightAddress   = 0x1005338;
            iMinesAddress    = 0x1005330;
            iCellBaseAddress = 0x1005340;


            Process[] prMine = Process.GetProcessesByName("winmine");
            if (prMine.Length == 0)
            {
                return;
            }

            pmrMine.ReadProcess = prMine[0];

            pmrMine.OpenProcess();

            int iWidth;
            int iHeight;
            int iMinesCount;


            byte[] byBuff;
            int    bytesReaded;

            byBuff = pmrMine.ReadProcessMemory((IntPtr)iWidthAddress, 1, out bytesReaded);
            iWidth = byBuff[0];

            byBuff  = pmrMine.ReadProcessMemory((IntPtr)iHeightAddress, 1, out bytesReaded);
            iHeight = byBuff[0];

            byBuff      = pmrMine.ReadProcessMemory((IntPtr)iMinesAddress, 1, out bytesReaded);
            iMinesCount = byBuff[0];

            lblWH.Text = "Width: " + iWidth.ToString() + "  " + "Height: " + iHeight.ToString() + " " + "Mines Count: " + iMinesCount.ToString();

            Button[,] btnArray = new Button[iWidth, iHeight];
            picBtnCon.Controls.Clear();

            IntPtr    i    = Process.GetProcessesByName("winmine")[0].MainWindowHandle;
            Rectangle rect = new Rectangle();

            GetWindowRect(i, ref rect);
            SetForegroundWindow(Process.GetProcessesByName("winmine")[0].MainWindowHandle);
            Thread.Sleep(100);
            for (int y = 0; y < iHeight; y++)
            {
                for (int x = 0; x < iWidth; x++)
                {
                    btnArray[x, y]          = new Button();
                    btnArray[x, y].Location = new Point(x * 20, y * 20);
                    btnArray[x, y].Name     = "";
                    btnArray[x, y].Size     = new Size(20, 20);
                    btnArray[x, y].Parent   = picBtnCon;
                    picBtnCon.Controls.Add(btnArray[x, y]);


                    int iAdd = iCellBaseAddress + (32 * (y + 1) + (x + 1));
                    byBuff = pmrMine.ReadProcessMemory((IntPtr)iAdd, 1, out bytesReaded);
                    int iIsMine = byBuff[0];

                    Cursor.Position = new Point(rect.X + 15 + 6 + 16 * x, rect.Y + 104 + 5 + 16 * y);
                    //Thread.Sleep(1);

                    if (x == 0 && y == 0)
                    {
                        if (iIsMine == 0x8F)
                        {
                            mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0);
                        }
                        else
                        {
                            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0);
                        }
                    }

                    if (iIsMine == 0x8F)
                    {
                        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0);
                        btnArray[x, y].Text = "X";
                    }
                    else
                    {
                        mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, (uint)Cursor.Position.X, (uint)Cursor.Position.Y, 0, 0);
                    }
                    Application.DoEvents();
                }
            }
            picBtnCon.Size = new Size(iWidth * 20, iHeight * 20);
            this.Height    = picBtnCon.Height + 140;
            this.Width     = picBtnCon.Width + 30;

            pmrMine.CloseHandle();
        }