# fail2ban_json

> json based fail2ban integration

Latest version **1.0.2** (published 2022-12-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install fail2ban_json
pnpm add fail2ban_json
yarn add fail2ban_json
bun add fail2ban_json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-12-18 |
| First published | 2022-12-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | PugPickles |
| Maintainers | pugpickles |

## Links

- npm: https://www.npmjs.com/package/fail2ban_json
- Repository: https://github.com/PugPickles/Fail2ban
- Homepage: https://github.com/PugPickles/Fail2ban#readme
- Issues: https://github.com/PugPickles/Fail2ban/issues
- npm.io page: https://npm.io/package/fail2ban_json

## Recent versions

- 1.0.2 (latest) — 2022-12-18
- 1.0.1 — 2022-12-17
- 1.0.0 — 2022-12-17

## README

# Fail2ban
json based fail2ban integration for nodejs

https://www.npmjs.com/package/fail2ban_json


#### Functions
```js
const f2b = require("fail2ban_json");

f2b.config({
    "bantime": {
        "mode": "m",    // s = seconds | m = minutes | h = hours | d = days
        "count": 10     // number of seconds/minutes etc.
    },
    "maxTry": 3,        // max attempts until locked
    "log": true,        // logging
    "path": "./"        // set path for the blocklist (and log if necessary)
})

f2b.check("1.2.3.4", cb => {
    console.log(cb);
});

f2b.ban("1.2.3.4", cb => {
    console.log(cb);
});

f2b.delete("1.2.3.4", cb => {
    console.log(cb);
});
```

#### Return value

Check:
```js
// IP not listed
{
  baned: false
}

// IP listed but not locked
{
  baned: false,
  try: 1
}

// IP locked ("bantime" is the time when requests are allowed again)
{
  baned: true,
  try: 3,
  bantime: 1671273781571
}
```

Ban:
```js
// IP is not locked yet
{
  baned: false,
  try: 1
}

// IP is locked ("bantime" is the time when requests are allowed again)
{
  baned: true,
  try: 3,
  bantime: 1671273781571
}
```

Delete:
```js
// IP is not listed
false

// IP was deleted from list
true
```

---
_Source: https://npm.io/package/fail2ban_json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
