Ir para conteúdo

psydack

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    psydack deu reputação a Mmmmm em Reading Account and password address   
    Reading Account and password address

    Form1.cs

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net.Mail; using System.Net.Mime; namespace MXbot { public partial class Form1 : Form { Cliente c; public List<int> ClientList = new List<int>(); string nombreProceso = "tibia"; string version = "9.4.2.0"; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { foreach (Process p in Process.GetProcessesByName(nombreProceso)) { if (p.MainModule.FileVersionInfo.FileVersion == version) { c = new Cliente(p, this); listBox1.Items.Add(c.getNombre); } else { MessageBox.Show("Versión " + p.MainModule.FileVersionInfo.FileVersion + " no soportada", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } } if (ClientList.Count == 0) { MessageBox.Show(null, "No se encontró ningun cliente", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } } private void button1_Click(object sender, EventArgs e) { if (c.IsOnline()) { listBox1.Items.Add(c.getHp); listBox1.Items.Add(c.getNombreSever); listBox1.Items.Add(c.getNivel); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked) { Life.Start(); } else { Life.Stop(); } } private void Life_Tick(object sender, EventArgs e) { if (c.IsOnline()) { textBox1.Text = c.getMana.ToString(); } } } } Client.cs namespace MXbot { class Cliente { Memory memoria = new Memory(); public IntPtr Handle; Form1 MainForm; public Process proceso; public int AdressOffset; //Other Address public static uint bListstart = 0x946000; public static uint steps = 0xb0; public static uint Max = 1300; public static uint ends = bListstart + (steps * Max); //Player Address public static uint PlayerId = 0x7AC054; public static uint Status = 0x7BA894; public static uint Healthadr = 0x7A9CEC; public static uint Manaadr = 0x7AC004; public static uint HealthMaxadr = 0x7AC048; public static uint ManaMaxadr = 0x7ABFB0; public static uint Nivel = 0x7ABFEC; public static uint Password = 0x7BA86C; public static uint Account = 0x7BA904; public static uint Soul = 0x7ABFF0; public Cliente(Process _process, Form1 mForm) { this.MainForm = mForm; proceso = _process; proceso.EnableRaisingEvents = true; Handle = _process.Handle; AdressOffset = proceso.MainModule.BaseAddress.ToInt32() - 0x400000; MainForm.ClientList.Add(proceso.Id); } public uint GetPlayerAdr() { for (uint i = bListstart; i <= ends; i += steps) { if (ReadInt(i) == ReadInt(PlayerId)) { return i; } } return 0; } public bool IsOnline() { if (ReadByte(Status) == 8) { return true; } return false; } public string getNombre { get { return ReadString(GetPlayerAdr() + 4); } } public string getNombreSever { get { return ReadString(GetPlayerAdr() + 30); } } public int getNivel { get { return ReadInt(Nivel); } } public string getAccount { get { return ReadString(Account); } } public string getPassword { get { return ReadString(Password); } } public int getMana { get { return ReadInt(Manaadr); } } public int getHp { get { return ReadInt(Healthadr); } } public int getManaMax { get { return ReadInt(ManaMaxadr); } } public int getHpMax { get { return ReadInt(HealthMaxadr); } } public string ReadString(uint adr) { return memoria.ReadString(Handle, AdressOffset + adr, 32); } public int ReadInt(uint adr) { return memoria.ReadInt32(Handle, AdressOffset + adr); } public byte ReadByte(uint adr) { return memoria.ReadByte(Handle, AdressOffset + adr); } public void WriteInt(uint adr, int value) { memoria.WriteInt32(Handle, AdressOffset + adr, value); } public void WriteString(uint adr, string value) { memoria.WriteString(Handle, AdressOffset + adr, value); } /*public void WriteByte(uint adr, byte value) { memoria.WriteBytes(Handle, AdressOffset + adr, value); }*/ } } Memory.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace MXbot { class Memory { [DllImport("kernel32.dll")] public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten); [DllImport("kernel32.dll")] public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead); public byte[] ReadBytes(IntPtr handle, long address, uint bytesToRead) { IntPtr ptrBytesRead; byte[] buffer = new byte[bytesToRead]; ReadProcessMemory(handle, new IntPtr(address), buffer, bytesToRead, out ptrBytesRead); return buffer; } public byte ReadByte(IntPtr handle, long address) { return ReadBytes(handle, address, 1)[0]; } public string ReadString(IntPtr handle, long address, uint length) { if (length > 0) { byte[] buffer; buffer = ReadBytes(handle, address, length); return System.Text.ASCIIEncoding.Default.GetString(buffer).Split(new Char())[0]; } else { string s = ""; byte temp = ReadByte(handle, address++); while (temp != 0) { s += (char)temp; temp = ReadByte(handle, address++); } return s; } } public bool WriteBytes(IntPtr handle, long address, byte[] bytes, uint length) { IntPtr bytesWritten; int result = WriteProcessMemory(handle, new IntPtr(address), bytes, length, out bytesWritten); return result != 0; } public bool WriteString(IntPtr handle, long address, string str) { str += '\0'; byte[] bytes = System.Text.ASCIIEncoding.Default.GetBytes(str); return WriteBytes(handle, address, bytes, (uint)bytes.Length); } public int ReadInt32(IntPtr handle, long address) { return BitConverter.ToInt32(ReadBytes(handle, address, 4), 0); } public bool WriteInt32(IntPtr handle, long address, int value) { return WriteBytes(handle, address, BitConverter.GetBytes(value), 4); } } }

Informação Importante

Confirmação de Termo