• Stars
    star
    211
  • Rank 180,838 (Top 4 %)
  • Language
    C
  • License
    MIT License
  • Created over 11 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple and fast string based key-value database with support for arrays and json

SDB (string database)

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

mcsdbd is a memcache server with disk storage based on sdb. It is distributed as a standalone binary and a library.

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

GHA GHA Travis Build Status

Author

pancake [email protected]

Contains

  • namespaces (multiple sdb paths)
  • atomic database sync (never corrupted)
  • bindings for vala, luvit, newlisp and nodejs
  • command-line frontend for sdb databases
  • memcache client and server with sdb backend
  • arrays support (syntax sugar)
  • json parser/getter (js0n.c)

Rips

  • disk storage based on cdb code
  • linked lists from r2 api

Compilation

For native builds just type make. Everything will be compiled twice to get the .dylib and .a and sdb in PIC and nonPIC modes.

To compile with Emscripten for Javascript:

make CC=emcc EXT_EXE=.js

To crosscompile with meson:

$ cat > cross-file.txt <<EOF
[properties]
exe_wrapper = 'wine'
and then run meson build --cross-file cross-file.txt ; ninja -C build. It should work and it should create another binary called sdb_native.
EOF
$ meson build --cross-file cross-file.txt
$ ninja -C build

Changes

I have modified cdb code a little to create smaller databases and be memory leak free in order to use it from a library.

The sdb's cdb database format is 10% smaller than the original one. This is because keylen and valuelen are encoded in 4 bytes: 1 for the key length and 3 for the value length.

In a test case, a 4.3MB cdb database takes only 3.9MB after this file format change.

Usage example

Let's create a database!

$ sdb d hello=world
$ sdb d hello
world

Using arrays (>=0.6):

$ sdb - '[]list=1,2' '[0]list' '[0]list=foo' '[]list' '[+1]list=bar'
1
foo
2

Let's play with json:

$ sdb d g='{"foo":1,"bar":{"cow":3}}'
$ sdb d g:bar.cow
3
$ sdb - user='{"id":123}' user:id=99 user:id
99

Using the command-line without any disk database:

$ sdb - foo=bar foo a=3 +a -a
bar
4
3

$ sdb -
foo=bar
foo
bar
a=3
+a
4
-a
3

Remove the database

$ rm -f d

More Repositories

1

radare2

UNIX-like reverse engineering framework and command-line toolset
C
19,483
star
2

iaito

Official QT frontend of radare2
C++
886
star
3

radare2-book

Radare2 official book
C
742
star
4

awesome-radare2

A curated list of awesome projects, articles and the other materials powered by Radare2
682
star
5

radeco

radare2-based decompiler and symbol executor
Rust
363
star
6

radare2-r2pipe

Access radare2 via pipe from any programming language!
JavaScript
352
star
7

r2ghidra

Native Ghidra Decompiler for r2
C++
300
star
8

radare2-extras

Source graveyard and random candy for radare2
C
235
star
9

r2con

Radare Congress Stuff
201
star
10

esilsolve

A python symbolic execution framework using radare2's ESIL (Evaluable String Intermediate Language)
Python
153
star
11

r2con2019

r2con2019 - slides and materials
Python
137
star
12

radare2-bindings

Bindings of the r2 api for Valabind and friends
Python
131
star
13

radare2-pm

Package Manager for Radare2
Shell
129
star
14

r2retdec

RetDec plugin for Radare2
C++
123
star
15

r2con2017

r2con 2017 September 6-9
Python
98
star
16

r2con2018

HTML
94
star
17

radare2-webui

webui repository for radare2
JavaScript
94
star
18

r2wars

Corewars but within r2
C#
46
star
19

r2pipe.rs

Rust crate for r2pipe
Rust
44
star
20

r2ai

local language model for radare2
Python
43
star
21

ghidra-r2web

Ghidra plugin to start an r2 webserver to let r2 interact with it
Java
42
star
22

libdemangle

A simple library focusing on demangling symbols for different programing languages
C
39
star
23

r2con2020

Python
36
star
24

r2pm

Radare2 cross platform package manager
Go
34
star
25

r2jp

Japanese Community of radare2
34
star
26

radare2-r2papi

High Level API on top of the R2Pipe interface
TypeScript
32
star
27

radare

advanced unix-like hexadecimal editor and debugger
C
32
star
28

r2pipe-go

Go API to interact with radare2
Go
31
star
29

acr

autoconf replacement
Shell
30
star
30

r2con2021

27
star
31

ghidra-native

C++
26
star
32

r2env

Install multiple versions of r2 and its plugins via Pip on any system!
Python
23
star
33

radare2-rust

Playground for Rust and Radare2
Rust
14
star
34

radare2-rlang

Writing Radare2 plugins in various languages
C
14
star
35

radare2-testbins

Rebol
14
star
36

radare.org

http://www.radare.org/
CSS
12
star
37

r2hexagon

Hexagon disassembler code generator from the official instruction manual.
C
12
star
38

esil-rs

Radare2's ESIL in Rust
Rust
11
star
39

r2con2016

r2con2016 repository
C
10
star
40

r2diaphora

Binary Diffing tool ported to radare2
Python
9
star
41

radare2-gsoc-windows

Various Brainstorming/scripts/ideas/etc. for the GSOC-Windows Task
C
9
star
42

r2yara

yara and radare2, better together
C
9
star
43

ragui

Vala
8
star
44

radare2-release

Releasing is hard
Shell
7
star
45

blog

The radare2 blog, available on radare.today
Shell
6
star
46

r2pipe-codeshare

A place to share your radare2 scripts
Python
6
star
47

r2app

Electron Desktop App for Radare2
JavaScript
5
star
48

radare2-win-installer

Windows installer scripts for radare2
Inno Setup
5
star
49

r2r-go

Go
5
star
50

radareorg

New amazing website for radare.org
Python
4
star
51

radare2-fuzz

Python
4
star
52

ideas

4
star
53

node-r2r

radare2 regressions testsuite in nodejs
JavaScript
3
star
54

iaito-translations

Makefile
3
star
55

.github

Radare Organization Templates
3
star
56

r2pm-db

Radare2 package manager database
3
star
57

r2shell

C
2
star
58

infrastructure

Terraform, Nomad, Consul and Vault configuration of radare infrastructure
Dockerfile
2
star
59

radare2-skel

Sample radare2 project templates
C
2
star
60

radare2-snap

Radare2 snap and docker repository
Dockerfile
2
star
61

radare2-fuzztargets

Makefile
1
star
62

r2r-v

R2 regressions testsuite written in V
V
1
star
63

radeco-regressions

Regresion tests for radeco
Rust
1
star
64

radare2-sigs

Zignature masm32 repository
Python
1
star
65

r2sarif

JavaScript
1
star