Skip to content

Commit

Permalink
Set language to more fenced code
Browse files Browse the repository at this point in the history
  • Loading branch information
prodrigestivill committed Aug 8, 2024
1 parent d7175ab commit 3a3ce7c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/analysis/code_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ Apart from predefined algorithms to identify functions there is a way to specify
a function prelude with a configuration option `anal.prelude`. For example, like
`e anal.prelude = 0x554889e5` which means

```
```x86asm
push rbp
mov rbp, rsp
```
Expand Down
5 changes: 2 additions & 3 deletions src/analysis/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,15 @@ Once the struct is linked, radare2 tries to propagate structure offset in the fu

Note sometimes the emulation may not be accurate, for example as below :

````
```x86asm
|0x000006da push rbp
|0x000006db mov rbp, rsp
|0x000006de sub rsp, 0x10
|0x000006e2 mov edi, 0x20 ; "@"
|0x000006e7 call sym.imp.malloc ; void *malloc(size_t size)
|0x000006ec mov qword [local_8h], rax
|0x000006f0 mov rax, qword [local_8h]
````
```

The return value of `malloc` may differ between two emulations, so you have to set the hint for return value manually using `ahr` command, so run `tl` or `aat` command after setting up the return value hint.

Expand Down
4 changes: 2 additions & 2 deletions src/arch/8051.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Set cpu to desired model:

After changing the cpu model, run 'aei' to initialize/reset the registers and mapped memory. For example:

````
```
e asm.cpu = 8051-generic
aei
````
```

### Address spaces and memory mapping

Expand Down
2 changes: 1 addition & 1 deletion src/commandline/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ OFFSET : assembly

This script will run the `?e ..` command in r2 and then write the string 'Hello' at 0x200 offset

```
```console
# rapatch example
:?e hello world
0x200 "Hello"
Expand Down
16 changes: 8 additions & 8 deletions src/config/evars.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Changes syntax flavor for disassembler between Intel and AT&T. At the moment, th

A boolean value to set the pseudo syntax in the disassembly. "False" indicates a native one, defined by the current architecture, "true" activates a pseudocode strings format. For example, it'll transform :

```
```x86asm
| 0x080483ff e832000000 call 0x8048436
| 0x08048404 31c0 xor eax, eax
| 0x08048406 0205849a0408 add al, byte [0x8049a84]
Expand All @@ -35,7 +35,7 @@ A boolean value to set the pseudo syntax in the disassembly. "False" indicates a

to

```
```x86asm
| 0x080483ff e832000000 0x8048436 ()
| 0x08048404 31c0 eax = 0
| 0x08048406 0205849a0408 al += byte [0x8049a84]
Expand Down Expand Up @@ -83,7 +83,7 @@ A boolean value used to replace register names with arguments or their associate

For example, if you have something like this:

```
```x86asm
| 0x080483ea 83c404 add esp, 4
| 0x080483ed 68989a0408 push 0x8049a98
| 0x080483f7 e870060000 call sym.imp.scanf
Expand All @@ -93,7 +93,7 @@ For example, if you have something like this:

This variable changes it to:

```
```x86asm
| 0x080483ea 83c404 add SP, 4
| 0x080483ed 68989a0408 push 0x8049a98
| 0x080483f7 e870060000 call sym.imp.scanf
Expand All @@ -113,13 +113,13 @@ A boolean value which substitutes pc relative expressions in disassembly. When t

For example:

```
```x86asm
0x5563844a0181 488d3d7c0e00. lea rdi, [rip + 0xe7c] ; str.argv__2d_:__s
```

When turned on, this variable lets you display the above instruction as:

```
```x86asm
0x5563844a0181 488d3d7c0e00. lea rdi, str.argv__2d_:__s ; 0x5563844a1004 ; "argv[%2d]: %s\n"
```

Expand All @@ -129,13 +129,13 @@ Boolean which shows offsets in disassembly prefixed with the name of the section

That means, from something like:

```
```x86asm
0x000067ea 488d0def0c01. lea rcx, [0x000174e0]
```

to the one below, when toggled on.

```
```x86asm
0x000067ea 488d0def0c01. lea rcx, [fmap.LOAD1.0x000174e0]
```

Expand Down
14 changes: 7 additions & 7 deletions src/emulation/esil.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,19 @@ js - jump target set

A target opcode is translated into a comma separated list of ESIL expressions.

```
```x86asm
xor eax, eax -> 0,eax,=,1,zf,=
```

Memory access is defined by brackets operation:

```
```x86asm
mov eax, [0x80480] -> 0x80480,[],eax,=
```

Default operand size is determined by size of operation destination.

```
```x86asm
movb $0, 0x80480 -> 0,0x80480,=[1]
```

Expand All @@ -202,7 +202,7 @@ The `?` operator uses the value of its argument to decide whether to evaluate th
1. Is the value zero? -> Skip it.
2. Is the value non-zero? -> Evaluate it.

```
```x86asm
cmp eax, 123 -> 123,eax,==,$z,zf,=
jz eax -> zf,?{,eax,eip,=,}
```
Expand Down Expand Up @@ -344,7 +344,7 @@ fmulp ST(1), ST(0) => TODO,fmulp ST(1),ST(0)

### ESIL Disassembly Example

```console
```x86asm
[0x1000010f8]> e asm.esil=true
[0x1000010f8]> pd $r @ entry0
0x1000010f8 55 8,rsp,-=,rbp,rsp,=[8]
Expand Down Expand Up @@ -410,14 +410,14 @@ Other operations require bindings to external functionalities to work. In this c

* Io Get/Set

```
```x86asm
Out ax, 44
44,ax,:ou
```

* Selectors (cs,ds,gs...)

```
```x86asm
Mov eax, ds:[ebp+8]
Ebp,8,+,:ds,eax,=
```
6 changes: 3 additions & 3 deletions src/tools/ragg2/ragg2.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main() {

That small C program can be compiled with ragg2 like this:

```console
```x86asm
$ ragg2 -a x86 -b32 a.c
e900000000488d3516000000bf01000000b80400000248c7c20d0000000f0531c0c348656c6c6f20576f726c640a00
Expand Down Expand Up @@ -88,7 +88,7 @@ Usage: ragg2 [-FOLsrxhvz] [-a arch] [-b bits] [-k os] [-o file] [-I path]

### First Example

```console
```x86asm
$ cat hello.r
exit@syscall(1);
Expand Down Expand Up @@ -324,7 +324,7 @@ In case you just want to execute the input, you may use the `-x` option.
-x execute (just-in-time)
```

```console
```c
$ cat code1.c
int main()
{
Expand Down

0 comments on commit 3a3ce7c

Please sign in to comment.