Posted January 5, 201312 yr 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
January 5, 201312 yr 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 January 5, 201312 yr by mArTi
January 5, 201312 yr 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 January 5, 201312 yr by Dumpper
Create an account or sign in to comment