@roflsec/fail2scan 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. package/bin/daemon.js +5 -3
  2. package/package.json +1 -1
package/bin/daemon.js CHANGED
@@ -7,14 +7,17 @@ const execFileP = promisify(execFile);
7
7
  require('dotenv').config({ quiet:true})
8
8
  const IPGeolocationAPI = require("ip-geolocation-api-javascript-sdk");
9
9
 
10
+ // ----------- Geo setup (fixed) -----------
10
11
  const geoApi = new IPGeolocationAPI(process.env.IPGEO_API_KEY, true);
11
12
  const getGeo = async (ip) => {
12
13
  return new Promise((resolve, reject) => {
13
- geoApi.getGeolocation(resolve, { ip, fields: "geo,time_zone,currency,asn,security" });
14
+ geoApi.getGeolocation(
15
+ (res) => resolve(res),
16
+ { ip, fields: "geo,time_zone,currency,asn,security" }
17
+ );
14
18
  });
15
19
  };
16
20
 
17
-
18
21
  // -------------------- CLI / CONFIG --------------------
19
22
  const argv = process.argv.slice(2);
20
23
  const getArg = (k,d) => { for(let i=0;i<argv.length;i++){const a=argv[i]; if(a===k&&argv[i+1]) return argv[++i]; if(a.startsWith(k+'=')) return a.split('=')[1]; } return d; };
@@ -57,7 +60,6 @@ const STATE=loadState();
57
60
 
58
61
  // -------------------- IP extraction --------------------
59
62
  function extractIpFromLine(line){
60
- // garde ton extracteur d’origine (IPv4 + IPv6)
61
63
  const v4 = line.match(/\b(?:\d{1,3}\.){3}\d{1,3}\b/);
62
64
  if(v4&&v4[0]) return v4[0];
63
65
  const v6 = line.match(/\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roflsec/fail2scan",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Fail2Scan daemon - watches fail2ban logs and scans banned IPs using nmap, dig and whois.",
5
5
  "bin": {
6
6
  "fail2scan-daemon": "./bin/daemon.js"