Skip to content

Commit

Permalink
Language fixes in Tools section
Browse files Browse the repository at this point in the history
  • Loading branch information
XVilka committed Aug 5, 2018
1 parent e04552a commit 7545c45
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
6 changes: 3 additions & 3 deletions tools/rahash2/encode.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can decode it by using the -D flag instead of -E.

## Encryption/Decryption

For encrypting and such check for the crypto hash plugins.
For encrypting data and check the crypto hash plugins:

```
$ rahash2 -L | grep ^c
Expand All @@ -38,9 +38,9 @@ c xor
c serpent-ecb
```

Here's an example usage to encrypt a string using rahash2.
Here's an example usage to encrypt a string using rahash2:

```
$ rahash2 -E xor -S s:password -s hello | hexdump -C
00000000 18 04 1f 1f 18
```
```
2 changes: 1 addition & 1 deletion tools/rahash2/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The rabin2 tool parses the binary headers of the files, but it also have the abi
$ rabin2 -K md5 -S /bin/ls
```

## Obtaining Hashes within Radare2 Session
## Obtaining hashes within radare2 session

To calculate a checksum of current block when running radare2, use the `ph` command. Pass an algorithm name to it as a parameter. An example session:

Expand Down
17 changes: 9 additions & 8 deletions tools/rasm2/assemble.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Assembling is the action to take a computer instruction in human readable form (using mnemonics) and convert that into a bunch of bytes that can be executed by a machine.

In r2, the assembler and disassembler logic is implemented in the r_asm API, and can be used with the pa and pad commands from the commandline as well as using `rasm2`.
In radare2, the assembler and disassembler logic is implemented in the r_asm_* API, and can be used with the pa and pad commands from the commandline as well as using `rasm2`.

Which can be used to quickly copy-paste hexpairs that represent a given machine instruction. The following line is assembling this mov instruction for x86/32.
Rasm2 can be used to quickly copy-paste hexpairs that represent a given machine instruction. The following line is assembling this mov instruction for x86/32.

```
$ rasm2 -a x86 -b 32 'mov eax, 33'
Expand All @@ -18,11 +18,11 @@ $ echo 'push eax;nop;nop' | rasm2 -f -
5090
```

As you have seen, rasm2 can assemble one or many instructions. In line by separating them with a semicolon ;, but can also read that from a file, using generic nasm/gas/.. syntax and directives. You can check the rasm2 manpage for more details on this.
As you have seen, rasm2 can assemble one or many instructions. In line by separating them with a semicolon `;`, but can also read that from a file, using generic nasm/gas/.. syntax and directives. You can check the rasm2 manpage for more details on this.

The pa and pad are subcommands of print, which means that they will only print (assembly or disassembly). But if you want to actually write the instruction you may want to use wa or wx (with the bytes appended)
The `pa` and `pad` are a subcommands of print, what means they will only print assembly or disassembly. In case you want to actually write the instruction it is required to use `wa` or `wx` commands with the assembly string or bytes appended.

The assembler understands the following input languages and their flavors: x86 (Intel and AT&T variants), olly (OllyDBG syntax), powerpc (PowerPC), arm and java. For Intel syntax, rasm2 tries to mimic NASM or GAS.
The assembler understands the following input languages and their flavors: `x86` (Intel and AT&T variants), `olly` (OllyDBG syntax), `powerpc` (PowerPC), `arm` and `java`. For Intel syntax, rasm2 tries to mimic NASM or GAS.

There are several examples in the rasm2 source code directory. Consult them to understand how you can assemble a raw binary file from a rasm2 description.

Expand Down Expand Up @@ -81,8 +81,9 @@ Now we can assemble it in place:

### Visual mode

The visual mode of radare2. Accesible thru the V command have the A key that inserts assembly in the current offset.
Assembling also is accessible in radare2 visual mode through pressing `A` key to insert the assembly in the current offset.

The cool thing of writing assembly using the visual assembler interface is that the changes are done in memory until you press enter.
The cool thing of writing assembly using the visual assembler interface that the changes are done in memory until you press enter.

So you can check the size of the code and which instructions is overlapping before commiting the changes.

So you can check the size of the code and which instructions is overlapping before commiting the changes.
8 changes: 4 additions & 4 deletions tools/rasm2/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

The assembler and disassembler have many small switches to tweak the output.

Those configurations are available thru the e command. Here there are the most common ones.

Use the e??asm. For more details.
Those configurations are available through the `e` command. Here there are the most common ones:

* asm.bytes - show/hide bytes
* asm.offset - show/hide offset
* asm.lines - show/hide lines
* asm.ucase - show disasm in uppercase
* ...
* ...

Use the `e??asm.` for more details.
12 changes: 6 additions & 6 deletions tools/rasm2/disassemble.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
## Disassembler

Disassembling is the inverse action of assembling. It takes an hexpair as input (but can also take a file in binary form) and show the human readable form.
Disassembling is the inverse action of assembling. Rasm2 takes hexpair as an input (but can also take a file in binary form) and show the human readable form.

To do this we can use the -d option of rasm2 like this:
To do this we can use the `-d` option of rasm2 like this:

```
$ rasm2 -a x86 -b 32 -d '90'
nop
```

Rasm2 also have the -D flag to show the disarm like -d does, but includes offset and bytes
Rasm2 also have the `-D` flag to show the disassembly like `-d` does, but includes offset and bytes.

In r2, there are many commands to perform a disassembly from a specific place in memory.
In radare2 there are many commands to perform a disassembly from a specific place in memory.

Those are some, you may probably be interested in trying if you want different outputs for later parsing with your scripts, or just grep to find what you are looking for:
You might be interested in trying if you want different outputs for later parsing with your scripts, or just grep to find what you are looking for:

### pd N

Expand All @@ -29,4 +29,4 @@ Disassemble all instructions (seeking 1 byte, or the minimum alignment instructi

## pi, pI

Same as pd and pD, but using a simpler output.
Same as `pd` and `pD`, but using a simpler output.
2 changes: 1 addition & 1 deletion tools/rasm2/intro.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rasm2

`rasm2` is an inline assembler/disassembler. Initially, `rasm` tool was designed to be used for binary patching. It is main function is get bytes corresponding to given machine instruction opcode.
`rasm2` is an inline assembler/disassembler. Initially, `rasm` tool was designed to be used for binary patching. Its main function is to get bytes corresponding to given machine instruction opcode.

```
$ rasm2 -h
Expand Down

0 comments on commit 7545c45

Please sign in to comment.