예제 #1
0
        public byte[] Assemble(Operand op1, out bool fullyAssembled, Shellcode shellcode)
        {
            byte[] res_opcode   = Opcode;
            byte[] res_ModRegRM = new byte[0];
            byte[] res_end      = new byte[0];
            fullyAssembled = true;

            if (op1.Imm)
            {
                UInt64 imm = op1.GetValue(out fullyAssembled, shellcode);
                if (shellcode.IsWin64)
                {
                    res_end = res_end.Concat(MemoryFunctions.ToByteArray(imm)).ToArray();
                }
                else
                {
                    res_end = res_end.Concat(MemoryFunctions.ToByteArray((UInt32)imm)).ToArray();
                }
            }
            else if (op1.Reg && Plusr)
            {
                // Add register code to the last byte of the opcode and return
                res_opcode[res_opcode.Length - 1] = (byte)(res_opcode[res_opcode.Length - 1] + (byte)AssemblyDefines.Registers[op1.GetRegisterName()]);
            }
            else
            {
                fullyAssembled = false;
                throw new Exception("Opcode Assembler Error: Failed to assemble instruction with opcode " + MemoryFunctions.ByteArrayToString(Opcode));
            }

            return(res_opcode.Concat(res_ModRegRM).Concat(res_end).ToArray());
        }
예제 #2
0
        private Character GetClosestMonster()
        {
            float minDistance = 99999.0f;

            Character        closestMonster = null;
            List <Character> players        = new List <Character>();
            List <Character> monsters       = new List <Character>();
            List <Character> fate           = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);

            foreach (Character monster in monsters)
            {
                if (monster.IsClaimed || monster.Health_Percent < 100 || _ignorelist.Contains(monster.ID))
                {
                    continue;
                }

                if (lst_Monsters.Items.Contains(monster.Name))
                {
                    float curDistance = _user.Coordinate.Distance(monster.Coordinate);
                    if (curDistance < minDistance && curDistance < 15)
                    {
                        minDistance    = curDistance;
                        closestMonster = monster;
                    }
                }
            }

            return(closestMonster);
        }
예제 #3
0
        private object parseValue(XElement item)
        {
            try
            {
                switch (item.Name.ToString().ToLowerInvariant())
                {
                case "api":
                    // Resolve an api import
                    ulong address = MemoryFunctions.LoadAddress(item.Element("Library").Value.ToString(), item.Element("Procedure").Value.ToString(), _process.ProcessDotNet);
                    return(_process.IsWin64 ? (UInt64)address : (UInt32)address);


                case "intptr":
                    string data = item.Value.ToString();
                    return(_process.IsWin64 ? UInt64.Parse(data, System.Globalization.NumberStyles.AllowHexSpecifier) : UInt32.Parse(data, System.Globalization.NumberStyles.AllowHexSpecifier));

                default:
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(
                    "HOOK PARSING ERROR: An unknown error occured while processing a hook <Variable> element.\n" +
                    "\nLocation: " + item.Name.ToString() + "\n\nError Reason: " + ex.Message.ToString() + "\n");
                return(null);
            }
        }
예제 #4
0
        public void PSubscribeKVTest()
        {
            Random r = new Random(23);
            var    f = new MemoryFunctions();

            using var session    = client.GetSession(f);
            using var subSession = client.GetSession(f);
            var key       = new Memory <int>(new int[2 + r.Next(50)]);
            var value     = new Memory <int>(new int[1 + r.Next(50)]);
            int randomNum = r.Next(100);

            key.Span[0] = randomNum;
            key.Span[1] = value.Length;
            value.Span.Fill(key.Span[0]);

            var upsertKey = new Memory <int>(new int[100]);

            upsertKey.Span[0] = randomNum;
            upsertKey.Span[1] = value.Length;

            subSession.PSubscribeKV(key);
            subSession.CompletePending(true);
            session.Upsert(upsertKey, value);
            session.CompletePending(true);

            f.WaitSubscribe();
        }
예제 #5
0
        private Character GetMonsterFromID(int ID)
        {
            List <Character> players  = new List <Character>();
            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);

            foreach (Character monster in monsters)
            {
                if (monster.ID == ID)
                {
                    return(monster);
                }
            }

            foreach (Character monster in fate)
            {
                if (monster.ID == ID)
                {
                    return(monster);
                }
            }

            return(null);
        }
