SDB

SDB stands for String DataBase. It's a simple key-value database that only operates with strings created by pancake. It is used in many parts of r2 to have a disk and in-memory database which is small and fast to manage using it as a hashtable on steroids.

SDB is a simple string key/value database based on djb’s cdb disk storage and supports JSON and arrays introspection.

There’s also the sdbtypes: a vala library that implements several data structures on top of an sdb or a memcache instance.

SDB supports:

  • namespaces (multiple sdb paths)

  • atomic database sync (never corrupted)

  • bindings for vala, luvit, newlisp and nodejs

  • commandline frontend for sdb databases

  • memcache client and server with sdb backend

  • arrays support (syntax sugar)

  • json parser/getter

Usage example

Let's create a database!

$ sdb d hello=world
$ sdb d hello
world

Using arrays:

Let's play with json:

Using the command line without any disk database:

Remove the database

So what ?

So, you can now do this inside your radare2 sessions!

Let's take a simple binary, and check what is already sdbized.

The file corresponding to the sixth file descriptor is a x86_32 binary.

Strings are stored encoded in base64.

More Examples

List namespaces

List sub-namespaces

List keys

Set a key

Get the value of a key

List all syscalls

List all comments

Show a comment at given offset:

最后更新于

这有帮助吗?