1. 程式人生 > >3大類別教你如何使用程式碼保護軟體VMProtect的內建指令碼(1)

3大類別教你如何使用程式碼保護軟體VMProtect的內建指令碼(1)

VMProtect是一種很可靠的工具,可以保護應用程式程式碼免受分析和破解,但只有在應用程式內保護機制正確構建且沒有可能破壞整個保護的嚴重錯誤的情況下,才能實現最好的效果。

之前對主視窗進行了介紹,接下來我們將對VMProtect中強大的內建指令碼的使用進行介紹,希望對您有所幫助。>>體驗VMProtect最新試用版

VMProtect具有內建的強大指令碼語言LUA,極大地增強了VMProtect在每個保護階段的預設保護功能。LUA語法非常類似於JavaScript,但與之不同的是,LUA不包含顯式類。不過,指令碼語言允許輕鬆地實現類、繼承和事件等面向物件的程式設計機制。

對於如何使用指令碼語言,可以進行以下三類的介紹:

  • 內建功能
  • 事件

第一部分:類

 

VMProtect中內建的指令碼語言LUA是面向物件的:它在語法,意識形態和實現方面與JavaScript非常相似。指令碼語言包括提供基本功能的標準類和提供對應用程式保護功能的訪問的專用類。

 

▲核心

專案選擇:

enum ProjectOption {
	None,
	Pack,
	ImportProtection,
	MemoryProtection,
	ResourceProtection,
	CheckDebugger,
	CheckKernelDebugger,
	CheckVirtualMachine,
	StripFixups,
	StripDebugInfo,
	DebugMode
}

使用VMProtect核心的類:

class Core {
public:
	string projectFileName();//返回專案的名稱
	void saveProject(); //儲存專案
	string inputFileName(); //返回當前專案的原始檔的名稱
	string outputFileName(); //返回當前專案的輸出檔案的名稱
	void setOutputFileName(string name); //設定當前專案的輸出檔案的名稱
	string watermarkName(); //返回當前專案水印的名稱
	void setWatermarkName(string name); //設定當前專案的水印名稱
	int options(); //返回當前專案的選項                                                            
	void setOptions(int options); //設定當前專案的選項
	string vmSectionName(); //返回當前專案的VM段名稱
	void setVMSectionName(); //設定當前專案的VM段名稱
	Licenses licenses(); //返回當前專案的許可證列表
	Files files(); //返回當前專案的檔案列表
	Watermarks watermarks(); //返回水印列表
	PEFile/MacFile inputFile(); //返回原始檔
	PEFile/MacFile outputFile();//返回輸出檔案
	PEArchitecture/MacArchitecture inputArchitecture(); //返回源架構
	PEArchitecture/MacArchitecture outputArchitecture();//返回輸出架構
};

 

▲水印

用於處理水印列表的類:

class Watermarks {
public:
	Watermark item(int index); //返回帶有給定索引的水印
	int count(); //返回列表中的一些水印
	Watermark itemByName(string name);//返回帶有給定名稱的水印
}

使用水印的類:

class Watermark {public:	string name(); //返回水印的名稱	string value();//返回水印的值	bool blocked();//返回“Blocked”屬性	void setBlocked(bool value); //設定“Blocked”屬性}

 

▲許可證

用於處理許可證列表的類:

class Licenses {
public:
int keyLength(); //返回鍵的長度
string publicExp(); //返回公共指數
string privateExp(); //返回私有指數
string modulus(); //返回模量
License item(int index); // 返回具有給定索引的許可證
int count(); //返回列表中的許可證數量
}

使用許可證的類:

class License {
public:
string date(string format = "%c"); //返回許可證的日期
string customerName(); //返回許可證所有者的名稱
string customerEmail(); //返回許可證所有者的電子郵件
string orderRef();//返回購買許可證的訂單id
string comments();//返回許可的註釋
string serialNumber(); //返回許可證的序列號
bool blocked(); //返回“Blocked”屬性
void setBlocked(bool value); //設定“Blocked”屬性
}

 

▲檔案

用於處理檔案列表的類:

class Files {
public:
File item(int index); // 返回具有給定索引的檔案
int count(); //返回列表中的檔案數量
}

使用檔案的類:

class File {
public:
string name(); //返回檔案的名稱
string fileName(); //返回檔名
int options(); //返回選項
void setName(string name);//設定檔案的名稱
void setFileName(string name);//設定檔案的檔名
void setOptions();//設定選項
}

- 持續更新