An open API service indexing awesome lists of open source software.

https://github.com/hanilr/variation-bin

Single-header binary analysis library. Written in ansi-c
https://github.com/hanilr/variation-bin

ansi-c binary binary-analysis c single-header single-header-lib single-header-library

Last synced: 24 days ago
JSON representation

Single-header binary analysis library. Written in ansi-c

Awesome Lists containing this project

README

        

# Variation: Binary

Variation Binary is single-header binary analysis library. Written in Ansi-c which means `c89` standard version.

> Libraries are written in the ANSI-C standard because the user must be able to use them both in the C89 standard and in higher standards.

Dependencies

* `gcc` _> Gnu Compiler Collection_

* `make` _> Gnu Make_

> In Windows, you should have mingw and gnu make programs. In Linux, you can install easly in teminal via package managers.

### Important Note

You need to define `#define VN_BIN_IMPLEMENTATION` before `#include "vn_bin.h"`

```c
#define VN_BIN_IMPLEMENTATION
#include "vn_bin.h"
```

If you installed the library then you should do like this.

```c
#include
```

> You can see examples in `demo/` folder.

### Example

```c
#include

#define VN_BIN_IMPLEMENTATION
#include "vn_bin.h"

int main(void) {
enum Bin_S S_4 = 4;
enum Bin_S S_8 = 8;
enum Bin_S S_16 = 16;
enum Bin_S S_32 = 32;
enum Bin_S S_64 = 64;
enum Bin_S S_128 = 128;

struct Bin_T Bin[6];
int num[6] = {3, 7, 15, 31, 63, 127};

Bin[0] = vn_int_to_bin(S_4, num[0]);
Bin[1] = vn_int_to_bin(S_8, num[1]);
Bin[2] = vn_int_to_bin(S_16, num[2]);
Bin[3] = vn_int_to_bin(S_32, num[3]);
Bin[4] = vn_int_to_bin(S_64, num[4]);
Bin[5] = vn_int_to_bin(S_128, num[5]);

bin_print(S_4, Bin[0]);
bin_print(S_8, Bin[1]);
bin_print(S_16, Bin[2]);
bin_print(S_32, Bin[3]);
bin_print(S_64, Bin[4]);
bin_print(S_128, Bin[5]);

return 0;
}
```

### Shared-Library and Default-Library

> Show make list with `make` or `make run` commands.

```bash
make run
```

Compile as Shared-Library

```bash
make compile
```

> This command only compile as `.so` and its for Linux only.

> You can clean compile files with this command.
> ```bash
> make clean
> ```

Using as Default Library

```bash
make install
```

> You can find in /usr/include/vn/

> You can uninstall with this command.
> ```bash
> make uninstall
> ```

You can take a look to wiki page if you want learn more

#### Check Other Variation Libraries

* [Variation: User Interface](https://github.com/hanilr/variation-ui) - A terminal user interface in Ansi-C with widgets.

* [Variation Lite: User Interface](https://github.com/hanilr/variation-lite-ui) - A terminal user interface in Ansi-C with optimize code and no widgets.