Skip to content

Instantly share code, notes, and snippets.

View xelemental's full-sized avatar
🦅

Elemental X xelemental

🦅
View GitHub Profile
#include <iostream>
using namespace std;
void multiply(int a, int b)
{
cout << a * b << endl;
}
void multiply(double a, double b)
fn main(){
about1("Rohan", 20, "PowerPC");
about2("Kumar", "ARM");
about3("Rohit", "India");
fn about1(value : &str, age: u64, processor_choice: &str){
println!("{} is {} and he is a {} enthusiast", value, age, processor_choice);
}
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(import "env" "puts" (func $puts (param i32) (result i32)))
(table 0 anyfunc)
(memory $0 1)
(data (i32.const 16) "My first program in WASM\00")
(export "memory" (memory $0))
(export "main" (func $main))
(func $main (; 1 ;) (result i32)
(drop
(module
(type (;0;) (func (param i32 i32 i32) (result i32)))
(type (;1;) (func (param i32) (result i32)))
(type (;2;) (func (result i32)))
(type (;3;) (func (param i32)))
(type (;4;) (func))
(type (;5;) (func (param i32 i32) (result i32)))
(type (;6;) (func (param i32 i64 i32) (result i64)))
(type (;7;) (func (param i32 i64 i64 i32)))
(type (;8;) (func (param i32 i32 i32 i32 i32) (result i32)))

Command line options

-L: List of supported IO plugins
-q: Exit after processing commands
-w: Write mode enabled
-i [file]: Interprets a r2 script
-A: Analyze executable at load time (xrefs, etc)
-n: Bare load. Do not load executable info as the entrypoint
-c 'cmds': Run r2 and execute commands (eg: r2 -wqc'wx 3c @ main')
-p [prj]: Creates a project for the file being analyzed (CC add a comment when opening a file as a project)
  • Variables:

                      var = For defining variables
                  mov = move a value from place to another
                $RESULT = Stores the Result of an operation
    
  • Conditional Jumps:

                      JNE = Jump if not equal
    
- Run the code :F9
- Step into/ over instructions: F7/F8
- Execute until selecyted instruction : F4
- Execute until next return : Ctrl + F9
- Show Previous/next executed instructions: -/+
- Return to previous view : *
- Go to specific expression: Ctrl+g
- Insert comment/label : ;/;
- Show current function as a graph : g
- Find Specific pattern : Ctrl + b
  • Breakpoints
 → break <address> : Sets a new breakpoint
→ delete <breakpoint#> : Deletes a breakpoint
→ enable < breakpoint#> : Enable a disabled breakpoint
  • Variables and memory display
→ print <query> : Prints content of variable or register.
→ display : Prints the information after stepping each instruction

Navigation:

→ Back : Alt + <-
→ Forward : Ctrl + Alt + T
→ Next Instruction : Ctrl + Alt + I
→ Next Data : Ctrl + Alt + D
→ Next Undefined : Ctrl + Alt + U 
→ Next Label : Ctrl + Alt + U
→ Next Function : Ctrl + Alt + F
→ Previous function: Ctrl + ⬆️