Hack Forums
[.NET] Program FUD if compiled in Visual Studio but 11/59 if compile via codedom. - 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] Program FUD if compiled in Visual Studio but 11/59 if compile via codedom. (/showthread.php?tid=4722922)



Program FUD if compiled in Visual Studio but 11/59 if compile via codedom. - SIM-2071734 - Mar 9, 2015

As the title says my program is FUD if I compile it via visual studio but if I compile via codedom the detections jumps from 0 to 11. Some shitty AVs detect my file as a Gen:Heur.MSIL.Agent.17. I'm using the same icon and assembly infos for both executables. The code is also the same.


* - Moon Rock - Mar 9, 2015

I think it's due to the codedom code, since it's used commonly it'll detect it as fishy.


* - SIM-2071734 - Mar 9, 2015

I tried to decompile my executables (codedom e non codedom) and looks like that codedom does not add resources and similar things. I need a obufuscator that can obuscate the .vb file... maybe this will solve my problem.


* - tweety - Mar 9, 2015

(Mar 9, 2015 09:49 AM)Hitman Agency Wrote:  I think it's due to the codedom code, since it's used commonly it'll detect it as fishy.

Ah yes, it seems like you have no idea what you are talking about.

When compiling with VS it adds other flags as well as compiler options when compiling. CodeDom doesn't. You need to specify them yourself.


* - SIM-2071734 - Mar 9, 2015

(Mar 9, 2015 10:41 AM)Tweety. Wrote:  Ah yes, it seems like you have no idea what you are talking about.

When compiling with VS it adds other flags as well as compiler options when compiling. CodeDom doesn't. You need to specify them yourself.

Can you help me whit this? This is my codedom compiler:

Code
Public Sub Compile(ByVal Output As String, ByVal Source As String, ByVal DotNet2 As Boolean)
      On Error Resume Next
      Dim Compiler As ICodeCompiler = (New VBCodeProvider).CreateCompiler()
      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")
      Parameters.CompilerOptions &= " /target:winexe /win32icon:" & ICO
      Dim Version = New Dictionary(Of String, String)
      If DotNet2 = True Then
      Version.Add("CompilerVersion", "v2.0")
      Else
      Version.Add("CompilerVersion", "v4.0")
      End If
      cResults = Compiler.CompileAssemblyFromSource(Parameters, Stub)
      If cResults.Errors.Count > 0 Then
      For Each CompilerError In cResults.Errors
      Console.BackgroundColor = ConsoleColor.White
      Console.ForegroundColor = ConsoleColor.Red
      Console.WriteLine(CompilerError.ErrorText)
      Next
      ElseIf cResults.Errors.Count = 0 Then

      End If
    End Sub
End Module



* - taktaktak - Mar 9, 2015

(Mar 9, 2015 10:58 AM)lupettohf Wrote:  Can you help me whit this? This is my codedom compiler:

Code
Public Sub Compile(ByVal Output As String, ByVal Source As String, ByVal DotNet2 As Boolean)
      On Error Resume Next
      Dim Compiler As ICodeCompiler = (New VBCodeProvider).CreateCompiler()
      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")
      Parameters.CompilerOptions &= " /target:winexe /win32icon:" & ICO
      Dim Version = New Dictionary(Of String, String)
      If DotNet2 = True Then
      Version.Add("CompilerVersion", "v2.0")
      Else
      Version.Add("CompilerVersion", "v4.0")
      End If
      cResults = Compiler.CompileAssemblyFromSource(Parameters, Stub)
      If cResults.Errors.Count > 0 Then
      For Each CompilerError In cResults.Errors
      Console.BackgroundColor = ConsoleColor.White
      Console.ForegroundColor = ConsoleColor.Red
      Console.WriteLine(CompilerError.ErrorText)
      Next
      ElseIf cResults.Errors.Count = 0 Then

      End If
    End Sub
End Module

Ah yes there's your problem right there, "On Error Resume Next". Remove it and never use it again, also helps if you dont C&P code :D


* - SIM-2071734 - Mar 9, 2015

I'm not copying anything... why I should remove "On Error Resume Next"? It's for debug propouses... sometimes I rename the icon, in this way the compiler does not crash.


* - taktaktak - Mar 9, 2015

(Mar 9, 2015 02:54 PM)lupettohf Wrote:  I'm not copying anything... why I should remove "On Error Resume Next"? It's for debug propouses... sometimes I rename the icon, in this way the compiler does not crash.

If that's all you're using it for then why not use a Try Catch and display the exception so you can actually see whats going wrong?


* - SIM-2071734 - Mar 10, 2015

OK now i'm using Try(s) to preventiva crashes. BTW can someone help me or send me a tutoral/mdsn wiki page whit all the flagas/options forma codedom?

I'm on my phone atm


* - sh@rp - Mar 10, 2015

All you need to know is available here :

https://msdn.microsoft.com/en-us/library/gg145034(v=vs.100).aspx

You must click on the links and read the contents ... we unfortunately can't do it for you....
The first step in the development of a project is to read resources before coding ;)


* - jessman420 - Mar 11, 2015

Visual studio also compiles with vbc.exe. So, the question you must ask yourself is what are the differences in my file compiled in the IDE and with codedom and how do I find them. If you decompile both apps using a combination of Reflector and Ildasm and the compare utility for notepad++ you should be able to find all the differences between your 2 files, then figure out how to make codedom compile with the same settings.

This will probably take you a few hours but you will learn a lot and you can create a nice dynamic generation of your binary without the issues you are having.


* - SIM-2071734 - Mar 11, 2015

(Mar 11, 2015 06:33 AM)jessman420 Wrote:  Visual studio also compiles with vbc.exe. So, the question you must ask yourself is what are the differences in my file compiled in the IDE and with codedom and how do I find them. If you decompile both apps using a combination of Reflector and Ildasm and the compare utility for notepad++ you should be able to find all the differences between your 2 files, then figure out how to make codedom compile with the same settings.

This will probably take you a few hours but you will learn a lot and you can create a nice dynamic generation of your binary without the issues you are having.
By adding some System.* libs i got it 6/59 ty :)