Jun 13, 2015 02:15 AM
(This post was last modified: Jun 13, 2015 02:29 AM by Slavoj Žižek.)
Hey guys, The weather in the U.K. is super shitty so i decided to help some people out by writing a little example...
What is CodeDOM and why should i care?
CodeDOM is a super simple way of compiling .net code from within another .net application - you should care because if you want to make a Rat or a keylogger (etc) then this is how you (Should) do it...
I'm stuck can i PM you for some help?
🙃 Use this amazing creation called the internet...
What does it look like?
that's for you to look for, just dig through the source and you'll find the fun bits
here is a little GIF of my program
![[Image: 7tDRzPg.gif]](https://i.imgur.com/7tDRzPg.gif)
Where can i get the simple example you were talking about?
Here:
Code https://www.mediafire.com/?4o97mv4kkm6bf48
(The code is thoroughly commented!)
Hope you enjoy and understand a little bit more about CodeDOM! ✌
My gott, the Phallic Mother!
Probably the only postmodern neo-marxist who exists.
DO NOT DEAL WITH THIS MEMBER
wow
Quote:Imports System.CodeDom.Compiler 'This is needed for the actual compiler
Imports System.IO 'This is needed for the save file dialog
Public Class Form1
Dim Source As String = My.Resources.SourceCode 'This is just so we dont have to write out My.Resources.SourceCode every time we want to access the file (Optional, but a massive time saver!)
'I encorage you to check out My.Resources.SourceCode to see whats happening under the hood!
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sfd As New SaveFileDialog 'Just a simple SFD, we will change the options on the lines below
sfd.Filter = "Save Yo' Executable *.exe | *.exe" 'Changes the save file dialogs file filter to only save .exe files
sfd.Title = "Please select someware for the executable to be saved!" 'Changes the sfd's title (This is optional)
sfd.FileName = "CodeDOM_Executable.exe" 'Changes the sfd's default .exe name to whatever is entered (This is optional to!)
If sfd.ShowDialog = DialogResult.OK Then
Source = Source.Replace("//MSG//", TextBox1.Text) 'opens up the text file called code (Renamed to source) and replaces the string '//MSG//' with whatever is in textbox1
Compile(sfd.FileName, Source) 'Runs the compile Sub using the source.
MsgBox("The file has been compiled and saved to" + vbNewLine _
+ sfd.FileName, vbInformation, "Saved!") 'This just tells the user that the file is compiled then tells them the save location
End If
End Sub
Public Sub Compile(ByVal Output As String, ByVal Source As String)
'CodeDOM compiler by Pr3fix
'Looks pretty compicated, right?
'You may look through it but if you change something it might not work...
On Error Resume Next
Dim Compiler As ICodeCompiler = (New VBCodeProvider).CreateCompiler() ' This might give a warning because it is pretty outdated... It will still work fine tho
Dim Parameters As New CompilerParameters()
Dim cResults As CompilerResults
Parameters.GenerateExecutable = True
Parameters.OutputAssembly = Output
Parameters.ReferencedAssemblies.Add("System.dll")
Parameters.ReferencedAssemblies.Add("System.Data.dll")
Parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
Dim Version = New Dictionary(Of String, String)
Version.Add("CompilerVersion", "v2.0")
Dim ICO As String = IO.Path.GetTempPath & "\iCompiler.ico"
cResults = Compiler.CompileAssemblyFromSource(Parameters, Source)
If cResults.Errors.Count > 0 Then
For Each CompilerError In cResults.Errors
MessageBox.Show("Error: " & CompilerError.ErrorText, "", MessageBoxButtons.OK, MessageBoxIcon.Error)
Next
ElseIf cResults.Errors.Count = 0 Then
End If
End Sub
End Class
why is there "on error resume"
and you said:
Quote:(The code is thoroughly commented!)
it looks like you only commented the obvious stuff.
Quote:Imports System, Microsoft.VisualBasic, System.IO
Imports System.Security.Cryptography
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Reflection
Imports System.Text
Imports System.Security 'Some of these are needed some are not (I cannot remember :P)
Module Module1
'This works alot like a console Program...
Sub Main()
'This is the sub that is executed when the program is run
MsgBox("//MSG//")
'This might be simple now, but the sky is the limit with CodeDOM...
'Whenever you want to change a string just to the string.replace thing in form1.vb - Its simple as 12345678910! :D
End Sub
End Module
"this works alot like a console program"
mmm, maybe because it is?
oh. and ... code, for ppl that dont want to download.
The problem with codedom its getting fast detected by AV.
(Jun 13, 2015 08:53 AM)denn1s Wrote: The problem with codedom its getting fast detected by AV.
that is not true, when i start using codedom method i said like you , but you can make it (0/34) , analyze each part of your code any try to find which line make your program detected , obfuscation your code and encrypt all string ,add junk codes (variable,classes,function..etc)>>>
you think codedom is for making only console applications only ,but you are wrong , you can add forms ,timers ,buttons , any thing you want :D
hint: "add form" in codedom
Code Public Class EntryPoint
Public Shared Sub Main(args As [String]())
Dim form1 As New Form1
System.Windows.Forms.Application.Run(form)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
Private WithEvents Button1 As New Button 'if you want to add button
Sub New() ' change setting as u want
Application.EnableVisualStyles()
Me.Text = "Form1"
Me.Opacity = 100
Me.Visible = True
Me.ShowInTaskbar = False
Button1.Text = "Click Me!"
Button1.Top = 100
Button1.Left = 100
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' put ur code in form loading
End Sub
Ensd Class
HQ user, HQ post. This will certainly help any user that wants to learn codedom!
The only suggestion I have is: the console box that pops up may seem suspicious to any user who runs the program (key logger etc).
Explaining how to compile a form so that that console window doesn't show up would be beneficial for anyone who's end goal is to build a key logger or rat!
(Jun 13, 2015 07:57 AM)nathan72389 Wrote: wow
why is there "on error resume"
and you said:
it looks like you only commented the obvious stuff.
"this works alot like a console program"
mmm, maybe because it is?
oh. and ... code, for ppl that dont want to download.
There are some helpful things that some people want to know, i know that the code is really broken but you don't have to rip it to shreds...
My gott, the Phallic Mother!
Probably the only postmodern neo-marxist who exists.
pretty easy to understand, thank you, bro.
(Jun 15, 2015 01:01 AM)Generals Wrote: pretty easy to understand, thank you, bro.
No prob bro, happy to help :D
My gott, the Phallic Mother!
Probably the only postmodern neo-marxist who exists.
Jun 15, 2015 10:56 AM
(This post was last modified: Jun 16, 2015 01:08 AM by ShittyAdvice.)
Created a simple small class for this(I'm still new, just thought this could be usefull for some people)
Any feedback or tips is welcome :)
http://pastebin.com/71RYTecA
Usage:
Code 'Create an instance of the class
Dim Compiler As CodeDOM = New CodeDOM()
'Add References
Compiler.AddReference("System.dll", "System.Data.dll", "System.Windows.Forms.dll")
'Set a version
Compiler.Version.Add("CompilerVersion", "v2.0")
'Actually compile
Compiler.Compile(sfd.FileName, Source) 'sfd is a SaveFileDialog, Source is the source as a string
(Jun 15, 2015 10:56 AM)ShittyAdvice Wrote: Created a simple small class for this(I'm still new, just thought this could be usefull for some people)
Any feedback or tips is welcome :)
http://pastebin.com/71RYTecA
Usage:
Code 'Create an instance of the class
Dim Compiler As CodeDOM = New CodeDOM()
'Add References
Compiler.AddReference("System.dll", "System.Data.dll", "System.Windows.Forms.dll")
'Set a version
Compiler.Version.Add("CompilerVersion", "v2.0")
'Actually compile
Compiler.Compile(sfd.FileName, Source) 'sfd is a SaveFileDialog, Source is the source as a string
Wow, thanks this will help 🤝
My gott, the Phallic Mother!
Probably the only postmodern neo-marxist who exists.
Jun 16, 2015 12:55 PM
(This post was last modified: Jun 16, 2015 12:56 PM by ShittyAdvice.)
(Jun 16, 2015 10:05 AM)Slavoj Žižek Wrote: Wow, thanks this will help 🤝
I did an update, new usage:
Code Compiler.AddReference("System.dll", "System.Data.dll", "System.Windows.Forms.dll")
Compiler.Version.Add("CompilerVersion", "v2.0")
Compiler.NewSaveLocation() 'Gives a dialog to select a file location
Compiler.Compile(Source) 'Runs the compile Sub using the source{string}.
Compiler.Run() 'Runs the newly compiled file!
DO NOT DEAL WITH THIS MEMBER
Very nice share OP. 🤗
And for other contributors to improving the code, defiantly useful functions for many various applications.
If I was ever going to mess with codedom, which I most likely wont, I would use Pat's wrapper.
https://gist.github.com/PatPositron/ab53...c3b82f3c9a
Jun 17, 2015 01:00 AM
(This post was last modified: Jun 17, 2015 01:01 AM by ShittyAdvice.)
(Jun 16, 2015 05:30 PM)SIM-1676753 Wrote: If I was ever going to mess with codedom, which I most likely wont, I would use Pat's wrapper.
https://gist.github.com/PatPositron/ab53...c3b82f3c9a
I think this thread was mainly for information & learning purposes.
Atleast for me it was
Also, that wrapper is C#, this is VB
|