Nu-Coder Command Line Intreface
Working with Nu-Coder Command Line Intreface
Sophisticated Command Line Interface provided by Nu-Coder PHP Encoder makes encoding of PHP files as easy as it gets and as configurable as possible at the same time.
Nu-Coder can be invoked with various options entered on the Command Line. This section presents the syntax and required arguments for using Nu-Coder administration commands. The commands are case-sensitive.
nu-coder.exe [options] directory targetdir
nu-coder.exe [options] [-f] file targetfile
nu-coder.exe [options] --appendext ext fileordirectory
nu-coder.exe [options] --overwrite fileordirectory
How to encode single PHP file
You can run Nu-Coder in single file processing mode by specifying the source file and target file at the end of the command line:
nu-coder.exe [options] -f source-file target-file
When started with this command Nu-Coder will encode the source-file and save results into target-file.
Please note that some options are available in both directory and single file processing modes. For example, option --appendext <ext> is used to append <ext> at the end of source file name. This option can be used in both single file and directory processing mode and will cause Nu-Coder to append <ext> to a single file's name or to all files in the source directory respectively.
How to control the process of encoding of PHP files
Nu-Coder interface provides various options to control what the program does and how it does it. Below is the table of Administration options of Nu-Coder Command Line Interface:
|-c <PHP version>
||Specify the version of PHP scripts to be encoded. If omitted, the encoding will be done for PHP 5.1
||Perform syntax check only, do not produce any encoded content
||Do not stop on errors
||Turn off support for short php tags <? ?>
||Turn on support for asp style php tags <% %>
||Keep extended information for debugger/profiler. This option also automatically turns on --lineinfo option, which preserves line numbers information
||Preserves line numbers information
||Do not strip php-doc comments, useful for reflection
||Display this help
||Suppress all normal output
apply obfuscation before encoding.
- level 1 means that name of all local variables will be replaced with generated ones
- level 2 means advanced obfuscation, including replacement of function names and also allowing the user to choose the names to obfuscate (see -ftable option for details)
For Advanced obfuscation to work it need the information about the collection of names and their useage. This collection should be in the file specified by -ftable option. For example:
nu-coder -b2 -r --ftable myproject.nut /path/to/myprojectroot /path/to/myprojectroot_encoded
This file is typically created with -scan - see below
Scan the project and create the collection of the names for Advanced Obfuscation
nu-coder --scan --ftable /path/to/myproject.nut /path/to/myprojectroot
--scan is run to crate the file used with --ftable
||Disallow include from the files that are not encoded (Same as GUI option "Encoded files can not be included in non-encoded")
How to encode PHP files in the entire directory
You can run Nu-Coder in directory processing mode by specifying the source directory and target directory at the end of the command line:
nu-coder.exe [options] source-directory target-directory
When started with this command Nu-Coder will encode the files in source-directory and save results into target-directory.
As we mentioned before some Nu-Coder CLI options are available in both directory and single file processing modes. However there is a set of options available only in directory processing mode.
Below are the options available only for directory processing:
||Handle directories recursively
||In directory processing mode, only encode files with the extensions listed in <extlist>. Extensions should be separated with a comma, the default <extlist> is php,inc
||In directory processing mode, copy all non-php files into target-directory
|--excludecopy <directories and/or file extensions>
||if option --copyall is specified, Nu-Coder will encode all php files and copy all other files, except for those that match wildcard(s)specified with -excludecopy option
||do not encode files that match specified wildcard(s). For example it will not encode config_mysite.php if --exclude option is specified as --exclude config*.php
All other options are available in both directory and single file processing modes.
How to use License Manager generated licenses when encoding PHP files
Nu-Coder's License Manager allows you to generate license files, which will be required for your PHP application to run. Below is the table of options available to encode PHP files with license files generated by Nu-Coder License manager. The list of the options available for License Manager is described in later sections of this manual.
|-k <keyword>, --key <keyword>
||Protect encoded files with license generated with <keyword>. Generated encoded files will require appropriate license file to be loaded either in php configuration or at runtime. The license should be generated with the same keyword. Licenses generated with another keywords will be ignored
||Exclude specified files from any licensing protection
||Tells PhpExpress to automatically load the license <filename> for the file(s) encoded with this option. Otherwise license should be loaded with the call to pelm_load_license()
Please note that if
--licfile option is not used during encoding process and you still want to use licenses with your PHP applications, you need to load license as described here
Examples of using Nu-Coder\'s License Manager
The following are some examples of using Nu-Coder Command Line Interface to encode PHP files:
Encode files in the directory c:\myproject\source and all of it's subdirectories recursively and place the resulting encoded files in the directory c:\myproject\source-enc, without changing the names of the files:
nu-coder.exe -r c:\myproject\source c:\myproject\source-enc
Encode files with extension .phtml in the directory c:\myproject\source and all of it's subdirectories recursively and place the resulting encoded files in the same directory. c:\myproject\source-enc, without changing the names of the files:
nu-coder.exe -r --ext phtml c:\myproject\source
Encode single file c:\myproject\index.php and store the resulting encoded file in c:\myproject\index.php.enc:
nu-coder.exe -f c:\myproject\index.php c:\myproject\index.php.enc
Encode single file c:\myproject\index.php and append .enc to the extension of the resulting file (i.e. make it c:\myproject\index.php.enc)
nu-coder.exe --appendext .enc c:\myproject\index.php
Encode files in the directory c:\myproject\source and all of it's subdirectories recursively and place the resulting encoded files in the directory c:\myproject\source-enc, without changing the names of the files. Also copy all non-php files to c:\myproject\source-enc except for those in CVS and SVN directories and the drawings (*.dwg)
nu-coder.exe -r -copyall -excludecopy .CVS, .SVN, *.dwg c:\myproject\source c:\myproject\source-enc
Encode single file c:\myproject\index.php and obfuscate the code in it by replacing the names of the variables with generated ones
nu-coder.exe --obfuscation 1 c:\myproject\index.php