@riavzon/bot-detector 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/main.cjs +4 -4
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +4 -4
- package/dist/main.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,12 +34,14 @@ npx @riavzon/bot-detector-create
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
This single command installs all dependencies, downloads and compiles every
|
|
37
|
-
threat intelligence feed, writes a fully annotated `botDetectorConfig.ts`
|
|
38
|
-
|
|
39
|
-
steps. See the
|
|
37
|
+
threat intelligence feed, writes a fully annotated `botDetectorConfig.ts` with
|
|
38
|
+
all 17 checkers at their defaults, a `mainBotDetector.ts` ready-to-run Express
|
|
39
|
+
entry point, and creates the database tables, all without any manual steps. See the
|
|
40
40
|
[@riavzon/bot-detector-create](https://www.npmjs.com/package/@riavzon/bot-detector-create)
|
|
41
41
|
package for details.
|
|
42
42
|
|
|
43
|
+
It defaults to [better-sqlite3](http://github.com/WiseLibs/better-sqlite3) as the database driver.
|
|
44
|
+
|
|
43
45
|
## Manual installation
|
|
44
46
|
|
|
45
47
|
If you prefer to wire things up yourself:
|
package/dist/main.cjs
CHANGED
|
@@ -508,7 +508,7 @@ async function updateBannedIP(cookie, ipAddress, country, user_agent, info) {
|
|
|
508
508
|
reason = ${ex("reason")}`).run(...params);
|
|
509
509
|
log.info(`Updated Database TABLE - banned. A user has been banned for IP ${ipAddress} (score ${String(info.score)})`);
|
|
510
510
|
} catch (err) {
|
|
511
|
-
log.error({
|
|
511
|
+
log.error({ err }, "ERROR UPDATING \"banned\" TABLE");
|
|
512
512
|
throw err;
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -526,7 +526,7 @@ async function updateIsBot(isBot, cookie) {
|
|
|
526
526
|
try {
|
|
527
527
|
await prep(db, `UPDATE visitors SET is_bot = ? WHERE canary_id = ?`).run(...params);
|
|
528
528
|
} catch (err) {
|
|
529
|
-
log.error({
|
|
529
|
+
log.error({ err }, "ERROR UPDATING IS_BOT");
|
|
530
530
|
throw err;
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -639,7 +639,7 @@ async function updateVisitor(u) {
|
|
|
639
639
|
log.info(`Updated visitors table, Visitor row for canary_id=${cookie ?? ""} inserted/updated successfully.`);
|
|
640
640
|
return;
|
|
641
641
|
} catch (err) {
|
|
642
|
-
log.error({
|
|
642
|
+
log.error({ err }, `ERROR UPDATING visitors TABLE`);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
|
|
@@ -656,7 +656,7 @@ async function updateScore(score, cookie) {
|
|
|
656
656
|
try {
|
|
657
657
|
await prep(db, `UPDATE visitors SET suspicious_activity_score = ? WHERE canary_id = ?`).run(...params);
|
|
658
658
|
} catch (err) {
|
|
659
|
-
log.error({
|
|
659
|
+
log.error({ err }, "ERROR UPDATING SCORE");
|
|
660
660
|
throw err;
|
|
661
661
|
}
|
|
662
662
|
}
|