mrtifa13 Posted July 29, 2015 Posted July 29, 2015 Hello eveyone , i was coding an obfuscator , everything is working good , but when i start to deobfuscate , it says value does not fall within the expected range , can someone help me please , here is the code Private Sub DesignButton8_Click(sender As Object, e As EventArgs) Handles DesignButton8.Click Try Dim S As New SaveFileDialog S.Filter = "|*.exe" If S.ShowDialog = vbOK Then If Protectpart2() = True Then ASM.Write(S.FileName) MsgBox("Sucessfully Obfuscated at: " & vbCrLf & S.FileName, MsgBoxStyle.Information) Else Exit Sub End If End If Catch ex As Exception End Try End Sub Public Function Protectpart2() As Boolean Dim FilePath As String = "" Try ASM = AssemblyDefinition.ReadAssembly(FilePath) ASM.MainModule.Attributes = ModuleAttributes.Required32Bit Dim definition As TypeDefinition For Each definition In ASM.MainModule.Types If (definition.Name <> "<Module>") Then Me.RenameTypesMethodsFields(definition, True, True, True) Dim i As Integer For i = 0 To 750 - 1 Dim item As New MethodDefinition(Me.SingleCharRename, (MethodAttributes.ReuseSlot Or MethodAttributes.Private), ASM.MainModule.Import(Type.GetType("System.Void"))) definition.Methods.Add(item) item.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, CByte(&H2C))) item.Body.Instructions.Add(Instruction.Create(OpCodes.Nop)) List.Items.Add(item) Next i End If Next Dim definition3 As TypeDefinition For Each definition3 In ASM.MainModule.Types If (definition3.Namespace <> "") Then Dim newValue As String = Me.SingleCharRename Dim resource As Resource For Each resource In ASM.MainModule.Resources resource.Name = resource.Name.Replace(definition3.Namespace, newValue) Next definition3.Namespace = newValue End If Next Catch exception As Exception MessageBox.Show(exception.Message) Return False End Try Return True End Function
GIV Posted July 30, 2015 Posted July 30, 2015 Try to look here: http://stackoverflow.com/questions/10284992/value-does-not-fall-within-the-expected-rangeOr here: https://digitaltoolfactory.net/blog/2009/10/how-to-fix-value-does-not-fall-within-the-expected-range-error-in-silverlight/Or here: http://stackoverflow.com/questions/22509258/value-does-not-fall-within-the-expected-range-in-asynchronous-functionetc...Just google.Or debug and see what line of code trow the error.
n0th!ng Posted July 30, 2015 Posted July 30, 2015 (edited) check your code more carefully and debug ithere is the problem : Dim FilePath As String = ""you've passed an empty path to "ReadAssembly" Edited July 30, 2015 by n0th!ng 1
mrtifa13 Posted July 30, 2015 Author Posted July 30, 2015 check your code more carefully and debug it here is the problem : Dim FilePath As String = "" you've passed an empty path to "ReadAssembly" well , how can i fix it , sorry for my lazy brain im just new on vb.net
GIV Posted July 30, 2015 Posted July 30, 2015 (edited) How on earth you code a obfuscator if you don't know basic coding....???? Replace: Dim FilePath As String = ""With: Dim result As DialogResult = OpenFileDialog1.ShowDialog() If result = Windows.Forms.DialogResult.OK Then Dim FilePath As String = OpenFileDialog1.FileName.ToString EndIfThis is when you execute trough a button. Inside your bolean function you can:1. Make fixed file path value: Dim FilePath As String = "c:\assembly.exe"or before passing the arguments to function just open the dialog and pass the result to a variable withch is later imported to your boolean variable. Public Function Protectpart2( byval mypath as string) As Boolean Dim FilePath As String = mypath Edited July 30, 2015 by GIV 1
mrtifa13 Posted July 30, 2015 Author Posted July 30, 2015 How on earth you code a obfuscator if you don't know basic coding....???? Replace:Dim FilePath As String = ""With:Dim result As DialogResult = OpenFileDialog1.ShowDialog()If result = Windows.Forms.DialogResult.OK ThenDim FilePath As String = OpenFileDialog1.FileName.ToStringEndIfThis is when you execute trough a button. Inside your bolean function you can:1. Make fixed file path value:Dim FilePath As String = "c:\assembly.exe"or before passing the arguments to function just open the dialog and pass the result to a variable withch is later imported to your boolean variable.Public Function Protectpart2( byval mypath as string) As BooleanDim FilePath As String = mypathlike this u mean? Private Sub DesignButton8_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DesignButton8.Click Try Dim File1 As New OpenFileDialog Dim FilePath As String = File1.FileName.ToString Dim result As DialogResult = File1.ShowDialog() If result = Windows.Forms.DialogResult.OK Then File1.FileName.ToString() End If Dim S As New SaveFileDialog S.Filter = "|*.exe" If S.ShowDialog = vbOK Then If Protectpart2() = True Then ASM.Write(S.FileName) ASM.Write(SavePath) MsgBox("Sucessfully Obfuscated at: " & vbCrLf & S.FileName, MsgBoxStyle.Information) Else Exit Sub End If End If Catch ex As Exception End Try End Sub Public Function Protectpart2() As Boolean Dim FilePath As String = "c:\...\...\desktop\" Try ASM = AssemblyDefinition.ReadAssembly(FilePath) ASM.MainModule.Attributes = ModuleAttributes.Required32Bit Dim definition As TypeDefinition For Each definition In ASM.MainModule.Types If (definition.Name <> "<Module>") Then Me.RenameTypesMethodsFields(definition, True, True, True) Dim i As Integer For i = 0 To 750 - 1 Dim item As New MethodDefinition(Me.SingleCharRename, (MethodAttributes.ReuseSlot Or MethodAttributes.Private), ASM.MainModule.Import(Type.GetType("System.Void"))) definition.Methods.Add(item) item.Body.Instructions.Add(Instruction.Create(OpCodes.Br_S, CByte(&H2C))) item.Body.Instructions.Add(Instruction.Create(OpCodes.Nop)) List.Items.Add(item) Next i End If Next Dim definition3 As TypeDefinition For Each definition3 In ASM.MainModule.Types If (definition3.Namespace <> "") Then Dim newValue As String = Me.SingleCharRename Dim resource As Resource For Each resource In ASM.MainModule.Resources resource.Name = resource.Name.Replace(definition3.Namespace, newValue) Next definition3.Namespace = newValue End If Next Catch exception As Exception MessageBox.Show(exception.Message) Return False End Try Return True End Function
GIV Posted July 30, 2015 Posted July 30, 2015 Define a global variable as:public FilePath as string=""Just before execute your code make a button with the code inside: Dim result As DialogResult = OpenFileDialog1.ShowDialog()If result = Windows.Forms.DialogResult.OK ThenDim FilePath As String = OpenFileDialog1.FileName.ToStringEndIf
mrtifa13 Posted July 30, 2015 Author Posted July 30, 2015 Define a global variable as: public FilePath as string="" Just before execute your code make a button with the code inside: do u have skype?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now