Exemple #1
0
        public void Execute(Registers registers, Sections.DataSection dataSection)
        {
            switch (register)
            {
            case Register.EAX: { registers.EAX = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.ECX: { registers.ECX = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.EBP: { registers.EBP = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.EBX: { registers.EBX = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.EDI: { registers.EDI = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.EDX: { registers.EDX = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.ESI: { registers.ESI = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }

            case Register.ESP: { registers.ESP = Convert.ToInt32(dataSection.Variables[ModifiyValue.Address].Value); break; }
            }
        }
Exemple #2
0
 public void Execute(Registers registers, Sections.DataSection dataSection)
 {
     registers.EBP = registers.ESI;
 }
Exemple #3
0
 public void Execute(Registers registers, Sections.DataSection dataSection)
 {
     registers.ECX = registers.ECX;
 }
Exemple #4
0
 public void Execute(Registers registers, Sections.DataSection dataSection)
 {
     registers.ESI = ModifiyValue.Address;
 }
Exemple #5
0
        public void Execute(Registers registers, Sections.DataSection dataSection)
        {
            if (dataSection.Variables.ContainsKey(ModifiyValue.Address))
            {
                if (dataSection.Variables.ContainsKey(ModifiyValue.Address))
                {
                    Type type = dataSection.Variables[ModifiyValue.Address].GetType();
                    if (type == typeof(byte))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToByte(registers.EBX);
                    }
                    else if (type == typeof(short))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToInt16(registers.EBX);
                    }
                    else if (type == typeof(ushort))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToUInt16(registers.EBX);
                    }
                    else if (type == typeof(int))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToInt32(registers.EBX);
                    }
                    else if (type == typeof(uint))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToUInt32(registers.EBX);
                    }
                    else if (type == typeof(long))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToInt64(registers.EBX);
                    }
                    else if (type == typeof(ulong))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = Convert.ToUInt64(registers.EBX);
                    }
                    else if (type == typeof(IntPtr))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = new IntPtr(registers.EBX);
                    }
                    else if (type == typeof(UIntPtr))
                    {
                        dataSection.Variables[ModifiyValue.Address].Value = new UIntPtr(Convert.ToUInt32(registers.EBX));
                    }
                    else
                    {
                        throw new Exception("Variable type \"" + type + "\" not supported at " + ToString());
                    }
                    return;
                }

                try
                {
                    unsafe
                    {
                        switch (ModifiyValue.Size)
                        {
                        case 4:
                        {
                            *(int *)(ModifiyValue.Address) = registers.EBX;
                            break;
                        }

                        //x64

                        /*case 8:
                         * {
                         *  registers.RBX = *(long*)(ModifiyAddress.Address);
                         *  break;
                         * }*/
                        default:
                        {
                            throw new NotSupportedException(ToString());
                        }
                        }
                    }
                } catch { throw new Exception("\"" + ToString() + "\"Invalid memory address"); }
            }
        }
Exemple #6
0
 public void Execute(Registers registers, Sections.DataSection dataSection)
 {
     registers.EDI = registers.ESP;
 }
Exemple #7
0
 public void AddToStack(Registers registers, List <object> Stack, Sections.DataSection dataSection)
 {
     Stack.Add(this.Value);
 }