greip.js 2.3.4 → 2.4.1
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 +30 -12
- package/lib/index.d.ts +1 -0
- package/lib/index.js +40 -1
- package/lib/util.d.ts +1 -1
- package/lib/util.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,11 +16,11 @@ The official Javascript package of Greip API
|
|
|
16
16
|
|
|
17
17
|
[](https://badge.fury.io/js/greip.js)
|
|
18
18
|
|
|
19
|
-

|
|
20
20
|
|
|
21
|
-
[](https://opensource.org/license/apache-2-0)
|
|
22
22
|
|
|
23
|
-

|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -57,6 +57,7 @@ There're two different ways to initialize the Greip object, let's dive into this
|
|
|
57
57
|
```javascript
|
|
58
58
|
import {
|
|
59
59
|
Lookup,
|
|
60
|
+
Threats,
|
|
60
61
|
GeoIP,
|
|
61
62
|
BulkLookup,
|
|
62
63
|
ASN,
|
|
@@ -104,7 +105,24 @@ await GeoIP({
|
|
|
104
105
|
});
|
|
105
106
|
```
|
|
106
107
|
|
|
107
|
-
### 2. IP
|
|
108
|
+
### 2. IP Threats Method
|
|
109
|
+
|
|
110
|
+
Use this method to retrieve threat intelligence information associated with a given IP address.
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
await Threats({
|
|
114
|
+
key: 'your-api-key',
|
|
115
|
+
ip: '1.1.1.1',
|
|
116
|
+
})
|
|
117
|
+
.then((res: any) => {
|
|
118
|
+
console.log(res.data); // Log Response
|
|
119
|
+
})
|
|
120
|
+
.catch((error: any) => {
|
|
121
|
+
console.log(error);
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 3. IP Lookup Method
|
|
108
126
|
|
|
109
127
|
Use this method to retrieve the information of a given IP address.
|
|
110
128
|
|
|
@@ -121,7 +139,7 @@ await Lookup({
|
|
|
121
139
|
});
|
|
122
140
|
```
|
|
123
141
|
|
|
124
|
-
###
|
|
142
|
+
### 4. Bulk IP Lookup Method
|
|
125
143
|
|
|
126
144
|
You can use this method to retrieve the information of multiple IP addresses (no need to use the `Lookup` method inside a loop).
|
|
127
145
|
|
|
@@ -138,7 +156,7 @@ await BulkLookup({
|
|
|
138
156
|
});
|
|
139
157
|
```
|
|
140
158
|
|
|
141
|
-
###
|
|
159
|
+
### 5. ASN Lookup Method
|
|
142
160
|
|
|
143
161
|
In this method, Greip will help you lookup any given AS Number and returning all data related to it, like: name, org (the organization name), country, domain, email, phone, totalIPs, list of all routes (v4 & v6) related the given AS Number, etc.
|
|
144
162
|
|
|
@@ -155,7 +173,7 @@ await ASN({
|
|
|
155
173
|
});
|
|
156
174
|
```
|
|
157
175
|
|
|
158
|
-
###
|
|
176
|
+
### 6. Profanity Detection Method
|
|
159
177
|
|
|
160
178
|
This method can be used to detect abuse of your website/app. It’s a great way to know more about your user inputs and whether they contain profanity (bad words) or not before releasing them to the public.
|
|
161
179
|
|
|
@@ -172,7 +190,7 @@ await BadWord({
|
|
|
172
190
|
});
|
|
173
191
|
```
|
|
174
192
|
|
|
175
|
-
###
|
|
193
|
+
### 7. Country Lookup Method
|
|
176
194
|
|
|
177
195
|
This method can help you retrieve information of the given country.
|
|
178
196
|
|
|
@@ -189,7 +207,7 @@ await Country({
|
|
|
189
207
|
});
|
|
190
208
|
```
|
|
191
209
|
|
|
192
|
-
###
|
|
210
|
+
### 8. Email Validation Method
|
|
193
211
|
|
|
194
212
|
This method provides an additional layer of validation for your system. While validating email syntax is important, it is not sufficient.
|
|
195
213
|
|
|
@@ -208,7 +226,7 @@ await EmailValidation({
|
|
|
208
226
|
});
|
|
209
227
|
```
|
|
210
228
|
|
|
211
|
-
###
|
|
229
|
+
### 9. Phone Validation Method
|
|
212
230
|
|
|
213
231
|
This method can be used as an extra-layer of your system for validating phone numbers. It validates phone number syntax and valid-possibility.
|
|
214
232
|
|
|
@@ -226,7 +244,7 @@ await PhoneValidation({
|
|
|
226
244
|
});
|
|
227
245
|
```
|
|
228
246
|
|
|
229
|
-
###
|
|
247
|
+
### 10. Payment Fraud Prevention Method
|
|
230
248
|
|
|
231
249
|
Prevent financial losses by deploying AI-Powered modules.
|
|
232
250
|
|
|
@@ -303,7 +321,7 @@ await PaymentFraud({
|
|
|
303
321
|
});
|
|
304
322
|
```
|
|
305
323
|
|
|
306
|
-
###
|
|
324
|
+
### 11. IBAN Validation Method
|
|
307
325
|
|
|
308
326
|
This method allows you to validate International Bank Account Numbers (IBANs) and retrieve additional information about the country associated with the IBAN.
|
|
309
327
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Options } from './types';
|
|
2
2
|
export declare const GeoIP: (options: Options) => Promise<unknown>;
|
|
3
3
|
export declare const Lookup: (options: Options) => Promise<unknown>;
|
|
4
|
+
export declare const Threats: (options: Options) => Promise<unknown>;
|
|
4
5
|
export declare const BulkLookup: (options: Options) => Promise<unknown>;
|
|
5
6
|
export declare const Country: (options: Options) => Promise<unknown>;
|
|
6
7
|
export declare const BadWord: (options: Options) => Promise<unknown>;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IBANValidation = exports.PhoneValidation = exports.PaymentFraud = exports.EmailValidation = exports.ASN = exports.BadWord = exports.Country = exports.BulkLookup = exports.Lookup = exports.GeoIP = void 0;
|
|
3
|
+
exports.IBANValidation = exports.PhoneValidation = exports.PaymentFraud = exports.EmailValidation = exports.ASN = exports.BadWord = exports.Country = exports.BulkLookup = exports.Threats = exports.Lookup = exports.GeoIP = void 0;
|
|
4
4
|
var util_1 = require("./util");
|
|
5
5
|
var GeoIP = function (options) {
|
|
6
6
|
if (typeof options !== 'object')
|
|
@@ -116,6 +116,45 @@ var Lookup = function (options) {
|
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
118
|
exports.Lookup = Lookup;
|
|
119
|
+
var Threats = function (options) {
|
|
120
|
+
if (typeof options !== 'object')
|
|
121
|
+
options = {};
|
|
122
|
+
if (!options.key || options.key.length < 1) {
|
|
123
|
+
throw new Error('You should pass the API Key.');
|
|
124
|
+
}
|
|
125
|
+
return new Promise(function (resolve, reject) {
|
|
126
|
+
var ip1 = options.ip || '';
|
|
127
|
+
var format1 = options.format || 'JSON';
|
|
128
|
+
var mode1 = options.mode || 'live';
|
|
129
|
+
// Validate the ip variable
|
|
130
|
+
if (ip1.length < 7) {
|
|
131
|
+
reject(new Error('You should pass the `ip` parameter.'));
|
|
132
|
+
}
|
|
133
|
+
// Validate the format variable
|
|
134
|
+
if (!util_1.availableFormats.includes(format1)) {
|
|
135
|
+
reject(new Error('The `format` option value "' +
|
|
136
|
+
format1 +
|
|
137
|
+
'" you specified is unknown.\nYou can use: `JSON`, `XML`, `CSV` or `Newline`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
|
|
138
|
+
}
|
|
139
|
+
// Validate the mode variable
|
|
140
|
+
if (mode1 !== 'live' && mode1 !== 'test') {
|
|
141
|
+
reject(new Error('The `mode` option value "' +
|
|
142
|
+
mode1 +
|
|
143
|
+
'" you specified is unknown.\nYou can use: `live` or `test`.\nRead more at: https://docs.greip.io/api-reference/endpoint/ip-geolocation/ip-lookup'));
|
|
144
|
+
}
|
|
145
|
+
(0, util_1.makeHttpRquest)('threats', {
|
|
146
|
+
ip: ip1,
|
|
147
|
+
key: options.key,
|
|
148
|
+
format: format1,
|
|
149
|
+
mode: mode1,
|
|
150
|
+
}, function (res) {
|
|
151
|
+
if (typeof res !== 'object')
|
|
152
|
+
res = JSON.parse(res);
|
|
153
|
+
resolve(res);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
exports.Threats = Threats;
|
|
119
158
|
var BulkLookup = function (options) {
|
|
120
159
|
if (typeof options !== 'object')
|
|
121
160
|
options = {};
|
package/lib/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const baseURL = "https://
|
|
1
|
+
export declare const baseURL = "https://greipapi.com/";
|
|
2
2
|
export declare const availableGeoIPParams: string[];
|
|
3
3
|
export declare const availableLanguages: string[];
|
|
4
4
|
export declare const availableFormats: string[];
|
package/lib/util.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makePostRquest = exports.makeHttpRquest = exports.serialize = exports.availableCountryParams = exports.availableFormats = exports.availableLanguages = exports.availableGeoIPParams = exports.baseURL = void 0;
|
|
4
4
|
var axios_1 = require("axios");
|
|
5
|
-
exports.baseURL = 'https://
|
|
5
|
+
exports.baseURL = 'https://greipapi.com/';
|
|
6
6
|
exports.availableGeoIPParams = ['location', 'security', 'timezone', 'currency', 'device'];
|
|
7
7
|
exports.availableLanguages = ['EN', 'AR', 'DE', 'FR', 'ES', 'JA', 'ZH', 'RU'];
|
|
8
8
|
exports.availableFormats = ['JSON', 'XML', 'CSV', 'Newline'];
|