Hey VB community, doesn't it piss you off when you spend several hours on a 10,000-line project and some 10-year-old "programmer" disassembles your masterpiece, stealing your code?
Don't worry, Mr. Laugh Out Loud Land is here!
Protecting your work and your code is extremely important when releasing a program, because you never want to see your hard work be stolen, do you?
To do this there are several methods of protection, but we'll be focusing on one today: Obfuscating.
What is Obfuscation?
Obfuscation dates back to the Roman era, where Roman soldiers would use different encryptions and codes to send messages safely with messengers, between different people and troops, in exemplar:
The troops arrive at midnight.
May turn into:
The chicken laid four golden eggs.
When it comes to software, obfuscation is used essentially the same way.
Obfuscating software is essentially decompiling, scrambling source code into random letters and number sequences (A.K.A. encryption), and recompiling of the software, making the product close to (if not) impossible to understand.
Why would this be important? Well here's an example of my source code for a project I disassembled with Red Gate's .NET Reflector:
Code:
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
Me.Label1.Text = Conversions.ToString(CDbl((Conversions.ToDouble(Me .Label1.Text) + 1)))
Interaction.Shell("NET START DHCP", AppWinStyle.Hide, False, -1)
If (Me.Label1.Text = Me.TextBox1.Text) Then
Interaction.Shell("NET STOP DHCP", AppWinStyle.Hide, False, -1)
Me.Label1.Text = Conversions.ToString(0)
Me.Timer1.Stop
End If
End Sub
This is my exact original coding.
But after I obfuscated it with Dotfuscator Gold...
Code:
<GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.Se ttingsSingleFileGenerator", "9.0.0.0"), EditorBrowsable(EditorBrowsableState.Advanced), CompilerGenerated> _
Friend NotInheritable Class A
Inherits ApplicationSettingsBase
' Methods
Shared Sub New()
<DebuggerNonUserCode> _
Public Sub New()
Public Shared Function A() As A
<EditorBrowsable(EditorBrowsableState.Advanced), DebuggerNonUserCode> _
Private Shared Sub A(ByVal A_0 As Object, ByVal A_1 As EventArgs)
' Fields
Private Shared A As A
Private Shared A As Boolean
Private Shared A As Object
End Class
<DesignerGenerated> _
Public Class B
Inherits Form
' Methods
<DebuggerNonUserCode> _
Shared Sub New()
<DebuggerNonUserCode> _
Public Sub New()
<DebuggerStepThrough> _
Private Sub A()
<DebuggerNonUserCode> _
Friend Overridable Function A() As Button
<DebuggerNonUserCode> _
Friend Overridable Function A() As Label
<DebuggerNonUserCode> _
Friend Overridable Function A() As TextBox
<DebuggerNonUserCode> _
Friend Overridable Function A() As Timer
<DebuggerNonUserCode> _
Protected Overrides Sub A(ByVal A_0 As Boolean) Implements Form.Dispose
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
Friend Overridable Sub A(ByVal A_0 As Button)
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
Friend Overridable Sub A(ByVal A_0 As Label)
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
Friend Overridable Sub A(ByVal A_0 As TextBox)
<MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode> _
Friend Overridable Sub A(ByVal A_0 As Timer)
Private Sub A(ByVal A_0 As Object, ByVal A_1 As EventArgs)
Private Sub B(ByVal A_0 As Object, ByVal A_1 As EventArgs)
' Fields
Private Shared A As List(Of WeakReference)
Private A As IContainer
Private A As Button
Private A As Label
Private A As TextBox
Private A As Timer
End Class
<StandardModule, HideModuleName, DebuggerNonUserCode, GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilde r", "2.0.0.0"), CompilerGenerated> _
Friend NotInheritable Class C
' Methods
Friend Shared Function A() As CultureInfo
Friend Shared Function A() As ResourceManager
Friend Shared Sub A(ByVal A_0 As CultureInfo)
' Fields
Private Shared A As CultureInfo
Private Shared A As ResourceManager
End Class
<GeneratedCode("MyTemplate", "8.0.0.0"), StandardModule, HideModuleName> _
Friend NotInheritable Class D
' Methods
<DebuggerNonUserCode> _
Shared Sub New()
<DebuggerHidden> _
Friend Shared Function A() As B
<DebuggerHidden> _
Friend Shared Function A() As C
<DebuggerHidden> _
Friend Shared Function A() As E
<DebuggerHidden> _
Friend Shared Function A() As F
<DebuggerHidden> _
Friend Shared Function A() As User
' Fields
Private Shared ReadOnly A As A(Of B)
Private Shared A As A(Of C)
Private Shared ReadOnly A As A(Of E)
Private Shared ReadOnly A As A(Of F)
Private Shared ReadOnly A As A(Of User)
' Nested Types
<ComVisible(False), EditorBrowsable(EditorBrowsableState.Never)> _
Friend NotInheritable Class A(Of A As New)
' Methods
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Never)> _
Public Sub New()
<DebuggerHidden> _
Friend Function A() As A
' Fields
<ThreadStatic, CompilerGenerated> _
Private Shared A As A
End Class
<EditorBrowsable(EditorBrowsableState.Never), MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtoc ol", "Create__Instance__", "Dispose__Instance__", "")> _
Friend NotInheritable Class B
' Methods
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Never)> _
Public Sub New()
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A() As Integer Implements Object.GetHashCode
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A() As String Implements Object.ToString
<EditorBrowsable(EditorBrowsableState.Never), DebuggerHidden> _
Friend Function A() As Type
<DebuggerHidden> _
Private Shared Function A(Of A As New)(ByVal A_0 As A) As A
<DebuggerHidden> _
Private Sub A(Of A)(ByRef A_0 As A)
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A(ByVal A_0 As Object) As Boolean Implements Object.Equals
End Class
<EditorBrowsable(EditorBrowsableState.Never), MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")> _
Friend NotInheritable Class C
' Methods
<EditorBrowsable(EditorBrowsableState.Never), DebuggerHidden> _
Public Sub New()
<DebuggerNonUserCode> _
Public Function A() As B
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A() As Integer Implements Object.GetHashCode
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A() As String Implements Object.ToString
<EditorBrowsable(EditorBrowsableState.Never)> _
Friend Function A() As Type
<DebuggerHidden> _
Private Sub A(Of A As Form)(ByRef A_0 As A)
<DebuggerNonUserCode> _
Public Sub A(ByVal A_0 As B)
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Overrides Function A(ByVal A_0 As Object) As Boolean Implements Object.Equals
<DebuggerHidden> _
Private Shared Function A(Of A As { Form, New })(ByVal A_0 As A) As A
' Fields
Public A As B
<ThreadStatic> _
Private Shared A As Hashtable
End Class
End Class
<AttributeUsage(AttributeTargets.Assembly)> _
Public NotInheritable Class DotfuscatorAttribute
Inherits Attribute
' Methods
Public Sub New(ByVal a As String, ByVal c As Integer, ByVal b As Boolean)
' Properties
Public ReadOnly Property A As String
Public ReadOnly Property B As Boolean
Public ReadOnly Property C As Integer
' Fields
Private a As String
Private b As Boolean
Private c As Integer
End Class
<GeneratedCode("MyTemplate", "8.0.0.0"), EditorBrowsable(EditorBrowsableState.Never)> _
Friend Class E
Inherits Computer
' Methods
<EditorBrowsable(EditorBrowsableState.Never), DebuggerHidden> _
Public Sub New()
End Class
<GeneratedCode("MyTemplate", "8.0.0.0"), EditorBrowsable(EditorBrowsableState.Never)> _
Friend Class F
Inherits WindowsFormsApplicationBase
' Methods
<DebuggerNonUserCode> _
Shared Sub New()
<DebuggerStepThrough> _
Public Sub New()
<DebuggerStepThrough> _
Protected Overrides Sub A() Implements WindowsFormsApplicationBase.OnCreateMainForm
<DebuggerHidden, EditorBrowsable(EditorBrowsableState.Advanced), STAThread> _
Friend Shared Sub A(ByVal A_0 As String())
' Fields
Private Shared A As List(Of WeakReference)
End Class
<EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode, CompilerGenerated> _
Friend NotInheritable Class G
' Methods
<EditorBrowsable(EditorBrowsableState.Never)> _
Private Sub New()
Public Shared Function A(ByVal A_0 As IEnumerable(Of XElement)) As String
Public Shared Sub A(ByVal A_0 As IEnumerable(Of XElement), ByVal A_1 As String)
Public Shared Function A(ByVal A_0 As IEnumerable(Of XElement), ByVal A_1 As XName) As String
Public Shared Function A(ByVal A_0 As XElement, ByVal A_1 As XName) As String
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Shared Function A(ByVal A_0 As XName, ByVal A_1 As Object) As XAttribute
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Shared Function A(ByVal A_0 As XName, ByVal A_1 As XNamespace) As XAttribute
Public Shared Sub A(ByVal A_0 As IEnumerable(Of XElement), ByVal A_1 As XName, ByVal A_2 As String)
Public Shared Sub A(ByVal A_0 As XElement, ByVal A_1 As XName, ByVal A_2 As String)
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Shared Function A(ByVal A_0 As String(), ByVal A_1 As XNamespace(), ByVal A_2 As List(Of XAttribute), ByVal A_3 As IEnumerable) As IEnumerable
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Shared Function A(ByVal A_0 As String(), ByVal A_1 As XNamespace(), ByVal A_2 As List(Of XAttribute), ByVal A_3 As Object) As Object
<EditorBrowsable(EditorBrowsableState.Never)> _
Public Shared Function A(ByVal A_0 As String(), ByVal A_1 As XNamespace(), ByVal A_2 As List(Of XAttribute), ByVal A_3 As XElement) As XElement
' Nested Types
<CompilerGenerated, DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)> _
Private NotInheritable Class A
' Methods
<EditorBrowsable(EditorBrowsableState.Never)> _
Friend Sub New(ByVal A_0 As String(), ByVal A_1 As XNamespace(), ByVal A_2 As List(Of XAttribute))
<EditorBrowsable(EditorBrowsableState.Never)> _
Friend Function A(ByVal A_0 As Object) As Object
<EditorBrowsable(EditorBrowsableState.Never)> _
Friend Function A(ByVal A_0 As XElement) As XElement
' Fields
Private ReadOnly A As String()
Private ReadOnly A As XNamespace()
Private ReadOnly A As List(Of XAttribute)
End Class
End Class
<CompilerGenerated, HideModuleName, DebuggerNonUserCode, StandardModule> _
Friend NotInheritable Class H
' Methods
Friend Shared Function A() As A
End Class
Collapse Types
I got that.
Now do you see what obfuscation can do?
What are some good Obfuscators?
My favorite as I started with obfuscation (not too long ago) was
Skater's .NET Obfuscator lite. It's a good free program for those wanting basic protection for their work, something small in size (2.36 MB), and completely free.
One that I haven't tried yet (but heard good things about) is
Eazfuscator.NET. It apparently offers fairly advanced protection for your work as well, and is also free.
My very favorite, however, is
Preemptive Solution's Dotfuscator. Although this product is not free, there's a download link at the bottom. This offers amazing protection for your software (seen above), with customizable settings, such as watermarks, renaming, removing, string encryption, etc. I highly recommend this product for anyone wanting extreme protection.
How do I obfuscate my program?
Obfuscating is very simple, with most products at least. For this tutorial, I'll show you how to obfuscate with the three products I listed above.
*Sorry for being kinda... slow in the videos, I'm writing this tutorial after a long day
Dotfuscator:
Skater Lite:
Eazfuscator:
What have I learned?
Hopefully by reading this tutorial you've learned a thing or two about protecting your work with obfuscation and obfuscators.
-You've learned what obfuscating is.
-You've learned some basic history of obfuscation.
-You've learned how to keep your software safe from crackers, decompilers, and noobs.
-You've learned how to use three different obfuscators.
-You've learned what I can accomplish in an hour.
Nextgen, put this in your signature, it's safe there.
Thanks for reading my little tutorial.
Download for Dotfuscator:
Code:
http:// ezlink. info /10Y
NextGen1 Edit : Link Approved (remove spaces)
I've used it: it's clean. File size is too big to scan using VirScan or Virustotal, but I assure you it's clean.
Credits:
Coder Never: Because he wants credit.