> For the complete documentation index, see [llms.txt](https://documentation.virbox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.virbox.com/fundamentals/cli-tool-user-manual/user-manual_virbox-protector-command-line.md).

# User Manual\_Virbox Protector Command Line

## User Manual:

## Virbox Protector Command Line Tool

Virbox Protector supports developer to protect applications in both GUI tool and CLI tool.

Here we introduce how to use "Command Line Interface of Virbox Protector to protect applications.

### Prerequisites

Sign-up Virbox Protector, get the trial license and install the Virbox Protector in your machine;

Go to the ***\bin*** sub directory of installation directory of Virbox Protector, besides of the GUI tool of Virbox Protector, you will find 2 command line interface tools in the same of installation directory:

Virbox Protector CLI tool:

```
virboxprotector_con.exe
```

DS Protector CLI tool (DS Protector is the tool for software developer to protect their data resource, more details information, pls refer the relevant document):

```
dsprotector_con.exe
```

(Above prerequisites is for test/evaluation Virbox Protector only.

To protect formal release software, pls purchase and get the related Virbox Protector license)

### 1. Start to use Virbox Protector CLI tool

The on default path for`Virbox Protector` CLI tools: `virboxprotector_con.exe` are:

```
Windows:
C:\Program Files\senseshield\Virbox Protector 3\bin

Linux:
/usr/share/virboxprotector/bin

macOS:
/Applications/Virbox Protector 3.app/Contents/MacOS/bin
```

When you call Virbox Protector Command line tool and execute the Virbox protector,

You may:

Either to specify the full absolutely path, for example:

```shell
"C:\Program Files\senseshield\Virbox Protector 3\bin\virboxprotector_con.exe" <file_path>      <options ..> -o <output_path>
```

Or,

in windows system , you may add the environmental variable and directly input:

`virboxprotector_con`

and no need to specify the full path to execute the Virbox Protector.

For non windows system: you may set the Symbolic Link, like this sample below:

```shell
sudo ln -s /usr/share/virboxprotector/bin/virboxprotector_con /usr/local/bin/virboxprotector_con
```

Then you can directly input: `virboxprotector_con` to protect your applications.

### 2. The main protection function/feature of Virbox Protector CLI tool:

To protect desktop or mobile application, you can call Virbox Protector CLI tool and specify the application path and out path to protect your applications. Virbox Protector will automatically to recognize the application types;

Like with Virbox Protector tool, Developer may use "option" to set and specify the "Protection option" to the application protected, includes “Function Option”, "Protection Option", "Data & Resource Protection" etc.&#x20;

{% hint style="info" %}
On default, if developer doesn't specify output folder, after protection succeed, a new `\protected` folder will be generated, the protected application with same file name located in the new directory.&#x20;
{% endhint %}

```shell
virboxprotector_con <file_path> <options ...> -o <output_path>
```

To get help information, use following command:

`virboxprotector_con`

or

`virboxprotector_con --help=?`

to view help information to each type of application in details:

<figure><img src="/files/yo49YtjvGeXATLCGCiHy" alt=""><figcaption></figcaption></figure>

For dsprotector\_con

`dsprotector_con <filename|directory> <-c ssp>`

To get help information, execute&#x20;

`dsprotector_con`

or

`dsprotector -?`

<figure><img src="/files/v9UsQnq1rUkIeYROHx0b" alt=""><figcaption></figcaption></figure>

Specify application type to view help information in detail:&#x20;

`native|dotnet|apk|aab|aar|app|u3d|java-bce|java-vme|h5|strip|u3dres|mulpkg|ilmerge`

For example, get help information to protect Android AAB package:

`virboxprotector_con --help=aab`

<figure><img src="/files/CpwccVinII1IweQVbw5D" alt=""><figcaption></figcaption></figure>

For some special application type, it is required to specify the argument accordingly.

| Application type and protection option                                    | Argument                   |
| ------------------------------------------------------------------------- | -------------------------- |
| Protect the Java apps with BCE protection mode                            | `-java`                    |
| Protect the Java apps with VME protection mode                            | N/A, on default to use VME |
| Protection Unity3D app and resource encryption (Windows/Linux hot update) | `-u3dres`                  |
| Protection the HTML 5 (.js file)                                          | `-h5`                      |
| To remove the debugging information from ELF file (strip)                 | `-strip`                   |
| Protect and archive with multiple package                                 | `-mulpkg`                  |
| Protect and merge assemblies                                              | `-ilmerge`                 |

Example:

```shell
virboxprotector_con -java <java_dir> <other_options ...>
```

#### **The Syntax of Virbox Protector CLI with long options**

For most of command line options, the syntax is:

`--{opt}=value`

1 means enable/switch on

0 means disable/switch off

**Sample**

`--mem-check=1`, `--jit-enc=0`

#### **How to get the CLI's Help**

For more detail instruction/help to use VBP CLI's options/arguments,

**use**: `--help={type}` to view the CLI helps:

```shell
virboxprotector_con --help=apk
```

<figure><img src="/files/VwQcYTTOszcbroB5szcR" alt=""><figcaption></figcaption></figure>

The application supports to get "help" includes:

```shell
--help={native|dotnet|apk|aab|aar|app|u3d|java-bce|java-vme|h5|strip|u3dres|mulpkg|ilmerge}
```

`native` application means the native types of application to the operation system, and it doesn't need the Virtual machine environment or interpreter when executed. usually, these native application compiled by C/C++/Delphi/VB6 program language, which includes:

​ The PE program in the Windows system(with the suffix of .exe/.dll/.sys );

​ The Elf programs in the Linux/Android system (with the suffix of .so or main program);

​ The MachO application (.dylib or main program) in the macOS/iOS system.

<figure><img src="/files/fHfXrD0uaVbmjpxRtKvy" alt=""><figcaption><p>Help info to protect native application</p></figcaption></figure>

### 3. The way using Virbox Protector CLI to protect applications

Unlike with by using the Virbox Protector GUI tool, developer to set protection option by "select and click", when Developer use the CLI tool to set the protection setting, there are 2 ways for Software developer to set the protection option by use of Virbox Protector CLI tool to protect their project.

#### **Option 1: With protection configuration file**

Configuration file (suffix .ssp) is the file which generated by Virbox Protector GUI tool which save the protection option setting. Developer use **Virbox Protector GUI  tool** to generate the protection configuration file (the configuration file suffix is **.ssp file**, which store the protection setting to functions protection setting, general protection setting etc..) and then save the configuration file together with the project which to be protected in the same folder, then use **Virbox Protector CLI** (no need to specify argument, option, since all of protection setting has been saved in the configuration file) to protect the project accordingly.

#### **Option 2: Without Protection Configuration file**

&#x20;Use CLI tool to protect the software project directly, with specified the argument, option which to define the functions protection option and general protection options.

Developer may use VBP CLI tool to protect different kind of application with multiple arguments and options.

if no specified argument/option has been used in Virbox CLI tool, the protection setting will be used on default.

#### **Option 1 example**

Here we use a native executive file to be a example to show how to use Virbox Protector GUI tool to generate a protection configuration file (.ssp file) and then use the CLI tool and the configuration file to protect the original native executive file.&#x20;

**Step1**, Generate the "Protection Configuration File"

Open the Virbox Protector GUI tool, drag the native file into Virbox Protector GUI tools, set the protection option in the `Function Option` tab and `Protection Option` tab;

Click the button (menu): `Save Selected Configuration` which save the configuration file generated (suffix name is .ssp in the output folder

<figure><img src="/files/zLi6yVLyg1uIL4pZzGhD" alt=""><figcaption></figcaption></figure>

#### Go to output folder

Go to the output folder, find the .ssp file and save the configuration file in the same folder together with native file which to be protected.

#### Step 2 &#x20;

Use Virbox Protector CLI tool to protect the native project file

Virbox Protector standard command to protect applications:

```
virboxprotector_con <file_path> <options ...> -o <output_path>
```

C:\the absolutely path of virbox protector\virboxprotector\_con the absolutely path of protected file\protected filename -o absolutedly path of output file\output file name

sample:

<figure><img src="/files/wbWeKI3cTHyjrw1jxyBQ" alt=""><figcaption></figcaption></figure>

#### if no configuration file generated or  not be found the configuration file in same folder

Virbox Protector CLI tool will use protection option setting on default to protect the project:

The on default protection option setting for:

**Native Project:**

Compression and Memory Check

**.NET Project:**&#x20;

Compression and JIT Encryption;&#x20;

if you want to specify to protect the concrete function with Code encryption or Code Obfuscation, you need to generate the protection configuration file first. and follow the protect step above.

**ELF Project:**

Compression and Memory Check;

**MachO Project:**

Memory Check

**Android APK:**

On default protection setting:&#x20;

On default anti debug

### 4. The Protected Application Type & Protection Options setting

From the section below, we will introduce how to use Virbox CLI tools (or Combine with GUI tools) to protect different kind of project, or different language.

CLI command to protect application:

`virboxprotector_con <apk_path> filename <options ...> [-o <output_path>]`

#### Protect Android APK/AAB

Virbox Protector CLI command to use to protect Android AAB or Apk.

`virboxprotector_con <apk_path> <options ...> [-o <output_path>]`

View help info

<figure><img src="/files/CpwccVinII1IweQVbw5D" alt=""><figcaption><p>Help info to Android AAB</p></figcaption></figure>

<figure><img src="/files/QCqje3QNrE7Q8kHy5SdW" alt=""><figcaption><p>Help info to Android Apk</p></figcaption></figure>

| Protection Options                                | CLI arguments        | On default value: |
| ------------------------------------------------- | -------------------- | ----------------- |
| Dex Encryption                                    | `--dex-enc=`         | `APK:1`, `AAB:0`  |
| File Verification                                 | `--file-check=`      | `1`               |
| Signature Verification                            | `--sign-check=`      | `0`               |
| Anti-Injection                                    | `--anti-inject=`     | `1`               |
| Detect the debug tool                             | `--detect-dbg=`      | `0`               |
| Detect the simulator                              | `--detect-emu=`      | `0`               |
| Root Detection                                    | `--detect-root=`     | `0`               |
| Multi parallel Detection                          | `--detect-multi=`    | `0`               |
| Output apks (Valid when enable the AAB signature) | `--apks=<apks_path>` | N/A               |

1 means enable/switch on

0 means disable/switch off

**Resource Encryption**

Virbox Protector (include GUI tool and CLI tool) support developer to protect the data, image resource attached together with the Android application.

Use the argument: `--res-enc=1` to enable the Resource encryption options,

Use the `;` to separate the resource file list, support the wild card `*`

| Option        | CLI argument           | On default Argument value               |
| ------------- | ---------------------- | --------------------------------------- |
| Enable        | `--res-enc=`           | `0`                                     |
| Resource list | `-res <resource_list>` | On default to protect all resource file |

Sample:

```shell
--res-enc=1 -res "file1;file2;assets/file1;assets2/*"
```

**Function Protection Option**

Besides of General protection option setting to applications, Virbox Protector supports developer to protect the specified function/methods, for APK and AAB's Functions Protection, Virbox Protector provides the feature: "Code of Virtualization" to protect the functions/method. which is most secured Protection options to specified functions to Android APK/AAB applications.

On default setting to "Code of Virtuallization" is to protect the methods of entry class of Application and Main Activity's class.

If you want to protect the specific functions/methods, pls refer:

[Function Option](#5.-function-protection-option)

**Archive application to multiple packages**

To archive the application to multiple package template, pls refer:

[Archive with multiple package](#archive-with-multiple-package)

**Signature**

Virbox Protector support developer to use signature, for Signature Options setting, pls refer:

[Signature option](#4.-signature-option)

**Sample**

```shell
virboxprotector_con app-release.apk 
	--dex-enc=1 --file-check=1 --detect-dbg=0 --sign-check=1
	--res-enc=1 -res "assets/*;res/*"
	--hide-symtab=0 -lib "lib/armeabi-v7a/libhello.so;/lib/arm64-v8a/*"
	--sign=1 --ks="test/android.ks" --ks-pass=mypass --ks-key-alias=CERT --key-pass=mykeypass
	-o app-release-protected.apk
```

#### **Protect AAR package**

Virbox Protector support to protect Android AAR pacakge with Code of Virtualization, and to protect the .so libs of AAR package:

Virbox Protector CLI toolCommand used:

`virboxprotector_con <aar_path> <options ...> [-o <output_dir>]`

<figure><img src="/files/rqVYcP86ejp5W2Kfwk6b" alt=""><figcaption><p>Help info to Android AAR</p></figcaption></figure>

Sample (Sample shows to protect the all of the class method of “test.aar” package and protect all of .so libs, "v" means "virtualization")

```shell
virboxprotector_con test.aar -v "com.example.*" -lib "jni/*" -o protected/test.aar
```

#### Protect the Android .SO lib \*\*

Virbox Protector CLI command to protect Android .so libs

`virboxprotector_con <Android.so lib_path> <options ...> [-o <output_path>]`

<figure><img src="/files/vcDpDRshTrgodQgPP6jm" alt=""><figcaption><p>Help Info to Android .so libs</p></figcaption></figure>

| Option                | CLI argument            | On default Argument value |
| --------------------- | ----------------------- | ------------------------- |
| Hide the symbol table | `--hide-symtab=`        | `0`                       |
| Resource list         | `-lib <nativelib_list>` | N/A                       |

```shell
--hide-symtab=0 -lib "lib/armeabi-v7a/libhello.so;/lib/arm64-v8a/*"
```

#### Protect the PE and native application

`virboxprotector_con <native_path> <options ...> [-o <output_dir>]`

<figure><img src="/files/fHfXrD0uaVbmjpxRtKvy" alt=""><figcaption><p>Help info to Native</p></figcaption></figure>

| Protection Option           | CLI arguments     | On default argument value |
| --------------------------- | ----------------- | ------------------------- |
| Compression                 | `--pack=`         | `1`                       |
| Memory Check                | `--mem-check=`    | `1`                       |
| Import table protection     | `--imp-protect=`  | `1`                       |
| Resource section protection | `--res-sect-enc=` | `1`                       |
| Protect/encrypt PE overlay  | `--overlay-enc=`  | `1`                       |
| Detect the debug tool       | `--detect-dbg=`   | `0`                       |
| VM detection                | `--detect-vm=`    | `0`                       |

here value setting:

1 means enable/switch on

0 means disable/switch off

#### Protect the ELF

| Option                             | CLI arguments      | On default argument value |
| ---------------------------------- | ------------------ | ------------------------- |
| Compression                        | `--pack=`          | `1`                       |
| Memory Check                       | `--mem-check=`     | `1`                       |
| Detect the debug tool              | `--detect-dbg=`    | `0`                       |
| Strip the symbol table of ELF file | `--strip-dbginfo=` | `1`                       |

here value setting:

1 means enable/switch on

0 means disable/switch off

#### Protect the MachO

| Protection Option | CLI argument    | On default Argument value |
| ----------------- | --------------- | ------------------------- |
| Memory Check      | `--mem-check=`  | `1`                       |
| Detect debug tool | `--detect-dbg=` | `0`                       |

For how to sign and use signature, pls refer:

[Signature Options](#4.-signature-option)

Here value setting:

1 means enable/switch on

0 means disable/switch off

#### Protect iOS App

Virbox Protector CLI command to protect iOS App

`virboxprotector_con <input_path> <options ...> [-o <output_path>]`

<figure><img src="/files/oRxrzjLSP79GPMryOGOX" alt=""><figcaption><p>Help Info to protect iOS App</p></figcaption></figure>

| Protection Option                               | CLI Argument       | On default Argument value |
| ----------------------------------------------- | ------------------ | ------------------------- |
| Memory Check                                    | `--mem-check=`     | `1`                       |
| Detect Debug tool                               | `--detect-dbg=`    | `0`                       |
| Objective-C: Name of Obfuscation to Objective C | `--objc-rename=`   | `0`                       |
| Output path                                     | `-o`               | `protected/<file_name>`   |
| IPA path (enable signature required)            | `--ipa=<ipa_path>` | None                      |

Here value setting:

1 means enable/switch on

0 means disable/switch off

**Signature Option**

Pls refer the signature of iOS/macOS in the "[Signature Option](#4.-signature-option)".

#### Protect .NET project

Virbox Protector CLI command to protect dotNET project

`virboxprotector_con <input_path> <options ...> [-o <output_path>]`

<figure><img src="/files/G94usu1x29G15c0x5syp" alt=""><figcaption><p>Help Info to protect dotNET</p></figcaption></figure>

| Protection Option                     | CLI Argument     | On default Argument Value |
| ------------------------------------- | ---------------- | ------------------------- |
| Compression                           | `--pack=`        | `0`                       |
| JIT Encryption                        | `--jit-enc=`     | `1`                       |
| String Encryption                     | `--str-enc=`     | `1`                       |
| Overlay encryption                    | `--overlay-enc=` | `1`                       |
| Detect the debug tool                 | `--detect-dbg=`  | `0`                       |
| Name of Obfuscation                   | `--rename=`      | `0`                       |
| Keep the rules of Name of obfuscation | `--keep-rules=`  | `""`                      |

here value setting:

1 means enable/switch on

0 means disable/switch off

> If No overlay data attachment, then ignore the argument: `--overlay-enc` 。

**Name of Obfuscation Options:**

`--rename=0` Off, disable the feature of Name of obfuscation;

`--rename=1` Set the name of Obfuscation to private member

`--rename=2` Reserve/keep the name of self-defined and not obfuscated.

**Keep the Rule of Name of Obfuscation**

Use the semicolon: `;`to separate the functions/methods, support to use wild card `*`

**Sample**

```shell
virboxprotector_con test.dll --pack=0 --jit-enc=1 --str-enc=1 --rename=2 --keep-rules="MyNamespace.MyInterface.*;MyNamespace.ExportForInvoke.*"
```

**Function Protection Option Setting**

Virbox Protector support developer to set the protection option to "fucntions/methods level (with fine grained level protection), To those critical methods/functions, Developer may select and set the protection mode to specified functions, with "Encryption", "Obfuscation", and "Virtualization".

Pls refer the "[Function Protection Option](#5.-function-protection-option)", on default to encrypt the code of entry functions.

**SDK label**

For some special methods and code, Developer may use the "SDK label to label in project code process. when Developer use the Virbox protector to protect the .net project. Virbox Protector will capapible and recognized these code label and protected.&#x20;

For .NET project, Virbox Protector support developer to label the critical functions/methods with 2 protection options: Code Encryption and Code Obfuscation.&#x20;

set the label to the functions code (start and ending), then project compiled and developer use Virbox protector to protect the project. GUI tools will show these functions with protection mode accordingly.

See [SDK label](broken://pages/kNLcvIY35xSERvEpiiBS) section for detail.

SDK sample for .NET project:

`//Name`

`namespace Virbox{`&#x20;

`//Code obfuscation`

&#x20;    `class Mutate : System.Attribute`&#x20;

&#x20;    `{`

&#x20;    `}`&#x20;

`//Code encryption`

&#x20;     `class Encrypt: System.Attribute`

&#x20;    `{`&#x20;

&#x20;    `}`&#x20;

`}`&#x20;

`public class main`&#x20;

`{`

&#x20;     `[Virbox.Mutate]//code obfuscation`

&#x20;     `public static void test1(string[] args)`

&#x20;`{`&#x20;

&#x20;     `System.Console.WriteLine("hello Virbox.Mutate!");`&#x20;

&#x20;     `}`&#x20;

&#x20;     `[Virbox.Encrypt]//Code Encryption`&#x20;

&#x20;     `public static void test2(string[] args)`&#x20;

&#x20;     `{`&#x20;

&#x20;          `System.Console.WriteLine("hello Virbox.Encrypt!");`

&#x20;     `}`&#x20;

&#x20;     `public static void Main(string[] args)`&#x20;

&#x20;     `{`

&#x20;`test1(args);`&#x20;

&#x20;`test2(args);`&#x20;

&#x20;      `}`

`}`

#### Protect Unity3D project

Virbox Protector CLI tool command to protect Unity3D project

`virboxprotector_con <input_path> <options ...> [-o <output_path>]`

<figure><img src="/files/ZXcuwGP45xbTQijzcroB" alt=""><figcaption></figcaption></figure>

| Protection Option                                            | CLI Argument              | On default Argument value |
| ------------------------------------------------------------ | ------------------------- | ------------------------- |
| Memory Check (Valid for il2cpp)                              | `--mem-check=`            | `1`                       |
| File Check （Valid for Android)                               | `--file-check=`           | `1`                       |
| Signature check (Valid for Android)                          | `--sign-check=`           | `0`                       |
| Anti Injection（Valid for Android）                            | `--anti-inject=`          | `1`                       |
| Protect Unity Engine （Valid for Android il2cpp project only） | `--unity-engine-protect=` | `1`                       |
| MetaData, name of Obfuscation（Valid for il2cpp）              | `--metadata-rename=`      | `0`                       |
| Detect debug tool                                            | `--detect-dbg=`           | `1`                       |
| Detect simulator (Valid for Android Only)                    | `--detect-emu=`           | `0`                       |
| Root Detection (Valid for Android only)                      | `--detect-root=`          | `0`                       |
| Parallel detection                                           | `--detect-multi=`         | `0`                       |

#### **Encrypt the assembly**

Use `-asm` to specify assembly list and use semicolon: `;` to separate each assembly, support wild card `*`，On default to encrypt the .dll which prefix by `Assembly-CSharp` and `Assembly-UnityStrcip` and not necessary to specify these assembly accordingly.

Sample:

```shell
-asm "Data/Managed/Assembly-CSharp.dll;Data/Managed/Assembly-CSharp-first.dll"
```

**Resource Encryption**

Use the option: `--res-enc=1` to enable "Resource encryption" to protect resources, ，use the semicolon `;` to be separator between the resource list , wild card `*` supported.

| Protection Option                                                      | CLI Argument           | On default argument Value           |
| ---------------------------------------------------------------------- | ---------------------- | ----------------------------------- |
| Enable                                                                 | `--res-enc=`           | `1`                                 |
| Protection Priority by resources size (valid for android and iOS only) | `--res-favor-size=`    | `0`                                 |
| Set the Password to Resource encryption (Valid for Windows/Linux only) | `--res-pass=`          | N/A                                 |
| Resource list                                                          | `-res <resource_list>` | On default to protect all resource. |

Sample:

```shell
--res-enc=1 -res "file1;file2;assets/file1;assets2/*"
```

#### Protect Java Project

Virbox Protector support developer to protect Java Project with different kind of protection mode:

**Java BCE mode**

**and**

**Java VME mode**

For the difference between these 2 protection mode, pls refer the related section in the Virbox Protector User Manual.

Note: 2 different license required to use these 2 protection mode.

#### **Protect Java project with Java-BCE Protection mode**

Virbxo Protector CLI command to protect Java project (with BCE protection mode)

```shell
virboxprotector_con -java <project_directory> [--java-pass=<password>] [-o <output_directory>]
```

<figure><img src="/files/HnoFCjuGFITVHOgaLx3p" alt=""><figcaption><p>Help info to Java Project with BCE protection mode</p></figcaption></figure>

| Protection Option        | CLI Argument          | On default Argument value/setting |
| ------------------------ | --------------------- | --------------------------------- |
| Set the password         | `--java-pass=`        | Random password                   |
| Encrypt the JAR embedded | `--include-embedded=` | `0`                               |
| Specify the Output path  | `-o <path>`           | xxxx\_protected                   |

Sample:

```shell
virboxprotector_con -java my_java_dir --java-pass=12345 --include-embedded=1 -o my_java_dir_protected
```

After protection successed, you will find 3 new file has been generated in the specified output folder:

1. the new protected jar file
2. ReadMe.txt (which describe how to deploy when execute the protected jar file;
3. `sjt_agent.jar`

#### How to deploy when execute the protected JAR file (ReadMe.text)

There are 2 ways to deployed Jar file when executed

**Option 1:**

Use command line to specify and add `sjt_agent` to JAR, see sample:

`java -javaagent:"D:\test\sjt\sjt_agent.jar" -jar test.jar`

**Option 2**:&#x20;

For "Tomcat" framework or other special framework which profile  can be used to setup option, for example, `setenv.sh`, developer may edit the profile and add `-javaagent` option, for how to edit the profile, pls refer relevant document.

[JAR deployment](https://documentation.virbox.com/fundamentals/cli-tool-user-manual/pages/WGyUwFqsnpyo4vBdZii6#5.1.-jar-deployment)

[WAR deployment](https://documentation.virbox.com/fundamentals/cli-tool-user-manual/pages/WGyUwFqsnpyo4vBdZii6#5.2.-war-deployment)

pls refer related sections in Protect Java Project with GUI tool.

#### **Protect Java project with Java-VME mode**

{% hint style="info" %}
Java-VME support to protect the Java method with "code of Virtualization" only, which is most of secure way to protect the Java method.

There are 3 ways to protect Java project with VME protection mode:

1. Use Virbox Protector GUI to generate the configuration file, and then use Virbox Protector CLI to protect java project;
2. Use Virbox Protector CLI tools to protect Java project directly (go through this way in below section;
3. SDK lable to those critical method, Virbox Protector support developer to set a SDK label to those critical method, then use CLI tool to protect Java Project.
   {% endhint %}

Virbox Protector CLI command to protect Java Project with VME protection mode

`virboxprotector_con <jar_path> <options ...> [-o <output_dir>]`

<figure><img src="/files/2D7RlLwQf6brYsaM7o7q" alt=""><figcaption><p>Help info to protect Java with VME protection mode</p></figcaption></figure>

Sample 1 ( Protect all of methods of "test1" and "test2" with "Virtualization" ):

```shell
virboxprotector_con my_jar.jar -v "com.example.test1.*;com.example.test2.*" -o protected/my_jar.jar
```

Sample 2(Protect all of methods in the JAR archive)：

```shell
virboxprotector_con my_jar.jar -v "*" -o protected/my_jar.jar
```

**SDK label**

For some critical functions/methods, Virbox Protector also support developer to set SDK label to those functions/methods in project coding process. for more detail how to use/set SDK label to these functions/method in coding process, pls refer next chapter.

[pls refer SDK label section](broken://pages/kNLcvIY35xSERvEpiiBS)

#### Protect HTML 5 Project

```shell
virboxprotector_con -h5 <dir_or_file> -o <output_path>
```

<figure><img src="/files/vpfgVwGPZy39gHsiDgHl" alt=""><figcaption></figcaption></figure>

#### Protect Python Project  (Scripting language project)

To protect Python project, or other similar Scripting language project, the protection process consists 2 parts:

1. Protect “python.exe", in this part, Developer may use Virbox protector GUI tool to generate configuration file or use CLI tools to protect the "Python.exe" directly.
2. Protect "py" or "pyc" file, in this section developer use dsprotector\_con to protect py or pyc file.

Here we introduce how to protect the Python project steps by steps

Step 1: Protect "python.exe"

Option 1: Use Virbox Protector CLI to protect python.exe, The protection process pls refer related native protection section above.

Option 2: Use Virbox Protector GUI tool to generate the configuration file which save the "Protection option" setting.&#x20;

Pls following below 2 steps to generate the configuration file to python.exe. kindly remind, to switch on "DS" button and input the password.

save the the configuration file (.ssp file) with the same folder of "py" or "pyc" file.

the configuration file to python.exe is:  `python.exe.ssp`

<figure><img src="/files/2VsNstCQkZav0L8BUX9X" alt=""><figcaption></figcaption></figure>

Step 2: Use DS Protector CLI to protect py or pyc file/pyc file folder.

dsprotector\_con \<filename|directory> -c ssp -o \<filename|directory>

sample:

`dsprotector_con.exe C:\Users\test\Desktop\cmd\python\py.py -c C:\Users\test\Desktop\cmd\python\python.exe.ssp -o C:\Users\test\Desktop\cmd\python\protected\py.py`

Option Description to DSProtector CLI

| Option setting | Description                                                             |
| -------------- | ----------------------------------------------------------------------- |
| filename       | to protect the specific file                                            |
| directory      | to protect the whole directory                                          |
| -c ssp         | use the configuration file which generated by Virbox Protector GUI tool |
| -o output      | output directory for the protected file                                 |

{% hint style="info" %}
Protect pyc file directory, DSProtector supports to protect multiple py/pyc files in same directory. so, specify the directory, all of py/pyc file in the directory will be protected.
{% endhint %}

#### Protect PHP Project

Protect PHP, Lua, or other scripting language project. the protection process is similar to the protection process to Python.&#x20;

in General, there are 2 steps to protect PHP project:

Step 1 Use Virbox Protector CLI tool to protect PHP executive file

Step 2 Use DSProtector CLI tool tool to protect PHP file.

For the detail info, Pls refer the Python Protection process section above.

### 5. Signature Option

#### APK/AAB Signature

| Option                  | CLI Argument      | On default argument value/setting |
| ----------------------- | ----------------- | --------------------------------- |
| Enable the sign         | `--sign=`         | `0`                               |
| Set Key Store Path      | `--ks=`           | Valid for Global Configuration    |
| Set Key Store Password  | `--ks-pass=`      | Valid for Global Configuration    |
| Set the Key alias       | `--ks-key-alias=` | Valid for Global Configuration    |
| Set the Password of Key | `--key-pass=`     | Valid for Global Configuration    |

**Sample**

```shell
virboxprotector_con <file_path> <other_options ...> 
	--sign=1 --ks="test/android.ks" --ks-pass=mypass --ks-key-alias=CERT --key-pass=mykeypass 
	-o <output_path>
```

#### iOS/macOS Signature

| Option           | CLI Argument  | On default argument value/setting |
| ---------------- | ------------- | --------------------------------- |
| enable signature | `--sign=`     | `0`                               |
| Certificate      | `--identity=` | N/A                               |

### 6. Function Protection Option

Virbox Protector supports developer to protect the functions/method level (fine grained protection) and specify the "rule" to protect the critical functions/methods with different kind of protection options: Code of Encryption, Code of obfuscation (Mutation) and Code of Virtualization.

, use the semicolon: `;` to separate functions, support to use wild card: `*`

| Option                                                 | CLI Argument                   | Wild card          |
| ------------------------------------------------------ | ------------------------------ | ------------------ |
| Ignore/skip the function/method not support to protect | `--ignore-unsupported=<value>` | N/A                |
| Code of Encryption                                     | `-e`                           | support to use: \* |
| Code of Obfuscation (Code of mutation)                 | `-m`                           | Support to use: \* |
| Code of Virtualization                                 | `-v`                           | Support to use: \* |

**Sample**

`-m "function1;function2" -v "function3;function4" -e "test*" --ignore-unsupported=1`

> `--ignore-unsupported=`
>
> This option used to skip/ignore those functions which developer select the protection option doesn't support to protect; This option is enable on default when developer protect the following type of applications: **Jar/aar/war/apk/aab**

[**SDK label to some critical functions/methods**](broken://pages/kNLcvIY35xSERvEpiiBS)

Virbox Protector also support to set SDK label in project coding process. for more detail how to use SDK label to label to functions/methods in coding process,  pls refer next chapter.

### 7. Other Options

#### Archive with multiple package

**Protect and use multiple package template to archive package**

```shell
virboxprotector_con <apk_path> <other_options ...> 
	--mulpkg-template=<template_path> --mulpkg-outdir=<multi_package_outdir>
	[-o <output_main_apk_file>]
```

**Archive with multiple package only (no protect)**

```shell
virboxprotector_con -mulpkg <apk_path> --mulpkg-template=<template_path> -o <output_directory>
```

**To specify the signature (optional)**

For all above CLI command options, developer may specify to enable signature, pls refer the related "[Signature Options](#4.-signature-option)" respectively.

#### Merge the assemblies

Use: `-ilmerge` option to merge the assemblies:

```shell
virboxprotector_con -ilmerge <main_assembly> <other_assemblies ...> -o <output_path>
```

**Sample**

```shell
virboxprotector_con -ilmerge Project.exe MyLibrary1.dll MyLibrary2.dll -o Merged/Project.exe
```

#### Remove "Symbol table"

Use `-strip` option to remove the debugging information (Static symbol table & static string table) from ELF application

```shell
virboxprotector_con -strip <file_path> -o <output_path>
```

**Sample**

```shell
virboxprotector_con -strip libhello.so -o striped/libhello.so
```

### **8. Error code for Virbox Protector CLI tool**

<table><thead><tr><th>Error Code</th><th>Description</th><th data-hidden>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>Error（0x00000000)</td><td>Success</td><td>Success</td><td></td></tr><tr><td>Error（0x00000002）</td><td>Memory in sufficient</td><td></td><td></td></tr><tr><td>Error（0x00000003）</td><td>Configuration file error</td><td></td><td></td></tr><tr><td>Error（0x00000011）</td><td>Project has been encrypted</td><td></td><td></td></tr><tr><td>Error（0x00000012）</td><td>Failed to read file, file or file folder not found </td><td></td><td></td></tr><tr><td>Error（0x00000013）</td><td>Failed to write file, file has been occupied or no access right to write file</td><td></td><td></td></tr><tr><td>Error（0x00000021）</td><td>not found .ssp file (configuration file not found)</td><td></td><td></td></tr><tr><td>Error（0x00000022）</td><td>Configuration file error</td><td></td><td></td></tr><tr><td>Error（0x00000023）</td><td>missing the configuration file to ds plugin in the .ssp file (configuration file) or ds node in the .ssp file has been deleted.</td><td></td><td></td></tr><tr><td>Error（0x00000024）</td><td>ds plug in the .ssp file not activate (which means ds button not been switch on</td><td></td><td></td></tr><tr><td>Error（0x00000025）</td><td>password node for the ds plug in in the .ssp file missing. which means no password input or password node has been deleted.</td><td></td><td></td></tr><tr><td>Error（0x00000031）</td><td>file size too small (less 4 bytes)</td><td></td><td></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.virbox.com/fundamentals/cli-tool-user-manual/user-manual_virbox-protector-command-line.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
