Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Save Assembly to File

Featured Replies

Posted

Hi,

 

At this time i have success load byte array contain assembly to application, Below sample script:

 

//1. Load raw assembly from byte array

  Assembly SampleAssembly = Assembly.Load(byte_arr_assembly);

 

//2. Launch Form Inside Assembley, Success

 

if (SampleAssembly != null)
            {
                
                Type[] types = SampleAssembly.GetTypes();                foreach (Type type in types)
                {
                    MethodInfo[] methodInfos = type.GetMethods(BindingFlags.Public | BindingFlags.Static);                    foreach (MethodInfo mf in methodInfos)
                    {
                        if (mf.Name == "Invoke")
                        {
                            type.InvokeMember("Invoke", BindingFlags.InvokeMethod, null, null, new object[0]);
                            break;
                        }
                    }
               
                }
            }

 

My Question: How i can save those assembly to file, so i can run it,

 

Regards,

B.C

 

I didn't exactly understand the question.


If uou want to dump an assembly from your program, then just insert File.WriteAllBytes(@"C:\myfile.exe", byte_arr_assembly).


If you want to make the assembly to load, then just create a DLL then copy its bytes.


If it's not your program and you want to dump, you can insert File.WriteAllBytes(@"C:\myfile.exe", byte_arr_assembly), use WinDBG with SOS or use Reflector VSPro in VS. There's nothing easier ;)


 


EDIT: btw, why every types/methods are checked ? you should better use GetType("MyType") and GetMethod("MyMethod") ?


Edited by mArTi

  • Author

Hello mArTi,


 


Tq for attention, finally success directly write byte array to file as your advice,


 


"btw, why every types/methods are checked ? you should better use GetType("MyType") and GetMethod("MyMethod") ?"


 


Actually i don't know assembly inside byte array coz obfuscated, so i use those methode, 


Edited by Dumpper

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.