-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into doc-env-vars
- Loading branch information
Showing
121 changed files
with
3,699 additions
and
3,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
/* | ||
* This is simple hello_world program made for education purposes. | ||
* Licensed under CC-BY-SA 4.0 license. | ||
* | ||
* In order to compile executable run: | ||
* | ||
* gcc -o hello_world hello_world.c | ||
* | ||
*/ | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
const char *str1 = "Hello "; | ||
const char *str2 = "world!"; | ||
|
||
size_t str1_size = strlen(str1); | ||
size_t str2_size = strlen(str2); | ||
|
||
char *output = malloc(str1_size + str2_size + 1); | ||
if (output) | ||
{ | ||
strcpy(output, str1); | ||
strcat(output, str2); | ||
|
||
puts(output); | ||
free(output); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,101 @@ | ||
# Graph commands | ||
|
||
When analyzing data it is usually handy to have different ways to represent it in order to get new perspectives to allow the analyst to understand how different parts of the program interact. | ||
When analyzing data it is usually handy to have different ways to represent it in order to get new perspectives to | ||
allow the analyst to understand how different parts of the program interact. | ||
|
||
Representing basic block edges, function calls, string references as graphs show a very clear view of this information. | ||
|
||
Rizin supports various types of graph available through commands starting with `ag`: | ||
|
||
``` | ||
[0x00005000]> ag? | ||
|Usage: ag<graphtype><format> [addr] | ||
| Graph commands: | ||
| aga[format] Data references graph | ||
| agA[format] Global data references graph | ||
| agc[format] Function callgraph | ||
| agC[format] Global callgraph | ||
| agd[format] [fcn addr] Diff graph | ||
| agf[format] Basic blocks function graph | ||
| agi[format] Imports graph | ||
| agr[format] References graph | ||
| agR[format] Global references graph | ||
| agx[format] Cross references graph | ||
| agg[format] Custom graph | ||
| ag- Clear the custom graph | ||
| agn[?] title body Add a node to the custom graph | ||
| age[?] title1 title2 Add an edge to the custom graph | ||
Output formats: | ||
| <blank> Ascii art | ||
| * rizin commands | ||
| d Graphviz dot | ||
| g Graph Modelling Language (gml) | ||
| j json ('J' for formatted disassembly) | ||
| k SDB key-value | ||
| t Tiny ascii art | ||
| v Interactive ascii art | ||
| w [path] Write to path or display graph image (see graph.gv.format and graph.web) | ||
Usage: ag<?> # Analysis graph commands | ||
| aga <format>=ascii # Data reference graph | ||
| agA <format>=ascii # Global data references graph | ||
| agc <format>=ascii # Function callgraph | ||
| agC <format>=ascii # Global callgraph | ||
| agCi <format>=ascii # Inter-procedual control flow graph | ||
| agF <format>=ascii # Control flow graph (without calls) | ||
| agf <format>=ascii # Basic blocks function graph | ||
| agi <format>=ascii # Imports graph | ||
| agr <format>=ascii # References graph | ||
| agR <format>=ascii # Global references graph | ||
| ags <format>=ascii # Normal graph | ||
| agl <format>=ascii # Line graph | ||
| agx <format>=ascii # Cross-references graph | ||
| agI <format>=ascii # RzIL graph of the instruction at the current offset. | ||
| agg <format>=ascii # Custom graph | ||
| ag- # Clear the custom graph | ||
| agn[-] # Managing custom graph nodes | ||
| age[-] # Managing custom graph edges | ||
| agw <graphtype>=dataref <path> [-global] # Write to path or display graph image (see graph.gv.format) | ||
Formats: | ||
| ascii # Ascii art | ||
| cmd # rizin commands | ||
| dot # Graphviz dot | ||
| gml # Graph Modelling Language | ||
| json # json | ||
| json_disasm # json formatted disassembly | ||
| sdb # SDB key-value | ||
| interactive # Interactive ascii art | ||
``` | ||
|
||
The structure of the commands is as follows: `ag <graph type> <output format>`. | ||
|
||
For example, `agid` displays the imports graph in dot format, while `aggj` | ||
For example, `agi dot` displays the imports graph in dot format, while `agg json` | ||
outputs the custom graph in JSON format. | ||
|
||
Here's a short description for every output format available: | ||
|
||
### Ascii Art ** (e.g. `agf`) | ||
### Ascii Art (e.g. `agf`) | ||
|
||
Displays the graph directly to stdout using ASCII art to represent blocks and edges. | ||
|
||
_Warning: displaying large graphs directly to stdout might prove to be computationally expensive and will make rizin not responsive for some time. In case of doubt, prefer using the interactive view (explained below)._ | ||
_Warning: displaying large graphs directly to stdout might prove to be computationally expensive and will make Rizin | ||
not responsive for some time. In case of doubt, prefer using the interactive view (explained below)._ | ||
|
||
### Interactive Ascii Art (e.g. `agfv`) | ||
### Interactive Ascii Art (e.g. `agf interactive`) | ||
|
||
Displays the ASCII graph in an interactive view similar to `VV` which allows to move the screen, zoom in / zoom out, ... | ||
|
||
### Tiny Ascii Art (e.g. `agft`) | ||
### Graphviz dot (e.g. `agf dot`) | ||
|
||
Displays the ASCII graph directly to stdout in tiny mode (which is the same as reaching the maximum zoom out level in the interactive view). | ||
Prints the dot source code representing the graph, which can be interpreted by programs such as | ||
[graphviz](https://graphviz.gitlab.io/download/) or online viewers like [webgraphviz](http://www.webgraphviz.com/). | ||
|
||
### Graphviz dot (e.g. `agfd`) | ||
|
||
Prints the dot source code representing the graph, which can be interpreted by programs such as [graphviz](https://graphviz.gitlab.io/download/) or online viewers like [this](http://www.webgraphviz.com/) | ||
|
||
### JSON (e.g. `agfj`) | ||
### JSON (e.g. `agf json`) | ||
|
||
Prints a JSON string representing the graph. | ||
|
||
- In the case of the `f` format (basic blocks of function), it will have detailed information about the function and will also contain the disassembly of the function (use `J` format for the formatted disassembly. | ||
|
||
- In the case of the `f` format (basic blocks of function), it will have detailed information about the function and | ||
will also contain the disassembly of the function (use `J` format for the formatted disassembly). | ||
- In all other cases, it will only have basic information about the nodes of the graph (id, title, body, and edges). | ||
|
||
### Graph Modelling Language (e.g. `agfg`) | ||
### Graph Modelling Language (e.g. `agf gml`) | ||
|
||
Prints the GML source code representing the graph, which can be interpreted by programs such as [yEd](https://www.yworks.com/products/yed/download) | ||
Prints the GML source code representing the graph, which can be interpreted by programs such as | ||
[yEd](https://www.yworks.com/products/yed/download) | ||
|
||
### SDB key-value (e.g. `agfk`) | ||
### SDB key-value (e.g. `agf sdb`) | ||
|
||
Prints key-value strings representing the graph that was stored by sdb (rizin's string database). | ||
Prints key-value strings representing the graph that was stored by sdb (Rizin's string database). | ||
|
||
### R2 custom graph commands (e.g. `agf*`) | ||
### Rizin custom graph commands (e.g. `agg`) | ||
|
||
Prints rizin commands that would recreate the desired graph. The commands to construct the graph are `agn [title] [body]` to add a node and `age [title1] [title2]` to add an edge. | ||
Prints rizin commands that would recreate the desired graph. The commands to construct the graph are | ||
`agn [title] [body]` to add a node and `age [title1] [title2]` to add an edge. | ||
The `[body]` field can be expressed in base64 to include special formatting (such as newlines). | ||
|
||
To easily execute the printed commands, it is possible to prepend a dot to the command (`.agf*`). | ||
|
||
### Web / image (e.g. `agfw`) | ||
|
||
Rizin will convert the graph to dot format, use the `dot` program to convert it to a `.gif` image and then try to find an already installed viewer on your system (`xdg-open`, `open`, ...) and display the graph there. | ||
To easily execute the printed commands, it is possible to prepend a dot to the command (`.agg`). | ||
|
||
The extension of the output image can be set with the `graph.extension` config variable. Available extensions are `png, jpg, gif, pdf, ps`. | ||
### Web / image (e.g. `agw`) | ||
|
||
_Note: for particularly large graphs, the most recommended extension is `svg` as it will produce images of much smaller size_ | ||
Rizin will convert the graph to dot format, use the `dot` program to convert it to a `.gif` image and then try to find | ||
an already installed viewer on your system (`xdg-open`, `open`, ...) and display the graph there. | ||
|
||
If `graph.web` config variable is enabled, rizin will try to display the graph using the browser (_this feature is experimental and unfinished, and | ||
disabled by default._) | ||
The extension of the output image can be set with the `graph.gv.format` config variable. Available extensions are | ||
`png, jpg, pdf, ps, svg, json`. | ||
|
||
_Note: for particularly large graphs, the most recommended extension is `svg` as it will produce images of much | ||
smaller size_ |
Oops, something went wrong.