summaryrefslogtreecommitdiffstats
path: root/md/writeup/datamatch.md
blob: 874db874e65762bb2bdc5eeaa57c454b3bd513a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
title: DM - data match mini language

# DM - data match mini data language

mini language to match some data in files it could be just binary file or 
it could be some bookmarks and when data is found script output some info
about that

## Examples

### Print about position in file

Here how looks scripts to bookmark some position
```text
0x01 "byte one"
0x02 "byte two"
```
This could be used to bookmark stuff in files

### Check bytes in position

Here is example where output will tell if its 32/64bit file and with kind of
file type it is relocatable/executable/shared/core elf.

```text
0x0-0x3
	"magic number"
0x4
	if (0x01) "32 bit elf"
	if (0x02) "64 bit elf"
0x5
	if (0x01) "little endian"
	if (0x02) "big endian"
0x10
	if (0x1) "relocatable ELF"
	if (0x2) "executable ELF"
	if (0x3) "shared ELF"
	if (0x4) "Core ELF what that"

```

## Compiling

just make should work

```sh
make
```

if not then probably you dont have ragel just remove it from makefile and it
should work fine as ragel generated *.c file is allready included

## Source

```sh
git clone http://git.main.lv/cgit.cgi/dm.git
```

or 

```sh
git clone https://github.com/FreeArtMan/dm.git
```

main development site is http://main.lv and main git repo is http://git.main.lv

## Tested

| OS | Arch |
|---|---|
| Linux | 32/64bit intel |
| NetBSD | 32bit intel |

## Future

Future features will be added if there will practical demand for them if there
will be some moment when they will be really needed.

Could be added
* support for if's in the row
* add binary masks
* generation of csv table
* genrate c struct to embed in programms
* genrate other languages (lua/python/sh)
* work with pipe could cat some /dev/random or so
* support streamed data
* support comments