Issues related to VMProtect
Admin
Site Admin
Posts: 2586 Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:
Post
by Admin » Wed Dec 27, 2023 11:17 am
The build 1932 supports self-contained executables.
Here is simple example of .csproj to protect compiled assembly before publishing in a single file:
Code: Select all
<Project Sdk="Microsoft.NET.Sdk">
...
<Target Name="VMProtectCompile" BeforeTargets="GenerateSingleFileBundle">
<PropertyGroup>
<VMProtectCon>"C:\Program Files\VMProtect Demo\VMProtect_Con.exe"</VMProtectCon>
<VMProtectInputFile>"$(IntermediateOutputPath)$(AssemblyName).dll"</VMProtectInputFile>
</PropertyGroup>
<Exec Command="$(VMProtectCon) $(VMProtectInputFile) $(VMProtectInputFile)" />
</Target>
<Target Name="VMProtectDelete" AfterTargets="GenerateSingleFileBundle">
<Delete Files="$(IntermediateOutputPath)$(AssemblyName).dll" />
</Target>
</Project>
howze
Posts: 11 Joined: Thu Dec 07, 2023 9:55 am
Post
by howze » Fri Dec 29, 2023 8:15 am
Admin wrote: ↑ Wed Dec 27, 2023 11:17 am
The build 1932 supports self-contained executables.
Here is simple example of .csproj to protect compiled assembly before publishing in a single file:
Code: Select all
<Project Sdk="Microsoft.NET.Sdk">
...
<Target Name="VMProtectCompile" BeforeTargets="GenerateSingleFileBundle">
<PropertyGroup>
<VMProtectCon>"C:\Program Files\VMProtect Demo\VMProtect_Con.exe"</VMProtectCon>
<VMProtectInputFile>$(IntermediateOutputPath)$(AssemblyName).dll</VMProtectInputFile>
</PropertyGroup>
<Exec Command="$(VMProtectCon) $(VMProtectInputFile) $(VMProtectInputFile)" />
</Target>
<Target Name="VMProtectDelete" AfterTargets="GenerateSingleFileBundle">
<Delete Files="$(IntermediateOutputPath)$(AssemblyName).dll" />
</Target>
</Project>
1、When I was testing this feature, I found that if the name of the project contains a space, it will report an error when publishing, please check, thank you.
pic.png (50.85 KiB) Viewed 3107 times
2、At the same time, how to use functions such as 'Memory Protection', 'Debugger', 'Virtualization Tools Found' message, etc., which can be directly used in the gui?
Admin
Site Admin
Posts: 2586 Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:
Post
by Admin » Fri Dec 29, 2023 12:21 pm
Just change PATH_TO_VMP_FILE to the full name of ".vmp" file created by VMProtect's GUI:
Code: Select all
<Target Name="VMProtectCompile" BeforeTargets="GenerateSingleFileBundle">
<PropertyGroup>
<VMProtectCon>"C:\Program Files\VMProtect Demo\VMProtect_Con.exe"</VMProtectCon>
<VMProtectInputFile>"$(IntermediateOutputPath)$(AssemblyName).dll"</VMProtectInputFile>
<VMProtectProjectFile>-pf "PATH_TO_VMP_FILE"</VMProtectProjectFile>
</PropertyGroup>
<Exec Command="$(VMProtectCon) $(VMProtectInputFile) $(VMProtectInputFile) $(VMProtectProjectFile)" />
</Target>
About available parameters for the console version you can read
here .
P.S. Don't forget to use the code virtualization for all critical methods with ObfuscationAttribute:
Code: Select all
[Obfuscation(Feature = "virtualization", Exclude = false)]
void MethodForProtection()
{
...
howze
Posts: 11 Joined: Thu Dec 07, 2023 9:55 am
Post
by howze » Fri Dec 29, 2023 2:27 pm
Admin wrote: ↑ Fri Dec 29, 2023 12:21 pm
Just change PATH_TO_VMP_FILE to the full name of ".vmp" file created by GUI:
Code: Select all
<Target Name="VMProtectCompile" BeforeTargets="GenerateSingleFileBundle">
<PropertyGroup>
<VMProtectCon>"C:\Program Files\VMProtect Demo\VMProtect_Con.exe"</VMProtectCon>
<VMProtectInputFile>"$(IntermediateOutputPath)$(AssemblyName).dll"</VMProtectInputFile>
<VMProtectProjectFile>-pf "PATH_TO_VMP_FILE"</VMProtectProjectFile>
</PropertyGroup>
<Exec Command="$(VMProtectCon) $(VMProtectInputFile) $(VMProtectInputFile) $(VMProtectProjectFile)" />
</Target>
About available parameters for the console version you can read
here .
P.S. Don't forget to use the code virtualization for all critical methods with ObfuscationAttribute:
Code: Select all
[Obfuscation(Feature = "virtualization", Exclude = false)]
void MethodForProtection()
{
...
I don’t know if I understand it correctly, but I still get an error.
Code: Select all
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Wpf_App</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<Target Name="VMProtectCompile" BeforeTargets="GenerateSingleFileBundle">
<PropertyGroup>
<VMProtectCon>"D:\VMProtect Demo\VMProtect_Con.exe"</VMProtectCon>
<VMProtectInputFile>$(IntermediateOutputPath)$(AssemblyName).dll</VMProtectInputFile>
<VMProtectProjectFile>-pf "C:\Users\Hao\Desktop\Wpf App\bin\Release\net8.0-windows\publish\win-x64\Wpf App.exe"</VMProtectProjectFile>
</PropertyGroup>
<Exec Command="$(VMProtectCon) $(VMProtectInputFile) $(VMProtectInputFile) $(VMProtectProjectFile)" />
</Target>
<Target Name="VMProtectDelete" AfterTargets="GenerateSingleFileBundle">
<Delete Files="$(IntermediateOutputPath)$(AssemblyName).dll" />
</Target>
</Project>
pic.png (24.27 KiB) Viewed 3079 times
Admin
Site Admin
Posts: 2586 Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:
Post
by Admin » Fri Dec 29, 2023 2:29 pm
It seems you don't need our software, because you can't even solve such a "simple problem" by yourself. I don't understand why you think that "Wpf App.exe" is a VMProtect project file.
P.S. You still use wrong code here:
Code: Select all
<VMProtectInputFile>$(IntermediateOutputPath)$(AssemblyName).dll</VMProtectInputFile>
howze
Posts: 11 Joined: Thu Dec 07, 2023 9:55 am
Post
by howze » Fri Dec 29, 2023 3:11 pm
Admin wrote: ↑ Fri Dec 29, 2023 2:29 pm
It seems you don't need our software, because you can't even solve such a "simple problem" by yourself. I don't understand why you think that "Wpf App.exe" is a VMProtect project file.
P.S. You still use wrong code here:
Code: Select all
<VMProtectInputFile>$(IntermediateOutputPath)$(AssemblyName).dll</VMProtectInputFile>
Thank you very much, I successfully solved the problem, it was indeed that I used the wrong code.
ps. My English is not good, and I am not very familiar with this software, but now I understand what VMProtect project file is. Anyway, thank you again for your patient answer.