static void PatchBinary(Offsets offset, byte[] pBytes, string file) { BinaryReader wowReader = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read)); wowReader.BaseStream.Seek((int)Offsets.emailOffset, SeekOrigin.Begin); if (wowReader.ReadByte() == pBytes[0]) { Console.WriteLine("{0} already patched!!!", file); wowReader.Close(); Console.WriteLine("Exit in 5 seconds..."); Thread.Sleep(5000); Environment.Exit(0); } else { wowReader.Close(); BinaryWriter wowWriter = new BinaryWriter(File.Open(file, FileMode.Open, FileAccess.ReadWrite)); wowWriter.BaseStream.Seek((int)offset, SeekOrigin.Begin); wowWriter.Write(pBytes); wowWriter.Close(); Console.WriteLine("Done."); } }
/// <summary> /// 获取几个重要的地址 /// </summary> /// <returns>返回是否成功找到入口地址</returns> private bool GetOffsets() { PluginUI.Log("Getting Offsets......"); try { var scanner = new SigScanner(FFXIV); try { _entrancePtr = scanner.ScanText("4C 8B DC 53 56 48 81 EC 18 02 00 00 48 8B 05"); } catch (ArgumentOutOfRangeException) { PluginUI.Log("无法对当前进程注入\n可能是已经被其他进程注入了?"); return(false); } Offsets = new Offsets(scanner); #if DEBUG PluginUI.Log(Offsets.ProcessChatBoxPtr); PluginUI.Log(Offsets.UiModule); PluginUI.Log(Offsets.RaptureModule); #endif } catch (ArgumentOutOfRangeException) { PluginUI.Log("查找失败:找不到特征值"); return(false); } return(true); }
public static void Run() { Console.WriteLine(@"Starting threads..."); //init classes var offset = new Offsets(); var address = new AddressManager(offset); var entityManager = new EntityFunctions(offset, address); var trigger = new TriggerManager(address, offset); var kb = new KbManager(); var recoil = new RecoilManager(address, offset); var aim = new AimManager(address, offset); //start threads new Thread(address.AddressLoop).Start(); new Thread(entityManager.BuildEntityList).Start(); new Thread(trigger.TriggerLoop).Start(); new Thread(kb.HotkeyLoop).Start(); new Thread(recoil.RecoilLoop).Start(); new Thread(aim.AimLoop).Start(); H.Aimbot = aim; //start overlay thread var overlay = new flux(); overlay.Show(); var wm = new WindowManager(overlay.Handle); new Thread(wm.WindowLoop).Start(); }
internal VMBody() { References = new List <string>(); MethodToIndex = new Dictionary <MethodDef, int>(); Translated = new Dictionary <MethodDef, List <VMInstruction> >(); OffsetHelper = new Offsets(); }
/// <summary> /// Attach all manipulation related classes to the passed process. /// ObjectManager and Hook related operations will be available after this call /// </summary> /// <param name="process"></param> public static void AttachToProcess(Process process) { lock (LockObject) { try { if (process.HasExited) { Logger.Warn("The process you have selected has exited. Please select another."); return; } if (IsAttached) { DetachFromProcess(); } if (Offsets.FindOffsets(process)) { Memory = new ExternalProcessReader(process); if (DxHook.Apply()) { Memory.ProcessExited += (sender, args) => DetachFromProcess(); Logger.Info("Attached to: " + process.Id); return; } } } catch (Exception ex) { Logger.Error("Failed to attach do to an exception.", ex); } DetachFromProcess(); Logger.Warn("Failed to attach to: " + process.Id); } }
public VMInstruction Translate(VMBody body, MethodDef method, int index, Offsets helper, out bool success) { var arg = (short)method.Parameters.IndexOf((Parameter)method.Body.Instructions[index].Operand); success = true; return(new VMInstruction(VMOpCode.Ldarg, arg)); }
// Override this to custom handle all offsets at once protected virtual string GetOffsetDescriptions() { StringBuilder sb = new StringBuilder(); if (Offsets.Any()) { // Write out each implemented offset's description foreach (Offset oSet in Offsets.Where(o => o.StartingIndex < Data.Length)) { // Get sectioned data IEnumerable <Offset> nextOffsets = Offsets.Where(o => o.StartingIndex > oSet.StartingIndex); int nextIndex = nextOffsets.Any() ? nextOffsets.Min(o => o.StartingIndex) : 0; if (nextIndex == 0) { nextIndex = Data.Length; } int bytesToTake = nextIndex - oSet.StartingIndex; byte[] sectionedData = GetSectionedData(oSet.StartingIndex, bytesToTake); sb.Append(GetSingleOffsetDescription(oSet, sectionedData)); } } else { sb.AppendLine($"Not yet implemented...{Environment.NewLine}Raw Data: {DataHex}"); } return(sb.ToString()); }
public override int Advance(int target) { Debug.Assert(target > DocID_Renamed); if (NextDocs[BLOCK_SIZE - 1] < target) { // not in the next block, now use the index int index = ForwardBinarySearch(target); int offset = (int)Offsets.Get(index); if (offset > this.Offset) { this.Offset = offset; DocID_Renamed = (int)DocIDs.Get(index) - 1; BlockIdx = index * IndexInterval - 1; while (true) { DecompressBlock(); if (NextDocs[BLOCK_SIZE - 1] >= target) { break; } DocID_Renamed = NextDocs[BLOCK_SIZE - 1]; } i = 0; } } return(SlowAdvance(target)); }
public override void ParseData() { // Parse triplets automatically if they exist Offset tripsOffset = Offsets.FirstOrDefault(o => o.DataType == Lookups.DataTypes.TRIPS); if (tripsOffset != null) { // If the triplets are in repeating groups, parse group by group if (IsRepeatingGroup) { int numLengthBytes = Offsets[1].StartingIndex; int curIndex = 0; while (curIndex < Data.Length) { int rgLength = numLengthBytes == 1 ? GetNumericValueFromData <byte>(curIndex, numLengthBytes) : GetNumericValueFromData <ushort>(curIndex, numLengthBytes); int tripletLength = rgLength - numLengthBytes; byte[] curTripletData = new byte[tripletLength]; Array.ConstrainedCopy(Data, curIndex + numLengthBytes, curTripletData, 0, tripletLength); // Append this group of triplets Triplets = Triplets.Concat(Triplet.GetAllTriplets(curTripletData)).ToList(); curIndex += rgLength; } } else { Triplets = Triplet.GetAllTriplets(Data.Skip(tripsOffset.StartingIndex).ToArray()); } } }
private void Read(BinaryReader br, Archive parent) { Num = br.ReadUInt32(); Size = br.ReadUInt32(); Checksum = br.ReadUInt64(); Table1count = br.ReadUInt32(); Table2count = br.ReadUInt32(); Table3count = br.ReadUInt32(); // read tables for (int i = 0; i < Table1count; i++) { var entry = new ArchiveItem(br, parent); if (!FileInfo.ContainsKey(entry.NameHash64)) { FileInfo.Add(entry.NameHash64, entry); } else { // TODO } } for (int i = 0; i < Table2count; i++) { Offsets.Add(new OffsetEntry(br, i)); } for (int i = 0; i < Table3count; i++) { Dependencies.Add(new HashEntry(br, i)); } }
internal Group(BinaryReaderEx br, GPGame game, int index, Offsets offsets) { int groupHeaderOffset = br.ReadInt32(); br.StepIn(offsets.GroupHeaders + groupHeaderOffset); { int paramCount = br.ReadInt32(); int paramHeaderOffsetsOffset = br.ReadInt32(); if (game == GPGame.DarkSouls2) { Name1 = br.ReadShiftJIS(); } else { Name1 = br.ReadUTF16(); Name2 = br.ReadUTF16(); } br.StepIn(offsets.ParamHeaderOffsets + paramHeaderOffsetsOffset); { Params = new List <Param>(paramCount); for (int i = 0; i < paramCount; i++) { Params.Add(new Param(br, game, offsets)); } } br.StepOut(); } br.StepOut(); Comments = new List <string>(); }
public VMInstruction Translate(VMBody body, MethodDef method, int index, Offsets helper, out bool success) { var operand = method.Body.Instructions.IndexOf((Instruction)method.Body.Instructions[index].Operand); success = true; return(new VMInstruction(VMOpCode.Jmp, operand)); }
public override void EmitMetaSetup(DomBlock block, Offsets offsets) { var tmp = block.TempVar(); PropertyDecorator element = Decorator.ElementDecorator; element.Definition.Name += "[]"; offsets.OffsetStorage = "{0} + ({1} * {2}) /*required-storage:{2}*/".Expr(Decorator.OffsetStorage, tmp, element.RequiredStorage); offsets.OffsetProperties = "{0} + ({1} * {2}) /*required-properties:{2}*/".Expr(Decorator.OffsetProperties, tmp, element.RequiredProperties); if (element.RequiredObjects == 0) { offsets.OffsetObjects = "0 /*required-objects:{0}*/".Expr(element.RequiredObjects); } else { offsets.OffsetObjects = "{0} + ({1} * {2}) /*required-objects:{2}*/".Expr(Decorator.OffsetObjects + 1, tmp, element.RequiredObjects); } block.Stmts.For(tmp, tmp + " < " + Decorator.PropertyType.ElementCount, body => { Create(element).EmitMetaSetup(new DomBlock(body, tmp + "_"), offsets, tmp.Expr()); }); }
public override void EmitObjectSetup(DomBlock block, Offsets offsets) { PropertyDecorator element = Decorator.ElementDecorator; if (element is PropertyDecoratorStruct) { PropertyDecoratorStruct structDecorator = (PropertyDecoratorStruct)element; EmitInitObject(Decorator.ClrType, block, offsets, /* size */ Decorator.PropertyType.ElementCount.Literal(), /* stride */ structDecorator.RequiredObjects.Literal()); var tmp = block.TempVar(); element.Definition.Name += "[]"; offsets.OffsetStorage = "offsets.OffsetStorage + {0} + ({1} * {2})".Expr(Decorator.OffsetStorage, tmp, element.RequiredStorage); offsets.OffsetObjects = "offsets.OffsetObjects + {0} + ({1} * {2})".Expr(Decorator.OffsetObjects + 1, tmp, element.RequiredObjects); offsets.OffsetProperties = "offsets.OffsetProperties + {0} + ({1} * {2})".Expr(Decorator.OffsetProperties, tmp, element.RequiredProperties); block.Stmts.For(tmp, tmp + " < " + Decorator.PropertyType.ElementCount, body => { Create(element).EmitObjectSetup(new DomBlock(body, tmp + "_"), offsets); }); } else { EmitInitObject(Decorator.ClrType, block, offsets, /* size */ Decorator.PropertyType.ElementCount.Literal(), /* stride */ element.RequiredStorage.Literal()); } }
internal Event(BinaryReaderEx br, Offsets offsets) { ID = br.ReadInt64(); long commandCount = br.ReadInt64(); long commandsOffset = br.ReadInt64(); long parameterCount = br.ReadInt64(); long parametersOffset = br.ReadInt64(); RestBehavior = br.ReadEnum32 <RestBehaviorType>(); br.AssertInt32(0); br.StepIn(offsets.Commands + commandsOffset); { Commands = new List <Command>((int)commandCount); for (int i = 0; i < commandCount; i++) { Commands.Add(new Command(br, offsets)); } } br.StepOut(); br.StepIn(offsets.Parameters + parametersOffset); { Parameters = new List <Parameter>((int)parameterCount); for (int i = 0; i < parameterCount; i++) { Parameters.Add(new Parameter(br)); } } br.StepOut(); }
public VMInstruction Translate(VMBody body, MethodDef method, int index, Offsets helper, out bool success) { var loc = (short)method.Body.Variables.IndexOf((Local)method.Body.Instructions[index].Operand); success = true; return(new VMInstruction(VMOpCode.Ldloc, loc)); }
public TrackObjectGraphics(byte[] romBuffer, Offsets offsets) { int typeCount = Enum.GetValues(typeof(TrackObjectType)).Length; int count = typeCount + 2; // + 2 to account for moving Match Race object and items this.tiles = new TrackObjectTile[count][]; int offsetLocation = offsets[Offset.TrackObjectGraphics]; byte[] tilesetGfx; int[] tileIndexes; for (int i = 0; i < typeCount; i++) { TrackObjectType type = (TrackObjectType)i; int offset = TrackObjectGraphics.GetGraphicsOffset(type, romBuffer, offsetLocation); tilesetGfx = Codec.Decompress(romBuffer, offset); tileIndexes = TrackObjectGraphics.GetTileIndexes(type); this.tiles[i] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes); } tileIndexes = TrackObjectGraphics.GetMatchRaceTileIndexes(); tilesetGfx = Codec.Decompress(romBuffer, offsets[Offset.MatchRaceObjectGraphics]); this.tiles[this.tiles.Length - 2] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes); tilesetGfx = Codec.Decompress(romBuffer, offsets[Offset.ItemGraphics]); this.tiles[this.tiles.Length - 1] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes); }
private void SetOffset() { /* Define yOffset based on lead type; pressure waveforms offset down, electric remains centered */ switch (Lead.Value) { default: Offset = Offsets.Center; Amplitude = 1f; break; case Lead.Values.ETCO2: case Lead.Values.SPO2: case Lead.Values.IABP: Offset = Offsets.Stretch; break; case Lead.Values.ABP: case Lead.Values.PA: Offset = Offsets.Scaled; break; case Lead.Values.CVP: case Lead.Values.IAP: case Lead.Values.ICP: Offset = Offsets.Center; break; } }
public byte[] Serialize(VMBody body, VMInstruction instruction, Offsets helper) { var buf = new byte[1]; buf[0] = (byte)VMOpCode.Pop; return(buf); }
public void Refresh(int characterIndex) { _characterIndex = characterIndex; _statsBase = Offsets.GetOffset(OffsetType.PartyStatsBase) + StatsLength * _characterIndex; var statBytes = MemoryReader.ReadBytes(_statsBase, StatsLength); TextTotalAP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.ApTotal).ToString(); TextCurrentAP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.ApCurrent).ToString(); TextCurrentHP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.CurrentHp).ToString(); TextCurrentMP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.CurrentMp).ToString(); TextMaxHP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.MaxHp).ToString(); TextMaxMP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.MaxMp).ToString(); TextBaseHP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.BaseHp).ToString(); TextBaseMP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.BaseMp).ToString(); TextSphereLevelCurrent.Text = statBytes[(int)PartyStatOffset.SphereLevelCurrent].ToString(); TextSphereLevelTotal.Text = BitConverter.ToUInt16(statBytes, (int)PartyStatOffset.SphereLevelTotal).ToString(); TextBaseStrength.Text = statBytes[(int)PartyStatOffset.BaseStrength].ToString(); TextBaseDefense.Text = statBytes[(int)PartyStatOffset.BaseDefense].ToString(); TextBaseMagic.Text = statBytes[(int)PartyStatOffset.BaseMagic].ToString(); TextBaseMagicDef.Text = statBytes[(int)PartyStatOffset.BaseMagicDefense].ToString(); TextBaseAgility.Text = statBytes[(int)PartyStatOffset.BaseAgility].ToString(); TextBaseLuck.Text = statBytes[(int)PartyStatOffset.BaseLuck].ToString(); TextBaseEvasion.Text = statBytes[(int)PartyStatOffset.BaseEvasion].ToString(); TextBaseAccuracy.Text = statBytes[(int)PartyStatOffset.BaseAccuracy].ToString(); }
private static void PopulateOffsetNameLookup() { //build map of offset enumerated names and a cardinal(numerical sequence) index to get them by. IE Button0 has a value of 45, but we want to return a value of 1 for display since that is effectively the first button var index = 0; OffsetLookup = Offsets.ToDictionary(name => index++); }
public void Refresh(int characterIndex) { _characterIndex = characterIndex; _statsBase = Offsets.GetOffset(OffsetType.PartyStatsBase) + StatsLength * _characterIndex; _nameBase = Offsets.GetOffset(OffsetType.AeonNames) + Offsets.AeonNames[_characterIndex - 8]; var statBytes = MemoryReader.ReadBytes(_statsBase, StatsLength); var nameBytes = MemoryReader.ReadBytes(_nameBase, 8); TextAeonName.Text = StringConverter.ToString(nameBytes); TextBaseHP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.BaseHp).ToString(); TextBaseMP.Text = BitConverter.ToUInt32(statBytes, (int)PartyStatOffset.BaseMp).ToString(); TextOverdrive.Text = statBytes[(int)PartyStatOffset.OverdriveLevel].ToString(); TextOverdriveMax.Text = statBytes[(int)PartyStatOffset.OverdriveMax].ToString(); TextBaseStrength.Text = statBytes[(int)PartyStatOffset.BaseStrength].ToString(); TextBaseDefense.Text = statBytes[(int)PartyStatOffset.BaseDefense].ToString(); TextBaseMagic.Text = statBytes[(int)PartyStatOffset.BaseMagic].ToString(); TextBaseMagicDef.Text = statBytes[(int)PartyStatOffset.BaseMagicDefense].ToString(); TextBaseAgility.Text = statBytes[(int)PartyStatOffset.BaseAgility].ToString(); TextBaseLuck.Text = statBytes[(int)PartyStatOffset.BaseLuck].ToString(); TextBaseEvasion.Text = statBytes[(int)PartyStatOffset.BaseEvasion].ToString(); TextBaseAccuracy.Text = statBytes[(int)PartyStatOffset.BaseAccuracy].ToString(); }
public Form1() { InitializeComponent(); aionOffsets = new Offsets(); aionOffsets.Update(); pc.PLAYER_INFOADDRESS_OFFSET = aionOffsets.playerInfoAddress; }
public byte[] Serialize(VMBody body, VMInstruction instruction, Offsets helper) { var buf = new byte[3]; buf[0] = (byte)VMOpCode.Starg; Array.Copy(BitConverter.GetBytes((short)instruction.Operand), 0, buf, 1, 2); return(buf); }
public AngelDPS() { InitializeComponent(); aionOffsets = new Offsets(); aionOffsets.Update(); //pc.PLAYER_INFOADDRESS_OFFSET = aionOffsets.playerInfoAddress; //tar.TARGETPTR_OFFSET = aionOffsets.targetInfoAddress; }
public Memory(Offsets offs, int pId) { this.offsets = offs; this.Process = Process.GetProcessById(pId); this.BaseAddress = this.Process.MainModule.BaseAddress.ToInt32(); this.Open(); this.modules = new Dictionary <string, int>(); }
private void SetLu_Click(object sender, RoutedEventArgs e) { var SelectSlot = personaSlot.Items[personaSlot.SelectedIndex] as ComboBoxItem; int slotnum = Convert.ToInt32(SelectSlot.Content); Offsets.SetStat(slotnum, "Lu", Int32.Parse(LuAmount.Text)); }
private float ToFloat(byte[] buffer, int shift, Offsets offset) { int lo = buffer[(int)offset + shift]; int hi = buffer[(int)offset + 1 + shift]; int result = (hi << 8) + lo; return((float)result); }
public byte[] Serialize(VMBody body, VMInstruction instruction, Offsets helper) { var buf = new byte[5]; buf[0] = (byte)VMOpCode.Je; Array.Copy(BitConverter.GetBytes(helper.Get((int)instruction.Operand)), 0, buf, 1, 4); return(buf); }
public Memory(Offsets offs, int pId) { offsets = offs; Process = Process.GetProcessById(pId); AddressOfProcess = Process.MainModule.BaseAddress.ToInt32(); Open(); modules = new Dictionary <string, int>(); }
private int FromSplit(byte[] buffer, int shift, Offsets offset, int nibbleOffset) { int result; int low = buffer[(int)offset + shift]; int hi = buffer[(int)offset + nibbleOffset + shift]; if (nibbleOffset == 2) { result = ((hi & 0x0F) << 8) + low; } else { result = ((hi & 0xF0) << 4) + low; } return result; }
public PlayerDataManager() { try { proc = Process.GetProcessesByName(gameName)[0]; memReader = new ProcessMemoryReader(); memReader.ReadProcess = proc; memReader.OpenProcess(); offsets = new Offsets(memReader.MainModuleBase); memReader.GetModuleBase(); } catch (IndexOutOfRangeException) { MessageBox.Show("Please open Assault Cube before starting the hack!"); Environment.Exit(0); } catch (Exception i) { MessageBox.Show("Exception", i.GetType().ToString() + ": " + i.Message + "\n" + i.StackTrace, MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } entityPlayerData = new PlayerData[maxPlayers]; localPlayerData = new PlayerData(); }
/// <summary> /// Does the unit have this flag? /// </summary> /// <param name="flags"></param> /// <returns></returns> private bool HasFlag(Offsets.UnitDynamicFlags flag) { return DynamicFlags.HasFlag(flag); }
/// <summary> /// Does the unit have this flag? /// </summary> /// <param name="flags"></param> /// <returns></returns> private bool HasFlag(Offsets.UnitDynamicFlags flags) { return DynamicFlags[(int)flags]; }
public bool HasUnitFlag(Offsets.UnitFlags flag) { return UnitFlags[(int)flag]; }
private float ToFloat(byte[] buffer, int shift, Offsets offset) { int lo = buffer[(int)offset + shift]; int hi = buffer[(int)offset + 1 + shift]; int result = (hi << 8) + lo; return (float) result; }
private byte ToByte(byte[] buffer, int shift, Offsets offset) { return buffer[(int)offset + shift]; }
internal bool HasUnitFlag(Offsets.UnitFlags flag) { return UnitFlags[(int)flag]; }
internal bool HasUnitFlag(Offsets.UnitFlags flag) { return UnitFlags.HasFlag(flag); }