dwolfe884_obsidian-x86-flow.../README.md

70 lines
2 KiB
Markdown
Raw Normal View History

2023-02-04 15:39:42 +00:00
# Obsidian X86 Flow Graph
2023-02-03 18:11:50 +00:00
2023-02-04 15:39:42 +00:00
![Obsidian File Color Banner](./docs/images/x86.png)
2023-02-03 18:11:50 +00:00
## What is this?
2023-02-04 15:39:42 +00:00
This is a plugin for [Obsidian](https://obsidian.md), that converts x86 assembly into a flow diagram using Obsidian Canvases
2023-02-03 18:11:50 +00:00
2023-02-04 15:39:42 +00:00
## Usage
2023-02-03 18:11:50 +00:00
2023-02-04 15:39:42 +00:00
This plugin adds a command called `x86-create-flow-diagram`. To use this plugin you must highlight a valid x86 code block (without the \`\`\` at the start and end) and run the command.
This plugin requires a specific format for the assembly in order to properly generate nodes and edges for the flow graph.
The key format features are as a follows:
1. All instructions must be indeneted
2. Location for jumps must have no spaces before the location name
3. jmp instruction must be used for unconditional jumps (1 branch)
4. any other instruction beginning with a j is treated as a conditional jump (2 branches)
This is an example of a valid x86 code block for use with this plugin
```x86
cmp [ebp+var_8], 1
jz loc_401027
cmp [ebp+var_8], 2
jz loc_40103D
cmp [ebp+var_8], 3
jz loc_401053
jmp loc_401058
loc_401027
Code for case 1
jmp loc_401058
loc_40103D
Code for case 2
jmp loc_401058
loc_401053
Code for case 3
loc_401058
Program end
```
running `x86-create-flow-diagram` on the above codeblock would result in the following graph being produced:
2023-02-04 23:42:28 +00:00
![Sample Graph #1](./docs/images/graph2.png)
2023-02-03 18:11:50 +00:00
It won't look as nice as this at first, all of the blocks will be in a single column. You'll have to drag them around to make it look pretty. I'm working on doing this a little better...
2023-02-04 15:49:22 +00:00
### Plugin in practice
2023-02-03 18:11:50 +00:00
2023-02-04 15:49:22 +00:00
TODO: Add GIF of running plugin
2023-02-03 18:11:50 +00:00
2023-02-05 20:33:07 +00:00
![GIF of x86-create-flow-diagram](./docs/images/demo.mp4)
2023-02-03 18:11:50 +00:00
2023-02-04 15:49:22 +00:00
## Roadmap
2023-02-03 18:11:50 +00:00
2023-02-04 15:49:22 +00:00
### TODO:
2023-02-04 23:38:40 +00:00
- [x] Add true/false labels to edges
- [-] Handle \`\`\` characters on both sides of selected text
- [-] Move nodes to left or right to increase readbility (kinda)
- [ ] Insert Link to graph below codeblock
2023-02-04 15:49:22 +00:00
- [ ] Test, test, test...
2023-02-03 18:11:50 +00:00
---
<div align="center">
2023-02-04 15:49:22 +00:00
<a href="https://www.buymeacoffee.com/djwolfe">
2023-02-03 18:11:50 +00:00
<img src="https://media2.giphy.com/media/7ssLleBvWvESbx0BuG/giphy.gif" />
</a>
</div>