![]() |
|
[.NET] Creating a builder for .NET [3 WAYS] - 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: [.NET] Creating a builder for .NET [3 WAYS] (/showthread.php?tid=4296725) Pages: Pages
1
2
|
Creating a builder for .NET [3 WAYS] - LordCoder - Jun 20, 2014 Hello, As I see some people are confused creating a builder for stub files I decided to create a complete tutorial. If you don't know what does builder or stub mean let me show you an example. You have an application that shows a message. That message can be anything. The user who creates the application needs to set a custom message as he's trying to do, for example, an application saying "Hello". There are 3 ways (I think there aren't any other). The first one is using Mono.Cecil, an open source library to edit already compiled assemblies for .NET. It will edit us whatever we want inside the application using MSIL. The problem is to know how to use it (so this method could be more advanced if you are not into reversing). The second method is using a part from the compiled .EXE and then get it. The options should be inside the application and you can't change the code. That's useful if you're going to make similar stubs and not very customized. The last method is using a stub code and edit it as we want. Then compile it using some classes from .NET. This might be a good method if you're planning to do an easy application without many classes or references (as you will have it on a .txt file basically). 1st way: Mono.Cecil Download Mono.Cecil.dll (already compiled for you). I'm not going to show the basic of Mono.Cecil as there are a lot of tutorials about Mono.Cecil (or remember Google is your friend always). Creating a basic "MsgBox Creator" application -Create 2 projects: Builder and Stub. -Add Mono.Cecil to your project. On the Stub you should use, for example, a ConsoleApplication. On MainModule1 put: Code Function GetMessage() as StringNow save it to "YourBuilderProject\bin\debug\stub_compiled.exe" and add this to the Builder: Code Sub Compile(ByVal message As String)Finally run "Builder" and call "Compile" sub with any message. It will save "stub_edited.exe" with your new message. 2nd way: Editing options from an EXE This method doesn't require any extra library. I know my code is very old and I can use IO functions but I like it. I'm not going to make this thread more long to explain how does it work, it just works. Creating a basic "MsgBox Creator" application As we did with the Mono.Cecil example, create both projects "Stub" and "Builder". The stub can be a ConsoleApplication like before with this method: Code Sub Main()Compile it and do the same (copy the file to bin\debug as "stub_compiled.exe"). Then add this code: Code Sub Compile(message as String)Remember that "WHATEVERHEREWITHOUTSPACES" should be the same for builder and stub and without spaces. 3rd way: Compiling a new assembly You'll need System.Reflection namespaces so add them with Imports. Creating a basic "MsgBox Creator" application The trick to do this is editing the stub but as a text file. So let's say we have this: Code Module MainModule1We'll have to edit the stub to: Code mystubsaved.Replace("WHATTOSAY", "Hey this is the new message")And then compile it: Code Public Sub CompileCode(ByVal is_vb As Boolean, sourceFile As String, _That's all! I didn't explain everything step by step as I suppose you know about VB.NET. Any comments are welcomed (I expect the bad ones too, please be bad with me because I can learn from those comments :D). * - Nutrition - Jun 20, 2014 This is actually really helpful and informational! * - bfizzy - Jun 20, 2014 I am getting this error with the first method. anything wrong from my side? My Code: ![]() ![]() Error:
* - SIM-1456245 - Jun 20, 2014 This is one heck of an impressive tutorial. Well done. * - LordCoder - Jun 20, 2014 (Jun 20, 2014 05:30 PM)bfizzy Wrote: I am getting this error with the first method.The function that returns the message should return a string, not an integer. * - bfizzy - Jun 21, 2014 (Jun 20, 2014 11:43 PM)★ ℓσя∂¢σ∂єя ★ Wrote: The function that returns the message should return a string, not an integer. ohh, what a mistake I will try it out as I get home. * - TheBarret - Jun 21, 2014 (Jun 21, 2014 04:51 AM)bfizzy Wrote: ohh, what a mistake If you don't know that, why the heck are even trying to make this. So much fail. * - Proton! - Sep 21, 2014 Good tutorial, is the second one compatible with crypters? * - LordCoder - Sep 21, 2014 (Sep 21, 2014 04:48 AM)Professor Proton Wrote: Good tutorial, is the second one compatible with crypters? Yes, but only if you use it properly. * - BahNahNah - Sep 8, 2015 There is also EOF (not recommended), and updating a native resource containing the settings on a compiled assembly. * - LordCoder - Sep 8, 2015 (Sep 8, 2015 04:49 AM)BahNahNah Wrote: There is also EOF (not recommended), and updating a native resource containing the settings on a compiled assembly. I wrote this a year ago 🤣 * - SIM-1676753 - Sep 8, 2015 I use native methods such as 'LockResource' and 'LoadResource'. Simple and easy. * - ShittyAdvice - Sep 9, 2015 (Sep 8, 2015 04:49 AM)BahNahNah Wrote: There is also EOF (not recommended), and updating a native resource containing the settings on a compiled assembly. Any specific reasons why it's not recommended? Also what would be the "best" way be and why? * - Reverse_Engineer - Sep 10, 2015 Good tutorial , Thanks for sharing this * - Cecilia - Sep 10, 2015 Your first method isn't too great, it can be improved. GetTypes() gets all types in the module, including nested. |