Twan07 commited on
Commit
d0a7cea
·
verified ·
1 Parent(s): 582228b

Update src/security/featureExtractor.js

Browse files
Files changed (1) hide show
  1. src/security/featureExtractor.js +4 -3
src/security/featureExtractor.js CHANGED
@@ -1,11 +1,12 @@
1
  import { AuditLog } from "../models/AuditLog.js";
2
 
3
- export async function extractFeatures(log) {
4
  const since = new Date(Date.now() - 10 * 60 * 1000);
5
- const ipCount = await AuditLog.countDocuments({
 
6
  ip: log.ip,
7
  createdAt: { $gte: since },
8
  });
9
 
10
- return [log.createdAt.getHours(), Math.min(ipCount, 100)];
11
  }
 
1
  import { AuditLog } from "../models/AuditLog.js";
2
 
3
+ export async function extractFeature(log) {
4
  const since = new Date(Date.now() - 10 * 60 * 1000);
5
+
6
+ const count = await AuditLog.countDocuments({
7
  ip: log.ip,
8
  createdAt: { $gte: since },
9
  });
10
 
11
+ return count;
12
  }