frida / frida-tools

Frida CLI tools
Other
348 stars 97 forks source link

Feature: quick, customizable command in REPL #104

Open regomne opened 2 years ago

regomne commented 2 years ago

I'm developing a feature called "quick command" in frida REPL, like:

[Local::a.exe ]-> .d 401000 10
           0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF
00401000  55 8b ec 81 c4 fc fe ff ff 8b 45 0c 83 f8 01 75  U.........E....u

The quick cmd starts with '.' (same as nodejs REPL), and can be customized dynamically by the javascript loaded.

For example, register a new quick cmd 'u' in agent.js :

REPL.register_quick_cmd(
    'u', // the quick cmd
    1, // at least 1 argument
    function disasm(addr, inst_cnt = 10) { ... } // target function
)

Which can be used in REPL:

[Local::a.exe ]-> .u 401000
00401000    push ebp
00401001    mov ebp, esp
00401003    add esp, 0xfffffefc
00401009    mov eax, dword ptr [ebp + 0xc]
0040100C    cmp eax, 1
0040100F    jne 0x401028
00401011    push dword ptr [0x403864]
00401017    push 1
00401019    push 0x466
0040101E    push dword ptr [ebp + 8]

I have not contributed to this project yet, and would like to know if it is possble to make a pull request for this feature directly?

oleavr commented 2 years ago

Ahh, love it! :fire: Please feel free to open a PR on this repo (frida-tools).