Exemplo n.º 1
0
        public static byte[] GetExitMethod(EExitFunc method, EPlatform platform, EArquitecture arq)
        {
            switch (platform)
            {
                case EPlatform.Windows:
                    {
                        switch (arq)
                        {
                            case EArquitecture.x86:
                                {
                                    string function = "";

                                    switch (method)
                                    {
                                        case EExitFunc.Process: function = "ExitProcess"; break;
                                        case EExitFunc.Thread: function = "ExitThread"; break;
                                        default: return null;
                                    }
                                    /*
                                        ;; eax = GetProcAddress(ebx, "ExitProcess")
                                        push edi
                                        push 01737365h
                                        dec byte ptr [esp + 3h]
                                        push 'corP'
                                        push 'tixE'
                                        push esp
                                        push ebx
                                        call esi
                                     */
                                    byte[] shell1 = AsmHelper.StringToAsmX86(function);
                                    //0x68,0x50,0x72,0x6f,0x63,0x68,0x45,0x78, 0x69,0x74,
                                    /*
                                     ;; ExitProcess(NULL);
                                    push edi
                                    call eax
                                     */
                                    byte[] shell2 = new byte[]
                                    {
                                        0x54,0x53,0xff,0xd6,0x57,0xff,0xd0
                                    };

                                    return shell1.Concat(shell2);
                                }
                        }

                        break;
                    }
            }


            return null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="platform">Platform</param>
        /// <param name="variables">Variables</param>
        public Target(EPlatform platform, string name, params Variable[] variables)
            : this()
        {
            Name = name;
            Platform = platform;

            if (variables == null) return;

            foreach (Variable v in variables)
            {
                if (!_Variables.ContainsKey(v.Name))
                    _Variables.Add(v.Name, v.Value);
                else
                    _Variables[v.Name] = v.Value;
            }
        }
Exemplo n.º 3
0
 Includes(
     this EPlatform platform,
     EPlatform choice)
 {
     return (0 != (platform & choice));
 }
Exemplo n.º 4
0
        ToString(
            EPlatform platformFlags,
            char separator,
            string prefix,
            bool toUpper)
        {
            string platformString = null;

            // check windows and sub-derivatives
            if (Contains(platformFlags, EPlatform.Windows))
            {
                AddPlatformName(ref platformString, "Windows", separator, prefix, toUpper);
            }
            else
            {
                if (Contains(platformFlags, EPlatform.Win32))
                {
                    AddPlatformName(ref platformString, "Win32", separator, prefix, toUpper);
                }
                else if (Contains(platformFlags, EPlatform.Win64))
                {
                    AddPlatformName(ref platformString, "Win64", separator, prefix, toUpper);
                }
            }

            // check linux and sub-derivatives
            if (Contains(platformFlags, EPlatform.Linux))
            {
                AddPlatformName(ref platformString, "Linux", separator, prefix, toUpper);
            }
            else
            {
                if (Contains(platformFlags, EPlatform.Linux32))
                {
                    AddPlatformName(ref platformString, "Linux32", separator, prefix, toUpper);
                }
                else if (Contains(platformFlags, EPlatform.Linux64))
                {
                    AddPlatformName(ref platformString, "Linux64", separator, prefix, toUpper);
                }
            }

            // check OSX and sub-derivatives
            if (Contains(platformFlags, EPlatform.OSX))
            {
                AddPlatformName(ref platformString, "OSX", separator, prefix, toUpper);
            }
            else
            {
                if (Contains(platformFlags, EPlatform.OSX32))
                {
                    AddPlatformName(ref platformString, "OSX32", separator, prefix, toUpper);
                }
                else if (Contains(platformFlags, EPlatform.OSX64))
                {
                    AddPlatformName(ref platformString, "OSX64", separator, prefix, toUpper);
                }
            }

            return platformString;
        }
Exemplo n.º 5
0
 Contains(
     EPlatform flags,
     EPlatform specificPlatform)
 {
     var contains = (specificPlatform == (flags & specificPlatform));
     return contains;
 }
Exemplo n.º 6
0
 ToString(
     EPlatform platformFlags,
     char separator)
 {
     var value = ToString(platformFlags, separator, null, false);
     return value;
 }
Exemplo n.º 7
0
 ToString(
     EPlatform platformFlags)
 {
     var value = ToString(platformFlags, '\0', null, false);
     return value;
 }
 /// <summary>
 /// Initializes a new attribute.
 /// </summary>
 /// <param name="platform">The platform(s) for which the module can be built.</param>
 public PlatformFilterAttribute(
     EPlatform platform)
 {
     this.Platform = platform;
 }
 Includes(
     EPlatform other)
 {
     return (other == (this.Platform & other));
 }
Exemplo n.º 10
0
 IsCurrentPlatformSupported(
     EPlatform supportedPlatforms)
 {
     var isSupported = (CurrentPlatform == (supportedPlatforms & CurrentPlatform));
     return isSupported;
 }
Exemplo n.º 11
0
 Is64Bit(
     EPlatform platform)
 {
     var is64Bit = (EPlatform.Win64 == platform || EPlatform.Linux64 == platform || EPlatform.OSX64 == platform);
     return is64Bit;
 }
Exemplo n.º 12
0
 IsOSX(
     EPlatform platform)
 {
     var isOSX = (EPlatform.OSX32 == platform || EPlatform.OSX64 == platform);
     return isOSX;
 }
Exemplo n.º 13
0
 IsLinux(
     EPlatform platform)
 {
     var isLinux = (EPlatform.Linux32 == platform || EPlatform.Linux64 == platform);
     return isLinux;
 }
Exemplo n.º 14
0
 IsWindows(
     EPlatform platform)
 {
     var isWindows = (EPlatform.Win32 == platform || EPlatform.Win64 == platform);
     return isWindows;
 }