Skip to content

Commit

Permalink
Add more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 7, 2023
1 parent 5247617 commit cb27a1f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/disasm-poc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
all:
r2 -e cfg.fortunes=false -q -i train.r2 /bin/ls > ops.kv
cat test.txt | r2pm -r r2ai
3 changes: 3 additions & 0 deletions examples/disasm-poc/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-m Undi95/Utopia-13B-GGUF
-i ops.kv read this as bytes=disassembly for an arm64 program, and tell me how can i encode a nop
decode every bit of the mov instruction
4 changes: 4 additions & 0 deletions examples/disasm-poc/train.r2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
e asm.offset=0
e asm.flags=0
e asm.sub.names=0
pId $SS| sort -u | awk '{$1=$1;print}' | sed -e 's, ,=,'
16 changes: 16 additions & 0 deletions examples/srcdoc.r2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(function() {
const dir = r2.cmd("%SRCDIR").trim();
if (dir === "") {
console.error("Environment %SRCDIR not defined");
return;
}
const ai = new R2AI()
ai.setRole("You are developer writing documentation for Frida scripts to be read by users. Your explanation shouldn't be longer than one paragraphs");
// console.log(ai.query("Hello World"))
const files = r2.callj("ls -j " + dir);
const listing = files.map ((x) => x.name).filter((x) => x.endsWith('.ts')).map((x) => dir + '/' + x);
for (let fileName of listing) {
const desc = ai.queryFile(fileName, "explain in few words what's this probe doing").split(/\n/)[0];
console.log(fileName + ":\n " + desc);
}
})();
3 changes: 3 additions & 0 deletions examples/translator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-m Undi95/Utopia-13B-GGUF
-r act as a translator tool that takes my sentences in english and you translate it to japanese phoneme transcription instead of kanjis. this is not a conversation. you should also tell me how can i pronunce it using english phonemes
good morning

0 comments on commit cb27a1f

Please sign in to comment.