If JRE(over 7 update 40) is already installed, you can skip this step
Task | Description |
---|---|
Purpose | To use Dexter CLI |
Version | Over Java 7 update 40 |
Download | https://java.com/download (Java 7: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) |
System Variables | Refer to : http://docs.oracle.com/javase/7/docs/webnotes/install/ For Windows, you must set "JAVA_HOME" to the directory where the JRE is installed and PATH environment variables to point to "%JAVA_HOME%\bin". |
Verify | Type "java -version" on the command line to verify the installation and version(over 7_40). |
You need to download the following zip file : [ Dexter Download Page ]
The downloaded file should be unzipped into a directory wherever you want to put it in.
example:
###### Windows CLI(32 or 64 bit) C:/dexter-cli_#.#.#_64 ###### LINUX CLI /usr/local/share/dexter-cli_#.#.#_64 ###### You have already run Dexter-daemon in local, you can find "dexter_cfg.json" file as below path. ###### Dexter-Daemon %DEXTER_DAEMON_INSTALLATION_DIR%\dexter-daemon_#.#.#_64\dexter-home\bin |
Folders and files after unzip:
Dexter Home | Sub Folder | File | Description |
---|---|---|---|
dexter-cli_#.#.#_32/64 | It is the Dexter CLI Home folder. It must be defined in the dexter_cfg.json file. | ||
bin | The Executable files are in this folder. | ||
create-user.bat | It is an executable file for account creation on Windows OS. | ||
create-user.sh | It is an executable file for account creation on Linux. | ||
dexter-executor.jar | It contains the Dexter CLI components. (jar file) It is dexter-executor to find bugs in file | ||
dexter_cfg.json | This file is used by dexter-executor_#.#.#.jar to define the scope of analysis. | ||
dexter_cfg.json.help | It is an example file of dexter_cfg.json. You can refer to this file to write the dexter_cfg.json file. | ||
dexter.bat | It is an executable file for windows OS. | ||
dexter.sh | It is an executable file for LINUX OS. You have to change the file mode before executing it. | ||
dexter2.bat | It is an executable file with run command option for windows OS. | ||
dexter2.sh | It is an executable file with run command option for LINUX OS. You have to change the file mode before executing it. | ||
plugin | This folder contains plug-in files for the static analysis. | ||
dexter-cppcheck_#.#.#.jar | It is dexter-cppcheck to find bugs in file | ||
dexter-findbugs_#.#.#.jar | It is dexter-findbugs to find bugs in file |
The maximum file size which can be analyze is 2megabytes. Dexter-cli do not analyzed by File size( > 2MB) to improve performance. ▶ A large files can be difficult for co-workers to modify code and for developers to understand. |
To execute Dexter CLI, the only thing you have to do is to define the dexter_cfg.json file.
C/C++ example:
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982" "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject", "sourceDir":["C:/PRJ/workspace/MyProject/src/test"], "headerDir":["C:/PRJ/workspace/MyProject/src/"], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":[], "binDir":"", "modulePath":"", "fileName":["main.cpp"], "type":"FILE" } |
Java example:
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982", "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject", "sourceDir":["C:/PRJ/workspace/MyProject/src/java"], "headerDir":[], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":["C:/PRJ/workspace/MyProject/lib1","C:/PRJ/workspace/MyProject/lib2"], "binDir":"C:/PRJ/workspace/MyProject/bin", "type":"FILE", "modulePath":"package1.package2", "fileName":["Test1.java","Test2.java"] } |
Note : These attributes are case-sensitive.
You can make a list of a target file or files to analyze
You can analyze a whole project
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982", "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject/src/test", "sourceDir":["C:/PRJ/workspace/MyProject/src/test/src"], "headerDir":["C:/PRJ/workspace/MyProject/src/test/src"], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":[], "binDir":"", "type":"PROJECT" } |
You can make a snapshot of a special day to analyze changes
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982", "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject", "sourceDir":["C:/PRJ/workspace/MyProject/src/test","C:/PRJ/workspace/MyProject/src/java"], "headerDir":[], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":["C:/PRJ/workspace/MyProject/lib1","C:/PRJ/workspace/MyProject/lib2"], "binDir":"C:/PRJ/workspace/MyProject/bin", "type":"SNAPSHOT", } |
example:
###### EXAMPLE COMMAND : create-user.bat gildong.hong pa$$word localhost 4982 ###### Windows : C:/dexter-cli_#.#.#_64 > create-user.bat SINGLE_ID PASSWORD SERVER_IP SERVER_PORT ###### LINUX root@linux:~# create-user.sh SINGLE_ID PASSWORD SERVER_IP SERVER_PORT |
example:
###### EXAMPLE LOG C:\dexter_v#.#.#\bin>create-user.bat gildong.hong pa$$word localhost 4982 C:\dexter_v#.#.#\bin>java -Xms256m -Xmx786m -XX:MaxPermSize=256m -jar dexter-executor.jar -c -u gildong.hong -p pa$$word -h localhost -o 4982 // This is automatically execute command. ===== Starting Dexter Analysis ===== Your account is created: gildong.hong |
After configuring the dexter_cfg.json file, you can run Dexter CLI for static analysis.
example:
###### Windows C:\> cd dexter-cli_#.#.#_64\bin C:\dexter_cli_64_#.#.#\bin> dexter.bat my_id my_password (If you use 32bit OS, folder name can be 'dexter-cli_32_#.#.#') ###### LINUX root@/usr/share# cd dexter-cli_#.#.#_64/bin root@/usr/share/dexter_cli_64_#.#.#/bin# chmod +x dexter.sh root@/usr/share/dexter_cli_64_#.#.#/bin# ./dexter.sh my_single_id my_password (If you use 32bit OS, folder name can be 'dexter-cli_#.#.#_32') ###### You can use dexter2.bat(for window), dexter2.sh(for linux) with option as below. ###### Windows C:\dexter_cli_64_#.#.#\bin> dexter2.bat -u singleId -p password -a ###### LINUX root@/usr/share/dexter_cli_64_#.#.#/bin# dexter2.sh -u singleId -p password -a |
Options
Option | Run Dexter Command | Explanation |
-a | Asynchronous Analysis | Asynchronous Analysis. It is faster than synchronous. No Result Log and File(Check on Dexter WEB) |
-e | Enable only specified checker | Enable only specified checker(s), checkercode1;checkercode2:language:toolname;... eg) -e nullpointer;initializerlist:CPP:cppcheck |
-f | Analysis Configuration File in another directory | Analysis Configuration File. eg) -f C:/dexter/dexter_cfg.json |
-j | Create Json result file | Create Json result file - dexter-result.json. |
-p | Password | User Password. eg) -p password |
-s | Standalone. Run Dexter Analysis without DexterServer | Standalone. Run Dexter Analysis without DexterServer. you don't need log in(id & password) eg) -s |
-t | Target source code file names and paths | Target source code file names and paths. eg) -t C:/myproject/src/main.cpp;C:/myproject/src/util.cpp |
-u | User Id | User ID. eg) -u id |
-x | Create XML result file | Create XML result file - dexter-result.xml. eg) -x |
-X | Create XML result file with Timestamp | Create XML result file with timestamp - dexter-result_yyyyMMddhh:mm:ss.xml. eg) -X |
Result example:
analyzed : D:/DexterTest/src/debgub-main/comoss-debugmenu.cpp not supported file : Log.txt *** Summary of Results * Total Defects: 11 * Critical Defects : 2 * Major Defects: 2 * Minor Defects : 4 * CRC Defects : 0 * Etc Defect :3 * Check Dexter web site in detail : http://localhost:4982/defect *** End Of Dexter Analysis *** (94 seconds) |
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982", "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject", "sourceDir":["C:/PRJ/workspace/MyProject/src/test","C:/PRJ/workspace/MyProject/src/java"], "headerDir":[], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":["C:/PRJ/workspace/MyProject/lib1","C:/PRJ/workspace/MyProject/lib2"], "binDir":"C:/PRJ/workspace/MyProject/bin", "type":"FILE", "modulePath":"package1.package2", "fileName":["Test1.java","Test2.java"] } |
{ "dexterHome":"C:/dexter-cli_#.#.#_64", "dexterServerIp":"123.123.123.123", "dexterServerPort":"4982", "projectName":"ProjectName", "projectFullPath":"C:/PRJ/workspace/MyProject", "sourceDir":["C:/PRJ/workspace/MyProject/src/test","C:/PRJ/workspace/MyProject/src/java"], "headerDir":[], // [Caution] If there is no need a header file to analyze, you must remove this line. "sourceEncoding":"UTF-8", "libDir":["C:/PRJ/workspace/MyProject/lib1","C:/PRJ/workspace/MyProject/lib2"], "binDir":"C:/PRJ/workspace/MyProject/bin", "type":"FILE", "modulePath":"package1.package2", "fileName":["Test1.java","Test2.java"] } |