Using the Command Line Interface
This section describes using PreEmptive Protection - DashO as a command line program. The command line interfaces are designed to allow you to:
- Integrate DashO into your build process if you can't use the provided Ant and Gradle integrations.
- Launch the DashO GUI
- Generate a Shelf Life token
- Add a watermark to a jar.
Note:
All these tools have a--quiet
option which may help when integrating them in a large build sequence.
DashO Command Line
Executes a project from the command line.
dashocmd [options] [projectfile]
Argument | Description |
---|---|
projectfile |
DashO project file |
The command line options must begin with the '-' character.
Options | Description |
---|---|
-e , --printStackTraces |
Print stack traces for exceptions |
-f , --force |
Force execution |
--file-version |
Show project file version and exit |
-h , --help |
Display command line help |
-p , --properties <filename> |
Load system properties from a file |
-q , --quiet |
Print minimal amount of messages |
-v , --verbose |
Print verbose messages |
--version |
Show version and exit |
The projectfile
is a configuration file that is required for every run of DashO. This file contains information about what is processed (e.g. Inputs, Exclusions, Entry Points, etc).
The -e
, --printStackTraces
option will print stack traces for exceptions.
The -f
, --force
option forces execution even if DashO finds Class.forName()
methods (discussed in detail in Advanced Topics). The use of the force global option is preferred over the command line use of this option.
The --file-version
option shows the project file (.dox) version used by DashO and exits.
The -h
, --help
option displays command line help on demand.
The -p
, --properties
<filename>
option tells DashO to load system properties from the provided file.
The -q
, --quiet
option tells DashO to print a minimal amount of messages. This option overrides verbose mode.
The -v
, --verbose
option causes additional, more detailed messages to be emitted during execution.
The --version
option shows the version and license information of DashO and exits.
Note: Persistent options can be set in dashorc.
Building Projects from the Command Line
DashO can execute a project file from the command line. To do this, use:
dashocmd [options] projectfile
Multiple warnings may be emitted during the build, but the process will stop immediately with an exit code of 1 if an error is encountered.
DashOGUI Command Line
Launches the User Interface.
dashogui [options] [projectfile|mapfile]
Argument | Description |
---|---|
projectfile |
DashO project file |
mapfile |
DashO renaming map file |
The command line options must begin with the '-' character.
Options | Description |
---|---|
--clearPrefs |
DashO Reset user-based preferences |
--create <project> |
Create or re-initialize the project |
-e , --printStackTraces |
Print stack traces for exceptions |
--file-version |
Show project file version and exit |
-h , --help |
Display command line help |
-q , --quiet |
Print minimal amount of messages |
-v , --verbose |
Print verbose messages |
--version |
Show version and exit |
--wizardCreate <project/dir> |
Create or re-initialize the project using the New Project Wizard |
The projectfile
is a configuration file that will be opened.
The mapfile
is a map file that will be opened for decoding a stack trace.
The --clearPrefs
option will clear reset the user preferences.
The --create
<project>
option creates or re-initializes the specified project file.
The -e
, --printStackTraces
option will print stack traces for exceptions.
The --file-version
option shows the project file (.dox) version used by DashO and exits.
The -h
, --help
option displays command line help on demand.
The -q
, --quiet
option tells DashO to print a minimal amount of messages. This option overrides verbose mode.
The -v
, --verbose
option causes additional, more detailed messages to be emitted during execution.
The --version
option shows the version and license information of DashO and exits.
The --wizardCreate
<project/dir>
option will launch the New Project Wizard and default it to the provided directory.
Notes:
Persistent options can be set in dashorc.
If running from Windows, options like--version
and--help
will not appear to work because the output will not display in the console.
ConvertMap
A conversion utility ConvertMap.jar
is provided to convert the mapfile
to a format suitable for upload to analytics services for decoding stack traces.
Run java -jar ConvertMap.jar --help
at a command-line to see the options available for the utility.
DashO Configuration
A resource script, either dashorc.bat
(Windows) or dashorc
(other platforms) is installed in DashO's installation directory.
This file can be used to pass specific options every time dashocmd
, dashogui
, premark
, and tokengenerator
are executed.
You may alter this copy to affect the settings used by all users of DashO.
You can also copy the file into your home directory and customize the settings just for yourself.
Please note that on macOS and Linux, it should be renamed to .dashorc
when you place it in your home directory.
The options available are:
javaOptions
- Arguments always passed to the JVM (e.g.javaOptions=-verbose:gc
).memoryStart
- The initial heap size (e.g.memoryStart=512m
).memoryMax
- The maximum heap size (e.g.memoryMax=2048m
).stackSize
- The stack size (e.g.stackSize=1m
).options
- Arguments always passed todashocmd
,dashogui
,premark
, andtokengenerator
(e.g.options=--verbose --printStackTraces
).DASHO_JAVA_HOME
- The path to a specific Java installation, under which the tool will run. For example:C:\Program Files\Java\jdk-9.0.4
for Windows/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
for macOS/usr/java/jdk-9.0.4
for Linux
Note:
These options will not affect the native launcher used on macOS.
Shelf Life TokenGenerator
You can use the TokenGenerator tool to create Shelf Life tokens.
tokengenerator [options]
The command line options must begin with the '-' character.
Options | Description |
---|---|
-d , --date <date> |
Expiration date (MM/DD/YYYY) |
-e , --printStackTraces |
Print stack traces for exceptions |
-f , --file <token-file> |
The token file |
-h , --help |
Display command line help |
-k , --key <key-file> |
Shelf Life key file |
-p , --property <name=value> |
Token property |
--period <days> |
Expiration period |
--print |
Print a token file |
-q , --quiet |
Print minimal amount of messages |
-v , --verbose |
Print verbose messages |
-w , --warningdate <date> |
Expiration warning date (MM/DD/YYYY) |
--warningperiod <days> |
Expiration warning period |
The -d
, --date
<date>
option specifies an expiration date.
The -e
, --printStackTraces
option will print stack traces for exceptions.
The -f
, --file
<token-file>
option specifies the token file.
The -h
, --help
option displays command line help on demand.
The -k
, --key
<key-file>
option specifies the key file needed to generate a token.
The -p
, --property
<name=value>
option specifies a property to include in the token.
The --period
<days>
option specifies the number of dates past the start date (which is specified during injection).
The --print
option will print the token information.
The -q
, --quiet
option tells the TokenGenerator tool to print a minimal amount of messages. This option overrides verbose mode.
The -v
, --verbose
option causes additional, more detailed messages to be emitted during execution.
The -w
, --warningdate
<date>
option specifies the date warnings will should start.
The --warningperiod
<days>
option specifies the number of days before expiration for warnings to start.
Note: Persistent options can be set in dashorc.
Watermarking PreMark Tool
You can use the PreMark tool to add a watermark or to read the watermark. It is a command line tool to watermark a jar without needing to start DashO. Using this tool you can PreMark any jar file even if it has not been obfuscated by DashO.
premark [options] inputfile
The command line options must begin with the '-' character.
Options | Description |
---|---|
-c , --charmap <charmap> |
Character map name (6bit-a , 6bit-b , 7bit-a , 4bit-a , utf8 ) |
-e , --printStackTraces |
Print stack traces for exceptions |
-h , --help |
Display command line help |
-m , --mark <watermark> |
Add watermark |
-o , --output <file> |
Output file |
-p , --passphrase <passphrase> |
Passphrase to encrypt/decrypt watermark string |
-q , --quiet |
Print minimal amount of messages |
-r , --read |
Read watermark |
-t , --truncate |
Truncate watermark if too big (default: fail) |
-v , --verbose |
Print verbose messages |
--version |
Show version and exit |
The -c
, --charmap
<charmap>
option tells the PreMark tool which character map encoding should be used to embed the watermark string in the given input jar.
The -e
, --printStackTraces
option will print stack traces for exceptions.
The -h
, --help
option displays command line help on demand.
The -m
, --mark
<watermark>
option watermarks the given input jar with the specified watermark string.
The -o
, --output
<file>
option allows you to specify the path to the watermarked output jar.
The -p
, --passphrase
<passphrase>
option sets the passphrase. The PreMark tool uses this passphrase to encrypt or decrypt the watermark string.
The -q
,--quiet
option tells the PreMark tool to print a minimal amount of messages. This option overrides verbose mode.
The -r
, --read
option reads the watermark string from the specified input file.
The -t
, --truncate
option truncates the watermark string if it is too long. If this option is not specified, the default is to halt without watermarking the file.
The -v
, --verbose
option causes additional, more detailed messages to be emitted during execution.
The --version
option causes the PreMark tool to provide the version of the application and then to exit that application.
Note: Persistent options can be set in dashorc.
Ant integration
DashO can integrate directly with the Ant build system via a custom Ant task.
You will need to configure and install the ant integration using antconfig and antinstall.
Gradle Integration
DashO can integrate directly with the Gradle build system via a Gradle plugin.