예제 #6
0
        private void btn_StartFishing_Click(object sender, RoutedEventArgs e)
        {
            DateTime eorzeaTime = MemoryFunctions.GetGameTime();
            bool     nightTime  = eorzeaTime.Hour < 6 || eorzeaTime.Hour >= 18;

            if (chk_NightMode.IsChecked == true)
            {
                if (_fishPath1.Waypoints.Count == 0)
                {
                    return;
                }

                if (nightTime)
                {
                    _fishPath1.Start();
                    _currPath = 1;
                }
                else
                {
                    _fishPath2.Start();
                    _currPath = 2;
                }


                return;
            }

            _fishtimer.Reset();
            _fishtimer2.Reset();

            _newArea = false;
            _fishMonitor.Start();
        }
예제 #7
0
 public void TeleportPlayerToCamera()
 {
     if (!MemoryFunctions.Teleport(renderer.Camera.GetPosition()))
     {
         MessageBox.Show("Unable to teleport player.");
     }
 }
예제 #8
0
        public static bool IsWin64(System.Diagnostics.Process process)
        {
            UInt64 address = (UInt64)process.MainModule.BaseAddress;

            // Read in the Image Dos Header
            byte[]           headerData = MemoryFunctions.ReadMemory(process, (IntPtr)address, (uint)Marshal.SizeOf(typeof(IMAGE_DOS_HEADER)));
            IMAGE_DOS_HEADER dosHeader  = (IMAGE_DOS_HEADER)MemoryFunctions.RawDataToObject(ref headerData, typeof(IMAGE_DOS_HEADER));

            // Load the PE Address
            UInt64 PE_header = 0;

            if (dosHeader.e_magic == 0x5A4D)
            {
                // Load the PE header address
                PE_header = dosHeader.e_lfanew + address;
            }
            else
            {
                PE_header = address;
            }

            // Read in the PE token
            byte[] PE_Token = MemoryFunctions.ReadMemory(process, (IntPtr)PE_header, 4);
            if (!(PE_Token[0] == 'P' & PE_Token[1] == 'E' & PE_Token[2] == 0 & PE_Token[3] == 0))
            {
                // Problem, we are not pointing at a correct PE header. Abort.
                throw new Exception("Failed to read PE header from block " + address.ToString("X") + " with PE header located at " + PE_header.ToString() + ".");
            }

            // Input the COFFHeader
            byte[]     coffHeader_rawData = MemoryFunctions.ReadMemory(process, (IntPtr)(PE_header + 4), (uint)Marshal.SizeOf(typeof(COFFHeader)));
            COFFHeader coffHeader         = (COFFHeader)MemoryFunctions.RawDataToObject(ref coffHeader_rawData, typeof(COFFHeader));

            return(((MACHINE)coffHeader.Machine) == MACHINE.IMAGE_FILE_MACHINE_IA64 || ((MACHINE)coffHeader.Machine) == MACHINE.IMAGE_FILE_MACHINE_AMD64);
        }
예제 #9
0
        private void dlgCureBot_Loaded(object sender, RoutedEventArgs e)
        {
            _hotKeyManager = new HotKeyManager(this);
            _hotKeyManager.AddGlobalHotKey(_enableHK);

            _hotKeyManager.GlobalHotKeyPressed += new GlobalHotKeyEventHandler(hotKeyManager_GlobalHotKeyPressed);

            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();
            List <Character> players  = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);

            if (_user.Job == JOB.WHM)
            {
                chk_TankPriority.IsChecked = true;
                chk_WHMMode.IsChecked      = true;
            }
            else
            {
                txt_CurePotency.Text = "750";
            }

            lst_StatusEffects.Items.Add("17");
            lst_StatusEffects.Items.Add("62");
            lst_StatusEffects.Items.Add("269");
            lst_StatusEffects.Items.Add("181");
            lst_StatusEffects.Items.Add("216");
        }
예제 #10
0
        private void btn_AddSurroundingPlayers_Click(object sender, RoutedEventArgs e)
        {
            lst_Targets.Items.Clear();

            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();
            List <Character> players  = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);

            int TankCount = 0;

            foreach (Character p in players)
            {
                _targets.Add(p.Name);
                if (p.Job == JOB.PLD || p.Job == JOB.WAR)
                {
                    if (TankCount == 0)
                    {
                        txt_Tank.Text = p.Name;
                    }
                    else
                    {
                        txt_Tank2.Text = p.Name;
                    }

                    TankCount++;
                }
            }

            RefreshTargetList();
            gb_SelectedTargets.Header = "Selected Targets: " + lst_Targets.Items.Count;
        }
