* Added Genie examples in the vapi test directory
This commit is contained in:
parent
1275f31e07
commit
a8a661947c
5 changed files with 44 additions and 12 deletions
|
|
@ -10,24 +10,24 @@ namespace Radare.Search {
|
|||
STRING,
|
||||
AES
|
||||
}
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_search_t", free_function="r_search_free", cprefix="r_search_")]
|
||||
public class State {
|
||||
public State(Mode mode);
|
||||
public bool set_mode(Mode mode);
|
||||
public bool set_string_limits(uint32 min, uint32 max);
|
||||
public class Searcher {
|
||||
public Searcher (Mode mode);
|
||||
public bool set_mode (Mode mode);
|
||||
public bool set_string_limits (uint32 min, uint32 max);
|
||||
public bool begin();
|
||||
//public bool set_callback(delegate callback, pointer user);
|
||||
public bool update(out uint64 from, uint8 *buf, uint32 len);
|
||||
public bool update_i(uint64 from, uint8 *buf, uint32 len);
|
||||
public bool update(out uint64 from, uint8 *buf, long len);
|
||||
public bool update_i(uint64 from, uint8 *buf, long len);
|
||||
public bool kw_add(string kw, string binmask);
|
||||
public bool kw_add_hex(string kw, string binmask);
|
||||
public bool kw_add_bin(string kw, uint32 kw_len, string binmask, uint32 bm_len);
|
||||
public bool kw_add_bin(string kw, uint32 kw_len, string binmask, long bm_len);
|
||||
public bool kw_list();
|
||||
public int set_callback(Search.Callback cb, void *user);
|
||||
public int set_callback(Radare.Search.Callback cb, void *user);
|
||||
}
|
||||
|
||||
|
||||
[Compact]
|
||||
[CCode (cname="struct r_search_kw_t")]
|
||||
public struct Keyword {
|
||||
|
|
@ -41,5 +41,5 @@ namespace Radare.Search {
|
|||
public uint32 count;
|
||||
}
|
||||
|
||||
public static delegate int Callback(Search.Keyword s, void *user, uint64 addr);
|
||||
public static delegate int Callback(Radare.Search.Keyword s, void *user, uint64 addr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
all: core hash sc socket asm search bin
|
||||
@true
|
||||
|
||||
genie:
|
||||
valac --vapidir=.. --pkg r_asm --pkg libr asm.gs
|
||||
valac --vapidir=.. --pkg r_search --pkg libr search.gs
|
||||
|
||||
sc:
|
||||
valac -C --vapidir=${PWD}/.. sc.vala --pkg r_syscall
|
||||
gcc sc.c `pkg-config gobject-2.0 --libs --cflags` -I../../include/ -lr_syscall -Wl,-R../../syscall -L../../syscall -o sc
|
||||
|
|
|
|||
18
libr/vapi/t/asm.gs
Normal file
18
libr/vapi/t/asm.gs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
uses
|
||||
Radare
|
||||
|
||||
init
|
||||
var st = new Asm()
|
||||
st.set("asm_x86_olly")
|
||||
st.set_syntax(Asm.Syntax.INTEL)
|
||||
st.set_bits(32)
|
||||
st.set_big_endian(false)
|
||||
st.set_pc(0x8048000)
|
||||
|
||||
/* Disassembler test */
|
||||
op : Radare.Asm.Aop
|
||||
var buf = "\x83\xe4\xf0"
|
||||
st.disassemble(out op, buf, 3)
|
||||
print "opcode: %s", op.buf_asm
|
||||
print "bytes: %s", op.buf_hex
|
||||
print "length: %d", op.inst_len
|
||||
10
libr/vapi/t/search.gs
Normal file
10
libr/vapi/t/search.gs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
uses
|
||||
Radare.Search
|
||||
|
||||
init
|
||||
var s = new Searcher(Mode.KEYWORD)
|
||||
s.kw_add("lib", "")
|
||||
s.begin()
|
||||
|
||||
var str = "foo is pure lib"
|
||||
s.update_i(0, str, str.len())
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
/* radare - LGPL - Copyright 2009 pancake<nopcode.org> */
|
||||
|
||||
using Radare;
|
||||
using Radare.Search;
|
||||
|
||||
public class SearchExample
|
||||
{
|
||||
public static void main(string[] args)
|
||||
{
|
||||
string buf = "liblubliuamlibfoo";
|
||||
Search.State s = new Search.State(Search.Mode.KEYWORD);
|
||||
var s = new Searcher(Mode.KEYWORD);
|
||||
s.kw_add("lib", "");
|
||||
s.set_callback(
|
||||
(kw, user, addr) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue