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 Gradle and Ant integrations.
- Launch the DashO GUI
- Generate a Shelf Life token
- Add a watermark to a jar and read the watermark from that 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 |
---|---|
-d , --debug |
Print verbose messages with additional debug information |
-e , --printStackTraces |
Print stack traces for exceptions |
-f , --force |
Force execution (see Dynamic Class Loading for details). Force global option is preferred over this option. |
--file-version |
Show project file version and exit |
-h , --help |
Display command line help |
--license <licenseString {LicenseKey[:e-mail]}> |
Specify a DashO license |
-p , --properties <filename> |
Load system properties from a file |
--pathMap <filename> |
Use inputs and outputs from a specified path map file (Android Mode only) |
-q , --quiet |
Print minimal amount of messages. Overrides -v /--verbose and -d /--debug . |
-v , --verbose |
Print verbose (additional, more detailed) messages |
--version |
Show DashO version/license information and exit |
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 to be opened for editing. |
mapfile |
DashO Renaming map file to be opened for decoding a stack trace |
The command line options must begin with the '-' character.
Options | Description |
---|---|
--clearPrefs |
Reset user preferences |
--create <project> |
Create or re-initialize the project file |
-d , --debug |
Print verbose messages with additional debug information |
-e , --printStackTraces |
Print stack traces for exceptions |
--file-version |
Show project file version and exit |
-h , --help |
Display command line help |
--license <licenseString {LicenseKey[:e-mail]}> |
Specify a DashO license |
-q , --quiet |
Print minimal amount of messages. Overrides -v /--verbose and -d /--debug . |
-v , --verbose |
Print verbose messages |
--version |
Show DashO version/license information and exit |
--wizardCreate <project/dir> |
Create or re-initialize the project using the New Project Wizard |
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
You can configure the Java runtime environment used by DashO and its utilities.
You can also configure command-line options that will always be passed.
To do so, find dashorc.bat
(Windows) or dashorc
(macOS or Linux/GNU) in the DashO Home directory and copy it to your home directory.
(For Linux and macOS, rename the copied file to .dashorc
.)
You can specify these options:
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\AdoptOpenJDK\jdk-11.x.y
for Windows/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
for macOS/usr/java/jdk-11.x.y
for Linux
These options will be used by antconfig
, dashocmd
, dashogui
, premark
, and tokengenerator
.
Notes:
DASHO_JAVA_HOME
may also be set in the system environment.You can also modify these files in place (without renaming them), if you have filesystem rights to do so, and if you want the configuration to apply to all users of that specific installation of DashO.
Support for Proxies
If you use DashO in an environment that requires use of a proxy to access the internet, you can configure your proxy by setting the following standard Java system properties:
https.proxyHost
- Host name or IP address of the proxy server.https.proxyPort
- Port number for the proxy.https.proxyUser
- Username to use for proxy authentication.https.proxyPassword
- Password to use for proxy authentication.
These can be set in dashorc.bat
on Windows, or in dashorc
on macOS or Linux/GNU.
If your proxy does not require authentication, just specify https.proxyHost
and https.proxyPort
.
If your proxy requires basic authentication, you will need to configure all four options.
Make sure to use https
, as this is the protocol DashO uses to communicate to the license server.
https.proxyUser
and https.proxyPassword
do not appear to be supported by Java directly, according to the documentation, but these names are supported in Apache's HttpClient that DashO uses.
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> |
Specifies an expiration date (MM/DD/YYYY) |
-e , --printStackTraces |
Print stack traces for exceptions |
-f , --file <token-file> |
Specifies a token file |
-h , --help |
Display command line help |
-k , --key <key-file> |
Specifies a Shelf Life key file |
-p , --property <name=value> |
Specifies a Token property |
--period <days> |
Specifies the Expiration period, the number of days after a start date before the token expires. Start date is specified during injection. |
--print |
Print information about a token file |
-q , --quiet |
Print minimal amount of messages. Overrides -v /--verbose |
-v , --verbose |
Print verbose messages |
-w , --warningdate <date> |
Specifies an expiration warning date (MM/DD/YYYY) |
--warningperiod <days> |
Specifies an expiration warning period (number of days before expiration on which warnings should be issued). |
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 |
--license <licenseString {LicenseKey[:e-mail]}> |
Specify a DashO license |
-m , --mark <watermark> |
Instructs the tool to watermark inputfile with the specified <watermark> string. |
-o , --output <file> |
Specifies the path where the tool should output the watermarked JAR. |
-p , --passphrase <passphrase> |
Sets a passphrase to encrypt/decrypt watermark string |
-q , --quiet |
Print minimal amount of messages. Overrides -v /--verbose |
-r , --read |
Read watermark from specified inputfile and print it to the standard output. |
-t , --truncate |
Instructs the tool to truncate the watermark if it is too long. Default behavior is to error in this case. |
-v , --verbose |
Print verbose messages |
--version |
Show PreMark tool version and exit |
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 the DashO Gradle Plugin for Android or the DashO Gradle Plugins for Java.