예제 #11
0
 private void Wanted_Lv_6_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_set_Wanted_Level(6);
         });
     }
 }
예제 #12
0
 private void FIX_Vehilc_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_FIX_Vehlie();
         });
     }
 }
예제 #13
0
 private void NO_Doors_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_SET_Vehicle_Doors();
         });
     }
 }
예제 #14
0
 private void Spread_Button_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_Spread();
         });
     }
 }
예제 #15
0
 private void Vehicle_SUSPENSION_FORCE_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double?> e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_SET_Vehicle_SUSPENSION_FORCE((float)this.Vehicle_SUSPENSION_FORCE.Value.Value);
         });
     }
 }
예제 #16
0
 private void Vehile_ACCELERATION_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double?> e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_Set_Vehlie_ACCELERATION((float)this.Vehile_ACCELERATION.Value.Value);
         });
     }
 }
예제 #17
0
        public List <Character> MonstersNear(double distance)
        {
            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();
            List <Character> players  = new List <Character>();
            Character        user     = null;

            MemoryFunctions.GetCharacters(monsters, fate, players, ref user);

            return(monsters.Where(monster => DistanceFrom(monster) < distance && monster.Health_Current > 0 && monster.ID != ID && monster.IsHidden == false && monster.Owner == -536870912).Distinct().ToList());
        }
예제 #18
0
 public string ToHex()
 {
     if (Data != null)
     {
         return(MemoryFunctions.ToHex(Data));
     }
     else
     {
         throw new Exception("Error. Argument is null and cannot be accessed.");
     }
 }
예제 #19
0
        private void btn_InsertCoordinate_Click(object sender, RoutedEventArgs e)
        {
            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();
            List <Character> players  = new List <Character>();
            Character        user     = null;

            MemoryFunctions.GetCharacters(monsters, fate, players, ref user);

            _navigation.Waypoints.Add(user.Coordinate);
        }
예제 #20
0
        private void btn_Refresh_Click(object sender, RoutedEventArgs e)
        {
            //AggroHelper test = new AggroHelper();
            //List<int> newlist = test.GetAggroList();

            MemoryFunctions.GetCharacters(_monsters, _fate, _players, ref _user);
            MemoryFunctions.GetNPCs(_npcs);
            MemoryFunctions.GetGathering(_gathering);

            RefreshCharacterList();
        }
예제 #21
0
 private void Bullet_DMG_Slider_DragCompleted(object sender, DragCompletedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_Bullet_DMG((float)this.Bullet_DMG_Slider.Value);
         });
         return;
     }
     this.Bullet_DMG_Slider.Value = 0.0;
 }
예제 #22
0
 private void Bullet_proof_Tires_ToggleSwitch_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_SET_Vehicle_Bullet_proof_Tires(this.Bullet_proof_Tires_ToggleSwitch.IsChecked);
         });
         return;
     }
     this.Bullet_proof_Tires_ToggleSwitch.IsChecked = new bool?(false);
 }
예제 #23
0
 public int ToInt()
 {
     // Return the data an int
     if (Data != null)
     {
         return((int)MemoryFunctions.ByteArrayToUint(Data, 0));
     }
     else
     {
         throw new Exception("Error. Argument is null and cannot be accessed.");
     }
 }
예제 #24
0
 private void Seatbelt_ToggleSwitch_Click(object sender, RoutedEventArgs e)
 {
     if (MemoryFunctions.IsGameRunning())
     {
         Application.Current.Dispatcher.Invoke(delegate
         {
             this.MemoryFunctions.GAME_Seatbelt(this.Seatbelt_ToggleSwitch.IsChecked);
         });
         return;
     }
     this.Seatbelt_ToggleSwitch.IsChecked = new bool?(false);
 }
예제 #25
0
 public long ToLong()
 {
     // Return the data a long
     if (Data != null)
     {
         return((long)MemoryFunctions.ByteArrayToUlong(Data, 0));
     }
     else
     {
         throw new Exception("Error. Argument is null and cannot be accessed.");
     }
 }
