Skip to content

Commit

Permalink
Add Node.js bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott authored Sep 30, 2024
1 parent 7fe2faf commit 68b835a
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Zen Internals library.
Zen Internals is a library that can be used via FFI in different languages. Contains vulnerability code, like :
- Shell Injection (WIP)
- SQL Injection
Zen Internals is a library that can be used via FFI in different languages. Contains algorithms to detect:
- Shell Injections (WIP)
- SQL Injections

## Python FFI Example code :
```py
Expand All @@ -13,4 +13,31 @@ if __name__ == "__main__":
userinput = "whoami".encode("utf-8")
result = zen_internals.detect_shell_injection(command, userinput)
print("Result", bool(result))
```
```

## Node.js bindings

### Install

```bash
$ npm install @aikidosec/zen-internals
$ yarn add @aikidosec/zen-internals
```

### API

#### SQL injection detection

```js
const { wasm_detect_sql_injection } = require("@aikidosec/zen-internals");

const detected = wasm_detect_sql_injection(
`SELECT * FROM users WHERE id = '' OR 1=1 -- '`,
`' OR 1=1 -- `,
9 // MySQL dialect
);

console.log(detected); // true
```

See [list of dialects](https://github.com/AikidoSec/zen-internals/blob/main/src/sql_injection/helpers/select_dialect_based_on_enum.rs#L18)

0 comments on commit 68b835a

Please sign in to comment.