From 800595125d1849c9feb5c8a30077ae77bfb66fa9 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Tue, 11 Oct 2016 00:20:58 +0800 Subject: [PATCH] cstool: update README with more details --- HACK.TXT | 5 +++++ cstool/README | 29 ++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/HACK.TXT b/HACK.TXT index 6ef9844ba..5864bff28 100644 --- a/HACK.TXT +++ b/HACK.TXT @@ -16,6 +16,7 @@ Capstone source is organized as followings. │   ├── ocaml <- Ocaml bindings + test code │   └── python <- Python bindings + test code ├── contrib <- Code contributed by community to help Capstone integration +├── cstool <- Cstool ├── docs <- Documentation ├── include <- API headers in C language (*.h) ├── msvc <- Microsoft Visual Studio support (for Windows compile) @@ -34,6 +35,10 @@ the code and try to recompile/reinstall again. This can be done with: $ ./make.sh $ sudo ./make.sh install +Then test Capstone with cstool, for example: + + $ cstool x32 "90 91" + At the same time, for Java/Ocaml/Python bindings, be sure to always use the bindings coming with the core to avoid potential incompatibility issue with older versions. diff --git a/cstool/README b/cstool/README index 139d4adc3..65479cbc8 100644 --- a/cstool/README +++ b/cstool/README @@ -1,7 +1,26 @@ -This directory contains cstool of capstone engine. -To compile, simply run "make" on commandline. And after that, you could use -./cstool [start-address-in-hex-format] -to use directly capstone engine. +This directory contains cstool of Capstone Engine. -To see options are supported, you could input ./cstool +Cstool is a command-line tool to disassemble assembly hex-string. +For example, to decode a hexcode string for Intel 32bit, run: + + $ cstool x32 "90 91" + + 0 90 nop + 1 91 xchg eax, ecx + +Cstool disassembles the input and prints out the assembly instructions. +On each line, the first column is the instruction offset, the second +column is opcodes, and the rest is the instruction itself. + +Cstool is flexible enough to accept all kind of hexcode format. The following +inputs have the same output with the example above. + + $ cstool x32 "0x90 0x91" + $ cstool x32 "\x90\x91" + $ cstool x32 "90,91" + $ cstool x32 "90;91" + $ cstool x32 "90+91" + $ cstool x32 "90:91" + +To see all the supported options, run ./cstool