예제 #26
0
        private void DetectAssistMonsters()
        {
            Character        closestMonster = null;
            List <Character> fate           = new List <Character>();
            List <Character> players        = new List <Character>();
            List <Character> monsters       = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);
            monsters.AddRange(fate);

            if (chk_PVPMode.IsChecked == true)
            {
                monsters.AddRange(players);
            }


            //Garuda Helper
            foreach (Character monster in monsters)
            {
                if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() == "satin plume")
                {
                    monster.Target();
                    break;
                }
            }


            foreach (Character monster in monsters)
            {
                if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() != "spiny plume" && _user.TargetID == monster.ID)
                {
                    closestMonster = monster;
                    break;
                }
            }


            // Make sure we do not have any aggro...
            if (closestMonster == null)
            {
                return;
            }

            _currentmonster = closestMonster;

            _aiFighter.Reset();
            _botstage = BotStage.Fighting;

            // Start timer to see if we have run into a problem claiming the monster.
            _claimwatch = new Stopwatch();
            _claimwatch.Start();
        }
예제 #27
0
        public void Reparse(long address)
        {
            // Parse these arguments from a new address while assuming the basic structure hasn't changed. If
            // the structure has the possibility of changing, a new Arguments() class should be created instead.
            _address = address;

            // Read in all arguments in this block
            byte[] data = MemoryFunctions.ReadMemory(_process.ProcessDotNet, address, (uint)_size);
            for (int i = 0; i < _args.Count; i++)
            {
                _args[i].Reparse(data, _arg_offsets[i]);
            }
        }
예제 #28
0
        private void lst_SynthMode_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (lst_SynthMode.SelectedIndex == 1)
            {
                List <Character> monsters = new List <Character>();
                List <Character> fate     = new List <Character>();
                List <Character> players  = new List <Character>();
                Character        user     = null;
                MemoryFunctions.GetCharacters(monsters, fate, players, ref user);

                _craftingAI = new CraftingAI(user);
            }
        }
예제 #29
0
        private void btn_AddTarget_Click(object sender, RoutedEventArgs e)
        {
            List <Character> monsters = new List <Character>();
            List <Character> fate     = new List <Character>();
            List <Character> players  = new List <Character>();
            List <Character> npcs     = new List <Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);
            MemoryFunctions.GetNPCs(npcs);

            foreach (Character p in players)
            {
                if (p.Name.ToLower() == txt_TargetName.Text.ToLower())
                {
                    _targets.Add(p.Name);
                    RefreshTargetList();
                    return;
                }
            }


            foreach (Character p in npcs)
            {
                if (p.Name.ToLower() == txt_TargetName.Text.ToLower())
                {
                    _targets.Add(p.Name);
                    RefreshTargetList();
                    return;
                }
            }

            foreach (Character p in fate)
            {
                if (p.Name.ToLower() == txt_TargetName.Text.ToLower())
                {
                    _targets.Add(p.Name);
                    RefreshTargetList();
                    return;
                }
            }

            foreach (Character p in monsters)
            {
                if (p.Name.ToLower() == txt_TargetName.Text.ToLower())
                {
                    _targets.Add(p.Name);
                    RefreshTargetList();
                    return;
                }
            }
        }
예제 #30
0
        public string ToString(string overrideName)
        {
            if (Data == null)
            {
                return(string.Format("{2}{0} at {1}:\nnull", overrideName, this.GetLocation(), ""));
            }

            if (PointerTarget != null)
            {
                // Pass the request on to the pointed to Arguments struct
                return(string.Format("{4}{0} at {3}:\n{1}\n{2}", overrideName, MemoryFunctions.Hexlify(Data, 16, true), PointerTarget.ToString(), this.GetLocation(), ""));
            }
            return(string.Format("{3}{0} at {2}:\n{1}", overrideName, MemoryFunctions.Hexlify(Data, 16, true), this.GetLocation(), ""));
        }
예제 #31
0
 //────────────────────────────────────────
 /// <summary>
 /// コンストラクター。
 /// </summary>
 public MemoryApplicationImpl()
 {
     this.memoryBackup = new MemoryBackupImpl(this);
     this.memoryValidators = new MemoryValidatorsImpl(this);
     this.memoryTogethers = new MemoryTogethersImpl(this);
     this.memoryTables = new MemoryTablesImpl(this);
     this.memoryCodefiles = new MemoryCodefilesImpl(this);
     this.memoryFunctions = new MemoryFunctionsImpl(this);
     this.memoryVariables = new MemoryVariablesImpl(this);
     this.memoryForms = new MemoryFormsImpl(this);
     this.memoryStyles = new MemoryStylesImpl();
     this.memoryLogwriter = new MemoryLogwriterImpl();
     this.memoryBrushes = new MemoryBrushesImpl();
     this.memoryAatoolxml = new MemoryAatoolxmlImpl(this);
     this.memoryRecordset = new MemoryRecordsetImpl();
 }