@roflsec/fail2scan 0.0.8 → 0.0.10
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/bin/daemon.js +8 -16
- package/package.json +1 -1
package/bin/daemon.js
CHANGED
|
@@ -5,23 +5,15 @@ const { execFile, spawn } = require('child_process');
|
|
|
5
5
|
const { promisify } = require('util');
|
|
6
6
|
const execFileP = promisify(execFile);
|
|
7
7
|
require('dotenv').config({ quiet:true})
|
|
8
|
+
const IPGeolocationAPI = require("ip-geolocation-api-javascript-sdk");
|
|
9
|
+
|
|
10
|
+
const geoApi = new IPGeolocationAPI(process.env.IPGEO_API_KEY, true);
|
|
11
|
+
const getGeo = async (ip) => {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
geoApi.getGeolocation(resolve, { ip, fields: "geo,time_zone,currency,asn,security" });
|
|
14
|
+
});
|
|
15
|
+
};
|
|
8
16
|
|
|
9
|
-
// -------------------- IPGeolocation --------------------
|
|
10
|
-
let getGeo = async (ip) => null;
|
|
11
|
-
if(process.env.IPGEO_API_KEY){
|
|
12
|
-
const IPGeolocationAPI = require("ip-geolocation-api-javascript-sdk");
|
|
13
|
-
const GeolocationParams = require("ip-geolocation-api-javascript-sdk/GeolocationParams.js");
|
|
14
|
-
const ipGeo = new IPGeolocationAPI(`${process.env.IPGEO_API_KEY}`, true);
|
|
15
|
-
|
|
16
|
-
getGeo = (ip) => {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
const params = new GeolocationParams();
|
|
19
|
-
params.setIPAddress(ip);
|
|
20
|
-
params.setFields("geo,time_zone,currency,asn,security");
|
|
21
|
-
ipGeo.getGeolocation((res) => resolve(res), params);
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
17
|
|
|
26
18
|
// -------------------- CLI / CONFIG --------------------
|
|
27
19
|
const argv = process.argv.slice(2);
|