radareorg / r2ai

local language model for radare2
https://www.radare.org
MIT License
104 stars 17 forks source link

[WIP] Auto mode #3

Closed dnakov closed 9 months ago

trufae commented 9 months ago

theres also this PoC https://github.com/radareorg/r2ai/blob/master/examples/funcall.py

and this https://local-llm-function-calling.readthedocs.io/en/latest/generation.html

but im also fine to merge it liek this and introduce local function calling later in a separate pr

dnakov commented 9 months ago

let me just clean a few things up on Monday and we can release it as first pass, has all the functionality r2d2 has already

trufae commented 9 months ago

Cool! yeah i see that r2d2 auto mode is really cool i did some tests few days ago changing the prompt to give some hints about how to use r2frida, pdg, and other commands in a better way and the results were amazing. So im looking forward to use the gemma model as well as other local models like the phi ones with vectordb containing all those hints. Personally i never tried this internal function calling feature outside a basic PoC, and your r2d2 just make the magic happen here :) good work!

dnakov commented 9 months ago

Take a look at this paper: https://arxiv.org/pdf/2402.11814.pdf They did something similar but using just ghidra decompile and disassembly. GPT-4 solved like over 50% of the CTFs with just looking at the code and i think generating code to find the flag.

With r2, in my tests, it can often correctly set breakpoints, read memory and modify instructions to bypass whatever it needs. We could take this a lot further

dnakov commented 9 months ago

I think it's ok right now, lmk if you want me to change anything. I'll switch to figuring out support for local models.