Page 1 of 1

.NET: Script examples

Posted: Thu Feb 08, 2024 6:27 am
by Admin
.NET: Disable renaming of methods with script

Just change CLASS_NAME to required class name like 'Test':

Code: Select all

function OnBeforeCompilation()
	local heap = vmprotect.core():outputArchitecture():streams()
	local methods = heap:table(TokenType.MethodDef)
	for i = 1, methods:count() do
		local method = methods:item(i)
		if method:declaringType():name() == CLASS_NAME then
			method:setRenameMode(RenameMode.None)
		end
	end
end
Exclude header from CRC checking (for PE only):

Code: Select all

function OnBeforeCompilation()
	local header = vmprotect.core():outputArchitecture():segments():header()
	if header ~= nil then
		header:setExcludedFromMemoryProtection(true)
	end
end

Re: .NET: Script examples

Posted: Sat Jun 22, 2024 1:32 pm
by mounirsoltan
Hi, I have a beginner question. If I only use the GUI VMProtect and I protect the binary file with serial lock, could I write a script to make the protected file read the license key from a text file, like serial.txt?
thanks admin

Re: .NET: Script examples

Posted: Tue Jun 25, 2024 3:32 am
by Admin
Please notice that script works while protection only, so you have to implement required functions in your application by yourself.