abuseipdb-client 0.1.63 → 0.1.64
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/dist/index.js +558 -558
- package/dist/index.mjs +558 -558
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4715,572 +4715,572 @@ set(...a){x('set',arguments,2);var b=[],c=!0;a=f(...a);this.#d.forEach(d=>{d[0]=
|
|
|
4715
4715
|
*keys(){for(var[a]of this)yield a;}
|
|
4716
4716
|
*values(){for(var[,a]of this)yield a;}};
|
|
4717
4717
|
|
|
4718
|
-
/**
|
|
4719
|
-
* I'm patching the type definitions for isISO31661Alpha2 because
|
|
4720
|
-
* it is returning some encapsulated object.
|
|
4721
|
-
*/
|
|
4722
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4723
|
-
const _isISO31661Alpha2 = isISO31661Alpha2
|
|
4724
|
-
.default;
|
|
4725
|
-
/**
|
|
4726
|
-
* Predicate function that verifies if a given array contains only valid ISO 3166-1 Alpha 2 countries.
|
|
4727
|
-
* @param arr Array of ISO 3166-1 Alpha 2 countries as string.
|
|
4728
|
-
* @returns Boolean if elements of the given array are valid.
|
|
4729
|
-
* @group Helpers
|
|
4730
|
-
*/
|
|
4731
|
-
const isArrISO31661Alpha2 = (arr) => arr
|
|
4732
|
-
.map(el => _isISO31661Alpha2(el))
|
|
4733
|
-
.reduce((acc, curr) => {
|
|
4734
|
-
if (curr) {
|
|
4735
|
-
acc = true;
|
|
4736
|
-
}
|
|
4737
|
-
return acc;
|
|
4718
|
+
/**
|
|
4719
|
+
* I'm patching the type definitions for isISO31661Alpha2 because
|
|
4720
|
+
* it is returning some encapsulated object.
|
|
4721
|
+
*/
|
|
4722
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4723
|
+
const _isISO31661Alpha2 = isISO31661Alpha2
|
|
4724
|
+
.default;
|
|
4725
|
+
/**
|
|
4726
|
+
* Predicate function that verifies if a given array contains only valid ISO 3166-1 Alpha 2 countries.
|
|
4727
|
+
* @param arr Array of ISO 3166-1 Alpha 2 countries as string.
|
|
4728
|
+
* @returns Boolean if elements of the given array are valid.
|
|
4729
|
+
* @group Helpers
|
|
4730
|
+
*/
|
|
4731
|
+
const isArrISO31661Alpha2 = (arr) => arr
|
|
4732
|
+
.map(el => _isISO31661Alpha2(el))
|
|
4733
|
+
.reduce((acc, curr) => {
|
|
4734
|
+
if (curr) {
|
|
4735
|
+
acc = true;
|
|
4736
|
+
}
|
|
4737
|
+
return acc;
|
|
4738
4738
|
}, false);
|
|
4739
4739
|
|
|
4740
|
-
/**
|
|
4741
|
-
* Removes a boolean query string parameter when its value is set to `false`.
|
|
4742
|
-
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
4743
|
-
* this function filter those values in order to return the right response.
|
|
4744
|
-
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
4745
|
-
*/
|
|
4746
|
-
const filterBooleanAPIQueryStrings = (schema, parameter) => {
|
|
4747
|
-
const newSchema = { ...schema };
|
|
4748
|
-
if (schema[parameter] === false) {
|
|
4749
|
-
delete newSchema[parameter];
|
|
4750
|
-
}
|
|
4751
|
-
return newSchema;
|
|
4752
|
-
};
|
|
4753
|
-
const abuseIPDBClientRequiredSchema = zod.z.object({
|
|
4754
|
-
/** Client API Key, must be generated at AbuseIPDB's client dashboard. */
|
|
4755
|
-
apiKey: zod.z.string().min(1),
|
|
4756
|
-
});
|
|
4757
|
-
const abuseIPDBClientOptionsSchema = zod.z.object({
|
|
4758
|
-
/**
|
|
4759
|
-
* Overrides the default AbuseIPDB base API url, can be used to proxy client requests.
|
|
4760
|
-
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
4761
|
-
*/
|
|
4762
|
-
url: zod.z.string().optional(),
|
|
4763
|
-
});
|
|
4764
|
-
/**
|
|
4765
|
-
* @group Input - Validator
|
|
4766
|
-
*/
|
|
4767
|
-
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.merge(abuseIPDBClientOptionsSchema);
|
|
4768
|
-
zod.z.object({
|
|
4769
|
-
/** Client API Key. */
|
|
4770
|
-
apiKey: zod.z.string(),
|
|
4771
|
-
/**
|
|
4772
|
-
* Base API URL.
|
|
4773
|
-
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
4774
|
-
*/
|
|
4775
|
-
url: zod.z.string(),
|
|
4776
|
-
});
|
|
4777
|
-
const checkRequiredSchema = zod.z.object({
|
|
4778
|
-
/** Single IPv4/IPv6 address. */
|
|
4779
|
-
ipAddress: zod.z
|
|
4780
|
-
.string()
|
|
4781
|
-
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4782
|
-
});
|
|
4783
|
-
const checkOptionsSchema = zod.z.object({
|
|
4784
|
-
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
4785
|
-
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4786
|
-
/** Includes in the client response all the reports (Limited to 10,000) and country name entries, based on the `maxAgeInDays` parameter. Defaults to `false` by the API. */
|
|
4787
|
-
verbose: zod.z.boolean().optional(),
|
|
4788
|
-
});
|
|
4789
|
-
/**
|
|
4790
|
-
* @group Input - Validator
|
|
4791
|
-
*/
|
|
4792
|
-
const checkSchema = checkRequiredSchema
|
|
4793
|
-
.merge(checkOptionsSchema)
|
|
4794
|
-
.transform(schema => filterBooleanAPIQueryStrings(schema, 'verbose'));
|
|
4795
|
-
const reportsRequiredSchema = zod.z.object({
|
|
4796
|
-
/** Single IPv4/IPv6 address. */
|
|
4797
|
-
ipAddress: zod.z
|
|
4798
|
-
.string()
|
|
4799
|
-
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4800
|
-
});
|
|
4801
|
-
const reportsOptionsSchema = zod.z.object({
|
|
4802
|
-
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
4803
|
-
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4804
|
-
/** Pagination number based on the `perPage` parameter. Minimum accepted value is 1, defaults to `1` by the API. */
|
|
4805
|
-
page: zod.z.number().int().min(1).optional(),
|
|
4806
|
-
/** Amount of reports per page. Accepted values between 1 and 100, defaults to `25` by the API. */
|
|
4807
|
-
perPage: zod.z.number().int().min(1).max(100).optional(),
|
|
4808
|
-
});
|
|
4809
|
-
/**
|
|
4810
|
-
* @group Input - Validator
|
|
4811
|
-
*/
|
|
4812
|
-
const reportsSchema = reportsRequiredSchema.merge(reportsOptionsSchema);
|
|
4813
|
-
const blacklistOptionsSchema = zod.z.object({
|
|
4814
|
-
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
4815
|
-
confidenceMinimum: zod.z.number().int().min(25).max(100).optional(),
|
|
4816
|
-
/**
|
|
4817
|
-
* Limits the amount of returned reports. Accepted values between 1 and 500000, defaults to `10000` by the API.
|
|
4818
|
-
* The value is capped by your current subscription tier. (10k Standard, 100k Basic, 500k Premium).
|
|
4819
|
-
*/
|
|
4820
|
-
limit: zod.z.number().int().min(1).max(500000).optional(),
|
|
4821
|
-
/** Returns the response as a text list, instead of JSON structure. Result is wrapped in a `ClientResponse` */
|
|
4822
|
-
plaintext: zod.z.boolean().optional(),
|
|
4823
|
-
/**
|
|
4824
|
-
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, including only the given list.
|
|
4825
|
-
* Requires a subscription to use this feature.
|
|
4826
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
4827
|
-
onlyCountries: zod.z.array(zod.z.string()).optional(),
|
|
4828
|
-
/**
|
|
4829
|
-
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, excluding only the given list.
|
|
4830
|
-
* Requires a subscription to use this feature.
|
|
4831
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
4832
|
-
exceptCountries: zod.z.array(zod.z.string()).optional(),
|
|
4833
|
-
});
|
|
4834
|
-
/**
|
|
4835
|
-
* @group Input - Validator
|
|
4836
|
-
*/
|
|
4837
|
-
const blacklistSchema = blacklistOptionsSchema
|
|
4838
|
-
.transform(schema => filterBooleanAPIQueryStrings(schema, 'plaintext'))
|
|
4839
|
-
.superRefine((schemaValues, ctx) => {
|
|
4840
|
-
// Countries declaration are optional, skip validation if this is the case.
|
|
4841
|
-
if (!(schemaValues.onlyCountries ?? schemaValues.exceptCountries)) {
|
|
4842
|
-
return;
|
|
4843
|
-
}
|
|
4844
|
-
if (schemaValues.onlyCountries && schemaValues.exceptCountries) {
|
|
4845
|
-
ctx.addIssue({
|
|
4846
|
-
code: zod.z.ZodIssueCode.custom,
|
|
4847
|
-
message: '`exceptCountries` and `onlyCountries` are mutually exclusive, only one can be defined at a time.',
|
|
4848
|
-
});
|
|
4849
|
-
return;
|
|
4850
|
-
}
|
|
4851
|
-
const countriesParams = ['onlyCountries', 'exceptCountries'];
|
|
4852
|
-
for (const countryParam of countriesParams) {
|
|
4853
|
-
const countriesArr = schemaValues[countryParam];
|
|
4854
|
-
if (!countriesArr) {
|
|
4855
|
-
continue;
|
|
4856
|
-
}
|
|
4857
|
-
if (countriesArr.length === 0) {
|
|
4858
|
-
ctx.addIssue({
|
|
4859
|
-
code: zod.z.ZodIssueCode.too_small,
|
|
4860
|
-
minimum: 1,
|
|
4861
|
-
type: 'array',
|
|
4862
|
-
inclusive: true,
|
|
4863
|
-
message: `[${countryParam}] Atleast one country must be specified.`,
|
|
4864
|
-
});
|
|
4865
|
-
continue;
|
|
4866
|
-
}
|
|
4867
|
-
if (!isArrISO31661Alpha2(countriesArr)) {
|
|
4868
|
-
ctx.addIssue({
|
|
4869
|
-
code: zod.z.ZodIssueCode.custom,
|
|
4870
|
-
message: `[${countryParam}] Countries must be valid ISO 3166-1 Alpha-2 codes.`,
|
|
4871
|
-
});
|
|
4872
|
-
}
|
|
4873
|
-
}
|
|
4874
|
-
});
|
|
4875
|
-
const reportRequiredSchema = zod.z.object({
|
|
4876
|
-
/** Single IPv4/IPv6 address. */
|
|
4877
|
-
ip: zod.z.string().refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4878
|
-
/** Array of categories */
|
|
4879
|
-
categories: zod.z.array(zod.z.number().int().min(1).max(23)).min(1).max(30),
|
|
4880
|
-
});
|
|
4881
|
-
const reportOptionsSchema = zod.z.object({
|
|
4882
|
-
/** Message to be added to the report, limited to 1024 characters. */
|
|
4883
|
-
comment: zod.z.string().max(1024).optional(),
|
|
4884
|
-
});
|
|
4885
|
-
/**
|
|
4886
|
-
* @group Input - Validator
|
|
4887
|
-
*/
|
|
4888
|
-
const reportSchema = reportRequiredSchema.merge(reportOptionsSchema);
|
|
4889
|
-
const checkBlockRequiredSchema = zod.z.object({
|
|
4890
|
-
/**
|
|
4891
|
-
* Single IPv4/IPv6 address block in CIDR format.
|
|
4892
|
-
* The value is capped by your current subscription tier. (Up to /24 on Standard, /20 on Basic, /16 on Premium).
|
|
4893
|
-
*/
|
|
4894
|
-
network: zod.z
|
|
4895
|
-
.string()
|
|
4896
|
-
.refine(isIPRange, { message: 'Must be a valid CIDR block' }),
|
|
4897
|
-
});
|
|
4898
|
-
const checkBlockOptionsSchema = zod.z.object({
|
|
4899
|
-
/**
|
|
4900
|
-
* Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API.
|
|
4901
|
-
* The value is capped by your current subscription tier. (Up to 30 on Standard, 60 on Basic, 365 on Premium).
|
|
4902
|
-
*/
|
|
4903
|
-
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4904
|
-
});
|
|
4905
|
-
/**
|
|
4906
|
-
* @group Input - Validator
|
|
4907
|
-
*/
|
|
4908
|
-
const checkBlockSchema = checkBlockRequiredSchema.merge(checkBlockOptionsSchema);
|
|
4909
|
-
const bulkReportRequiredSchema = zod.z.object({
|
|
4910
|
-
/** Report CSV filepath to be sent. */
|
|
4911
|
-
csv: zod.z.string(),
|
|
4912
|
-
});
|
|
4913
|
-
/**
|
|
4914
|
-
* @group Input - Validator
|
|
4915
|
-
*/
|
|
4916
|
-
const bulkReportSchema = bulkReportRequiredSchema;
|
|
4917
|
-
/** Single IPv4/IPv6 address. */
|
|
4918
|
-
const clearAddressRequiredSchema = zod.z
|
|
4919
|
-
.string()
|
|
4920
|
-
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' });
|
|
4921
|
-
/**
|
|
4922
|
-
* @group Input - Validator
|
|
4923
|
-
*/
|
|
4740
|
+
/**
|
|
4741
|
+
* Removes a boolean query string parameter when its value is set to `false`.
|
|
4742
|
+
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
4743
|
+
* this function filter those values in order to return the right response.
|
|
4744
|
+
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
4745
|
+
*/
|
|
4746
|
+
const filterBooleanAPIQueryStrings = (schema, parameter) => {
|
|
4747
|
+
const newSchema = { ...schema };
|
|
4748
|
+
if (schema[parameter] === false) {
|
|
4749
|
+
delete newSchema[parameter];
|
|
4750
|
+
}
|
|
4751
|
+
return newSchema;
|
|
4752
|
+
};
|
|
4753
|
+
const abuseIPDBClientRequiredSchema = zod.z.object({
|
|
4754
|
+
/** Client API Key, must be generated at AbuseIPDB's client dashboard. */
|
|
4755
|
+
apiKey: zod.z.string().min(1),
|
|
4756
|
+
});
|
|
4757
|
+
const abuseIPDBClientOptionsSchema = zod.z.object({
|
|
4758
|
+
/**
|
|
4759
|
+
* Overrides the default AbuseIPDB base API url, can be used to proxy client requests.
|
|
4760
|
+
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
4761
|
+
*/
|
|
4762
|
+
url: zod.z.string().optional(),
|
|
4763
|
+
});
|
|
4764
|
+
/**
|
|
4765
|
+
* @group Input - Validator
|
|
4766
|
+
*/
|
|
4767
|
+
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.merge(abuseIPDBClientOptionsSchema);
|
|
4768
|
+
zod.z.object({
|
|
4769
|
+
/** Client API Key. */
|
|
4770
|
+
apiKey: zod.z.string(),
|
|
4771
|
+
/**
|
|
4772
|
+
* Base API URL.
|
|
4773
|
+
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
4774
|
+
*/
|
|
4775
|
+
url: zod.z.string(),
|
|
4776
|
+
});
|
|
4777
|
+
const checkRequiredSchema = zod.z.object({
|
|
4778
|
+
/** Single IPv4/IPv6 address. */
|
|
4779
|
+
ipAddress: zod.z
|
|
4780
|
+
.string()
|
|
4781
|
+
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4782
|
+
});
|
|
4783
|
+
const checkOptionsSchema = zod.z.object({
|
|
4784
|
+
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
4785
|
+
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4786
|
+
/** Includes in the client response all the reports (Limited to 10,000) and country name entries, based on the `maxAgeInDays` parameter. Defaults to `false` by the API. */
|
|
4787
|
+
verbose: zod.z.boolean().optional(),
|
|
4788
|
+
});
|
|
4789
|
+
/**
|
|
4790
|
+
* @group Input - Validator
|
|
4791
|
+
*/
|
|
4792
|
+
const checkSchema = checkRequiredSchema
|
|
4793
|
+
.merge(checkOptionsSchema)
|
|
4794
|
+
.transform(schema => filterBooleanAPIQueryStrings(schema, 'verbose'));
|
|
4795
|
+
const reportsRequiredSchema = zod.z.object({
|
|
4796
|
+
/** Single IPv4/IPv6 address. */
|
|
4797
|
+
ipAddress: zod.z
|
|
4798
|
+
.string()
|
|
4799
|
+
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4800
|
+
});
|
|
4801
|
+
const reportsOptionsSchema = zod.z.object({
|
|
4802
|
+
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
4803
|
+
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4804
|
+
/** Pagination number based on the `perPage` parameter. Minimum accepted value is 1, defaults to `1` by the API. */
|
|
4805
|
+
page: zod.z.number().int().min(1).optional(),
|
|
4806
|
+
/** Amount of reports per page. Accepted values between 1 and 100, defaults to `25` by the API. */
|
|
4807
|
+
perPage: zod.z.number().int().min(1).max(100).optional(),
|
|
4808
|
+
});
|
|
4809
|
+
/**
|
|
4810
|
+
* @group Input - Validator
|
|
4811
|
+
*/
|
|
4812
|
+
const reportsSchema = reportsRequiredSchema.merge(reportsOptionsSchema);
|
|
4813
|
+
const blacklistOptionsSchema = zod.z.object({
|
|
4814
|
+
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
4815
|
+
confidenceMinimum: zod.z.number().int().min(25).max(100).optional(),
|
|
4816
|
+
/**
|
|
4817
|
+
* Limits the amount of returned reports. Accepted values between 1 and 500000, defaults to `10000` by the API.
|
|
4818
|
+
* The value is capped by your current subscription tier. (10k Standard, 100k Basic, 500k Premium).
|
|
4819
|
+
*/
|
|
4820
|
+
limit: zod.z.number().int().min(1).max(500000).optional(),
|
|
4821
|
+
/** Returns the response as a text list, instead of JSON structure. Result is wrapped in a `ClientResponse` */
|
|
4822
|
+
plaintext: zod.z.boolean().optional(),
|
|
4823
|
+
/**
|
|
4824
|
+
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, including only the given list.
|
|
4825
|
+
* Requires a subscription to use this feature.
|
|
4826
|
+
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
4827
|
+
onlyCountries: zod.z.array(zod.z.string()).optional(),
|
|
4828
|
+
/**
|
|
4829
|
+
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, excluding only the given list.
|
|
4830
|
+
* Requires a subscription to use this feature.
|
|
4831
|
+
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
4832
|
+
exceptCountries: zod.z.array(zod.z.string()).optional(),
|
|
4833
|
+
});
|
|
4834
|
+
/**
|
|
4835
|
+
* @group Input - Validator
|
|
4836
|
+
*/
|
|
4837
|
+
const blacklistSchema = blacklistOptionsSchema
|
|
4838
|
+
.transform(schema => filterBooleanAPIQueryStrings(schema, 'plaintext'))
|
|
4839
|
+
.superRefine((schemaValues, ctx) => {
|
|
4840
|
+
// Countries declaration are optional, skip validation if this is the case.
|
|
4841
|
+
if (!(schemaValues.onlyCountries ?? schemaValues.exceptCountries)) {
|
|
4842
|
+
return;
|
|
4843
|
+
}
|
|
4844
|
+
if (schemaValues.onlyCountries && schemaValues.exceptCountries) {
|
|
4845
|
+
ctx.addIssue({
|
|
4846
|
+
code: zod.z.ZodIssueCode.custom,
|
|
4847
|
+
message: '`exceptCountries` and `onlyCountries` are mutually exclusive, only one can be defined at a time.',
|
|
4848
|
+
});
|
|
4849
|
+
return;
|
|
4850
|
+
}
|
|
4851
|
+
const countriesParams = ['onlyCountries', 'exceptCountries'];
|
|
4852
|
+
for (const countryParam of countriesParams) {
|
|
4853
|
+
const countriesArr = schemaValues[countryParam];
|
|
4854
|
+
if (!countriesArr) {
|
|
4855
|
+
continue;
|
|
4856
|
+
}
|
|
4857
|
+
if (countriesArr.length === 0) {
|
|
4858
|
+
ctx.addIssue({
|
|
4859
|
+
code: zod.z.ZodIssueCode.too_small,
|
|
4860
|
+
minimum: 1,
|
|
4861
|
+
type: 'array',
|
|
4862
|
+
inclusive: true,
|
|
4863
|
+
message: `[${countryParam}] Atleast one country must be specified.`,
|
|
4864
|
+
});
|
|
4865
|
+
continue;
|
|
4866
|
+
}
|
|
4867
|
+
if (!isArrISO31661Alpha2(countriesArr)) {
|
|
4868
|
+
ctx.addIssue({
|
|
4869
|
+
code: zod.z.ZodIssueCode.custom,
|
|
4870
|
+
message: `[${countryParam}] Countries must be valid ISO 3166-1 Alpha-2 codes.`,
|
|
4871
|
+
});
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
});
|
|
4875
|
+
const reportRequiredSchema = zod.z.object({
|
|
4876
|
+
/** Single IPv4/IPv6 address. */
|
|
4877
|
+
ip: zod.z.string().refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' }),
|
|
4878
|
+
/** Array of categories */
|
|
4879
|
+
categories: zod.z.array(zod.z.number().int().min(1).max(23)).min(1).max(30),
|
|
4880
|
+
});
|
|
4881
|
+
const reportOptionsSchema = zod.z.object({
|
|
4882
|
+
/** Message to be added to the report, limited to 1024 characters. */
|
|
4883
|
+
comment: zod.z.string().max(1024).optional(),
|
|
4884
|
+
});
|
|
4885
|
+
/**
|
|
4886
|
+
* @group Input - Validator
|
|
4887
|
+
*/
|
|
4888
|
+
const reportSchema = reportRequiredSchema.merge(reportOptionsSchema);
|
|
4889
|
+
const checkBlockRequiredSchema = zod.z.object({
|
|
4890
|
+
/**
|
|
4891
|
+
* Single IPv4/IPv6 address block in CIDR format.
|
|
4892
|
+
* The value is capped by your current subscription tier. (Up to /24 on Standard, /20 on Basic, /16 on Premium).
|
|
4893
|
+
*/
|
|
4894
|
+
network: zod.z
|
|
4895
|
+
.string()
|
|
4896
|
+
.refine(isIPRange, { message: 'Must be a valid CIDR block' }),
|
|
4897
|
+
});
|
|
4898
|
+
const checkBlockOptionsSchema = zod.z.object({
|
|
4899
|
+
/**
|
|
4900
|
+
* Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API.
|
|
4901
|
+
* The value is capped by your current subscription tier. (Up to 30 on Standard, 60 on Basic, 365 on Premium).
|
|
4902
|
+
*/
|
|
4903
|
+
maxAgeInDays: zod.z.number().int().min(1).max(365).optional(),
|
|
4904
|
+
});
|
|
4905
|
+
/**
|
|
4906
|
+
* @group Input - Validator
|
|
4907
|
+
*/
|
|
4908
|
+
const checkBlockSchema = checkBlockRequiredSchema.merge(checkBlockOptionsSchema);
|
|
4909
|
+
const bulkReportRequiredSchema = zod.z.object({
|
|
4910
|
+
/** Report CSV filepath to be sent. */
|
|
4911
|
+
csv: zod.z.string(),
|
|
4912
|
+
});
|
|
4913
|
+
/**
|
|
4914
|
+
* @group Input - Validator
|
|
4915
|
+
*/
|
|
4916
|
+
const bulkReportSchema = bulkReportRequiredSchema;
|
|
4917
|
+
/** Single IPv4/IPv6 address. */
|
|
4918
|
+
const clearAddressRequiredSchema = zod.z
|
|
4919
|
+
.string()
|
|
4920
|
+
.refine(isIP, { message: 'Must be a valid IPv4/IPv6 Address' });
|
|
4921
|
+
/**
|
|
4922
|
+
* @group Input - Validator
|
|
4923
|
+
*/
|
|
4924
4924
|
const clearAddressSchema = zod.z.object({ ipAddress: clearAddressRequiredSchema });
|
|
4925
4925
|
|
|
4926
|
-
/**
|
|
4927
|
-
* Base URL used to make client calls, defaults to AbuseIPDB's APIv2 Endpoint.
|
|
4928
|
-
* Can be changed when instatiating a new AbuseIPDBClient through the URL param.
|
|
4929
|
-
* @see {@link AbuseIPDBClientOptions}
|
|
4930
|
-
* @group Constants
|
|
4931
|
-
*/
|
|
4926
|
+
/**
|
|
4927
|
+
* Base URL used to make client calls, defaults to AbuseIPDB's APIv2 Endpoint.
|
|
4928
|
+
* Can be changed when instatiating a new AbuseIPDBClient through the URL param.
|
|
4929
|
+
* @see {@link AbuseIPDBClientOptions}
|
|
4930
|
+
* @group Constants
|
|
4931
|
+
*/
|
|
4932
4932
|
const BASE_URL = 'https://api.abuseipdb.com/api/v2';
|
|
4933
4933
|
|
|
4934
|
-
var _AbuseIPDBClient_instances, _AbuseIPDBClient_headers, _AbuseIPDBClient_apiKey, _AbuseIPDBClient_url, _AbuseIPDBClient_setHeaders, _AbuseIPDBClient_buildResponseHeaders, _AbuseIPDBClient_formatResponse, _AbuseIPDBClient_requestData, _AbuseIPDBClient_formatRequestBulkReport, _AbuseIPDBClient_formatUrl, _AbuseIPDBClient_validateData, _AbuseIPDBClient_handleRequest;
|
|
4935
|
-
const ENDPOINTS = {
|
|
4936
|
-
check: {
|
|
4937
|
-
method: 'GET',
|
|
4938
|
-
schema: checkSchema,
|
|
4939
|
-
},
|
|
4940
|
-
reports: {
|
|
4941
|
-
method: 'GET',
|
|
4942
|
-
schema: reportsSchema,
|
|
4943
|
-
},
|
|
4944
|
-
blacklist: {
|
|
4945
|
-
method: 'GET',
|
|
4946
|
-
schema: blacklistSchema,
|
|
4947
|
-
},
|
|
4948
|
-
report: {
|
|
4949
|
-
method: 'POST',
|
|
4950
|
-
schema: reportSchema,
|
|
4951
|
-
},
|
|
4952
|
-
'check-block': {
|
|
4953
|
-
method: 'GET',
|
|
4954
|
-
schema: checkBlockSchema,
|
|
4955
|
-
},
|
|
4956
|
-
'bulk-report': {
|
|
4957
|
-
method: 'POST',
|
|
4958
|
-
schema: bulkReportSchema,
|
|
4959
|
-
},
|
|
4960
|
-
'clear-address': {
|
|
4961
|
-
method: 'DELETE',
|
|
4962
|
-
schema: clearAddressSchema,
|
|
4963
|
-
},
|
|
4964
|
-
};
|
|
4965
|
-
/**
|
|
4966
|
-
* @group Client
|
|
4967
|
-
*/
|
|
4968
|
-
class AbuseIPDBClient {
|
|
4969
|
-
/**
|
|
4970
|
-
* Creates a new AbuseIPDB client, requires an API key from AbuseIPDB's dashboard.
|
|
4971
|
-
* @param apiKey AbuseIPDB client API key.
|
|
4972
|
-
* @param options Optional parameters - {@link AbuseIPDBClientOptions}
|
|
4973
|
-
*/
|
|
4974
|
-
constructor(apiKey, options) {
|
|
4975
|
-
_AbuseIPDBClient_instances.add(this);
|
|
4976
|
-
_AbuseIPDBClient_headers.set(this, void 0);
|
|
4977
|
-
_AbuseIPDBClient_apiKey.set(this, void 0);
|
|
4978
|
-
_AbuseIPDBClient_url.set(this, void 0);
|
|
4979
|
-
const params = { apiKey, ...options };
|
|
4980
|
-
const validatedParams = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, params, abuseIPDBClientSchema);
|
|
4981
|
-
__classPrivateFieldSet(this, _AbuseIPDBClient_apiKey, validatedParams.apiKey, "f");
|
|
4982
|
-
__classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_setHeaders).call(this, validatedParams.apiKey);
|
|
4983
|
-
if (validatedParams?.url) {
|
|
4984
|
-
__classPrivateFieldSet(this, _AbuseIPDBClient_url, validatedParams.url, "f");
|
|
4985
|
-
return;
|
|
4986
|
-
}
|
|
4987
|
-
__classPrivateFieldSet(this, _AbuseIPDBClient_url, BASE_URL, "f");
|
|
4988
|
-
}
|
|
4989
|
-
/**
|
|
4990
|
-
* Returns the current client config.
|
|
4991
|
-
*/
|
|
4992
|
-
getConfig() {
|
|
4993
|
-
return {
|
|
4994
|
-
apiKey: __classPrivateFieldGet(this, _AbuseIPDBClient_apiKey, "f"),
|
|
4995
|
-
url: __classPrivateFieldGet(this, _AbuseIPDBClient_url, "f"),
|
|
4996
|
-
};
|
|
4997
|
-
}
|
|
4998
|
-
/**
|
|
4999
|
-
* @see [Check API Endpoint](https://docs.abuseipdb.com/#check-endpoint)
|
|
5000
|
-
* @param ipAddress Single IPv4/IPv6 address to be verified.
|
|
5001
|
-
* @param options Optional parameters - {@link CheckOptions}
|
|
5002
|
-
*/
|
|
5003
|
-
async check(ipAddress, options) {
|
|
5004
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check', {
|
|
5005
|
-
ipAddress,
|
|
5006
|
-
...options,
|
|
5007
|
-
});
|
|
5008
|
-
}
|
|
5009
|
-
/**
|
|
5010
|
-
* @see [Reports API Endpoint](https://docs.abuseipdb.com/#reports-endpoint)
|
|
5011
|
-
* @param ipAddress Single IPv4/IPv6 address to be verified.
|
|
5012
|
-
* @param options Optional parameters - {@link ReportsOptions}
|
|
5013
|
-
* @beta
|
|
5014
|
-
*/
|
|
5015
|
-
async reports(ipAddress, options) {
|
|
5016
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'reports', { ipAddress, ...options });
|
|
5017
|
-
}
|
|
5018
|
-
/**
|
|
5019
|
-
* @see [Blacklist API Endpoint](https://docs.abuseipdb.com/#blacklist-endpoint)
|
|
5020
|
-
* @param options Optional parameters - {@link BlacklistOptions}
|
|
5021
|
-
*/
|
|
5022
|
-
async blacklist(options) {
|
|
5023
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'blacklist', { ...options });
|
|
5024
|
-
}
|
|
5025
|
-
/**
|
|
5026
|
-
* @see [Report API Endpoint](https://docs.abuseipdb.com/#report-endpoint)
|
|
5027
|
-
* @param ip Single IPv4/IPv6 address to be verified.
|
|
5028
|
-
* @param categories Array of categories to be reported.
|
|
5029
|
-
* @param options Optional parameters - {@link ReportOptions}
|
|
5030
|
-
*/
|
|
5031
|
-
async report(ip, categories, options) {
|
|
5032
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'report', { ip, categories, ...options });
|
|
5033
|
-
}
|
|
5034
|
-
/**
|
|
5035
|
-
* @see [Check-Block API Endpoint](https://docs.abuseipdb.com/#check-block-endpoint)
|
|
5036
|
-
* @param network Single IPv4/IPv6 address block in CIDR format.
|
|
5037
|
-
* @param options Optional parameters - {@link CheckBlockOptions}
|
|
5038
|
-
*/
|
|
5039
|
-
async checkBlock(network, options) {
|
|
5040
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check-block', { network, ...options });
|
|
5041
|
-
}
|
|
5042
|
-
/**
|
|
5043
|
-
* @see [Bulk-Report API Endpoint](https://docs.abuseipdb.com/#bulk-report-endpoint)
|
|
5044
|
-
* @param csv CSV filepath to be sent.
|
|
5045
|
-
*/
|
|
5046
|
-
async bulkReport(csv) {
|
|
5047
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'bulk-report', { csv });
|
|
5048
|
-
}
|
|
5049
|
-
/**
|
|
5050
|
-
* @see [Clear-Address API Endpoint](https://docs.abuseipdb.com/#clear-address-endpoint)
|
|
5051
|
-
* @param ipAddress Single IPv4/IPv6 address.
|
|
5052
|
-
*/
|
|
5053
|
-
async clearAddress(ipAddress) {
|
|
5054
|
-
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'clear-address', { ipAddress });
|
|
5055
|
-
}
|
|
5056
|
-
}
|
|
5057
|
-
_AbuseIPDBClient_headers = new WeakMap(), _AbuseIPDBClient_apiKey = new WeakMap(), _AbuseIPDBClient_url = new WeakMap(), _AbuseIPDBClient_instances = new WeakSet(), _AbuseIPDBClient_setHeaders = function _AbuseIPDBClient_setHeaders(apiKey) {
|
|
5058
|
-
__classPrivateFieldSet(this, _AbuseIPDBClient_headers, {
|
|
5059
|
-
Key: apiKey,
|
|
5060
|
-
Accept: 'application/json',
|
|
5061
|
-
}, "f");
|
|
5062
|
-
}, _AbuseIPDBClient_buildResponseHeaders = function _AbuseIPDBClient_buildResponseHeaders(response) {
|
|
5063
|
-
const headersJson = {};
|
|
5064
|
-
// From fetch response.
|
|
5065
|
-
headersJson.url = response.url;
|
|
5066
|
-
headersJson.status = response.status;
|
|
5067
|
-
headersJson.statusText = response.statusText;
|
|
5068
|
-
// From AbuseIPDB API HTTP headers.
|
|
5069
|
-
const rateLimitKeys = [
|
|
5070
|
-
'retry-after',
|
|
5071
|
-
'x-ratelimit-limit',
|
|
5072
|
-
'x-ratelimit-remaining',
|
|
5073
|
-
'x-ratelimit-reset',
|
|
5074
|
-
'x-generated-at',
|
|
5075
|
-
];
|
|
5076
|
-
for (const key of rateLimitKeys) {
|
|
5077
|
-
const value = response.headers.get(key);
|
|
5078
|
-
if (value) {
|
|
5079
|
-
headersJson[key] = value;
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
return headersJson;
|
|
5083
|
-
}, _AbuseIPDBClient_formatResponse = async function _AbuseIPDBClient_formatResponse(fetchAPIResponse) {
|
|
5084
|
-
const headers = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_buildResponseHeaders).call(this, fetchAPIResponse);
|
|
5085
|
-
let formattedResponse;
|
|
5086
|
-
/**
|
|
5087
|
-
* The `x-generated-at` header is present on blacklist API text endpoint response, it
|
|
5088
|
-
* is formatted here to keep consistency.
|
|
5089
|
-
* @see {@link APIBlacklistEndpointTextResponse}
|
|
5090
|
-
*/
|
|
5091
|
-
if (headers['x-generated-at']) {
|
|
5092
|
-
const xGeneratedAt = headers['x-generated-at'];
|
|
5093
|
-
delete headers['x-generated-at'];
|
|
5094
|
-
const bodyWithMeta = {
|
|
5095
|
-
meta: {
|
|
5096
|
-
generatedAt: xGeneratedAt,
|
|
5097
|
-
},
|
|
5098
|
-
data: await fetchAPIResponse.text(),
|
|
5099
|
-
};
|
|
5100
|
-
formattedResponse = {
|
|
5101
|
-
headers,
|
|
5102
|
-
result: bodyWithMeta,
|
|
5103
|
-
};
|
|
5104
|
-
}
|
|
5105
|
-
else {
|
|
5106
|
-
const body = await fetchAPIResponse.json();
|
|
5107
|
-
if (body.errors) {
|
|
5108
|
-
formattedResponse = { headers, error: body };
|
|
5109
|
-
}
|
|
5110
|
-
else {
|
|
5111
|
-
formattedResponse = {
|
|
5112
|
-
headers,
|
|
5113
|
-
result: body,
|
|
5114
|
-
};
|
|
5115
|
-
}
|
|
5116
|
-
}
|
|
5117
|
-
return formattedResponse;
|
|
5118
|
-
}, _AbuseIPDBClient_requestData = async function _AbuseIPDBClient_requestData(url, method, headers, body) {
|
|
5119
|
-
return fetch(url, {
|
|
5120
|
-
method,
|
|
5121
|
-
headers,
|
|
5122
|
-
body,
|
|
5123
|
-
});
|
|
5124
|
-
}, _AbuseIPDBClient_formatRequestBulkReport = function _AbuseIPDBClient_formatRequestBulkReport(headers, data) {
|
|
5125
|
-
const { csv } = data;
|
|
5126
|
-
const file = fileFromSync(csv);
|
|
5127
|
-
const formData = new FormData();
|
|
5128
|
-
formData.append('csv', file);
|
|
5129
|
-
return {
|
|
5130
|
-
headers,
|
|
5131
|
-
body: formData,
|
|
5132
|
-
};
|
|
5133
|
-
}, _AbuseIPDBClient_formatUrl = function _AbuseIPDBClient_formatUrl(uri, params) {
|
|
5134
|
-
const url = new URL(`${__classPrivateFieldGet(this, _AbuseIPDBClient_url, "f")}/${uri}`);
|
|
5135
|
-
for (const key of Object.keys(params ?? {})) {
|
|
5136
|
-
url.searchParams.append(key, params?.[key]);
|
|
5137
|
-
}
|
|
5138
|
-
return url.href;
|
|
5139
|
-
}, _AbuseIPDBClient_validateData = function _AbuseIPDBClient_validateData(parameters, schema) {
|
|
5140
|
-
const result = schema.safeParse(parameters);
|
|
5141
|
-
if (!result.success) {
|
|
5142
|
-
throw result.error;
|
|
5143
|
-
}
|
|
5144
|
-
else {
|
|
5145
|
-
return result.data;
|
|
5146
|
-
}
|
|
5147
|
-
}, _AbuseIPDBClient_handleRequest = async function _AbuseIPDBClient_handleRequest(endpointURI, parameters) {
|
|
5148
|
-
const { method, schema } = ENDPOINTS[endpointURI];
|
|
5149
|
-
// Validates the input parameters given by the client.
|
|
5150
|
-
const validatedInput = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, parameters, schema);
|
|
5151
|
-
let response;
|
|
5152
|
-
if (endpointURI === 'bulk-report') {
|
|
5153
|
-
// There is no need to append QueryParams for the bulk-report endpoint, so it is removed here.
|
|
5154
|
-
const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI);
|
|
5155
|
-
const { headers, body } = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatRequestBulkReport).call(this, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"), parameters);
|
|
5156
|
-
response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, headers, body);
|
|
5157
|
-
}
|
|
5158
|
-
else {
|
|
5159
|
-
const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI, validatedInput);
|
|
5160
|
-
response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"));
|
|
5161
|
-
}
|
|
5162
|
-
// Transforms the API fetch response to the library format.
|
|
5163
|
-
const formattedResponseData = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatResponse).call(this, response);
|
|
5164
|
-
return formattedResponseData;
|
|
4934
|
+
var _AbuseIPDBClient_instances, _AbuseIPDBClient_headers, _AbuseIPDBClient_apiKey, _AbuseIPDBClient_url, _AbuseIPDBClient_setHeaders, _AbuseIPDBClient_buildResponseHeaders, _AbuseIPDBClient_formatResponse, _AbuseIPDBClient_requestData, _AbuseIPDBClient_formatRequestBulkReport, _AbuseIPDBClient_formatUrl, _AbuseIPDBClient_validateData, _AbuseIPDBClient_handleRequest;
|
|
4935
|
+
const ENDPOINTS = {
|
|
4936
|
+
check: {
|
|
4937
|
+
method: 'GET',
|
|
4938
|
+
schema: checkSchema,
|
|
4939
|
+
},
|
|
4940
|
+
reports: {
|
|
4941
|
+
method: 'GET',
|
|
4942
|
+
schema: reportsSchema,
|
|
4943
|
+
},
|
|
4944
|
+
blacklist: {
|
|
4945
|
+
method: 'GET',
|
|
4946
|
+
schema: blacklistSchema,
|
|
4947
|
+
},
|
|
4948
|
+
report: {
|
|
4949
|
+
method: 'POST',
|
|
4950
|
+
schema: reportSchema,
|
|
4951
|
+
},
|
|
4952
|
+
'check-block': {
|
|
4953
|
+
method: 'GET',
|
|
4954
|
+
schema: checkBlockSchema,
|
|
4955
|
+
},
|
|
4956
|
+
'bulk-report': {
|
|
4957
|
+
method: 'POST',
|
|
4958
|
+
schema: bulkReportSchema,
|
|
4959
|
+
},
|
|
4960
|
+
'clear-address': {
|
|
4961
|
+
method: 'DELETE',
|
|
4962
|
+
schema: clearAddressSchema,
|
|
4963
|
+
},
|
|
4964
|
+
};
|
|
4965
|
+
/**
|
|
4966
|
+
* @group Client
|
|
4967
|
+
*/
|
|
4968
|
+
class AbuseIPDBClient {
|
|
4969
|
+
/**
|
|
4970
|
+
* Creates a new AbuseIPDB client, requires an API key from AbuseIPDB's dashboard.
|
|
4971
|
+
* @param apiKey AbuseIPDB client API key.
|
|
4972
|
+
* @param options Optional parameters - {@link AbuseIPDBClientOptions}
|
|
4973
|
+
*/
|
|
4974
|
+
constructor(apiKey, options) {
|
|
4975
|
+
_AbuseIPDBClient_instances.add(this);
|
|
4976
|
+
_AbuseIPDBClient_headers.set(this, void 0);
|
|
4977
|
+
_AbuseIPDBClient_apiKey.set(this, void 0);
|
|
4978
|
+
_AbuseIPDBClient_url.set(this, void 0);
|
|
4979
|
+
const params = { apiKey, ...options };
|
|
4980
|
+
const validatedParams = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, params, abuseIPDBClientSchema);
|
|
4981
|
+
__classPrivateFieldSet(this, _AbuseIPDBClient_apiKey, validatedParams.apiKey, "f");
|
|
4982
|
+
__classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_setHeaders).call(this, validatedParams.apiKey);
|
|
4983
|
+
if (validatedParams?.url) {
|
|
4984
|
+
__classPrivateFieldSet(this, _AbuseIPDBClient_url, validatedParams.url, "f");
|
|
4985
|
+
return;
|
|
4986
|
+
}
|
|
4987
|
+
__classPrivateFieldSet(this, _AbuseIPDBClient_url, BASE_URL, "f");
|
|
4988
|
+
}
|
|
4989
|
+
/**
|
|
4990
|
+
* Returns the current client config.
|
|
4991
|
+
*/
|
|
4992
|
+
getConfig() {
|
|
4993
|
+
return {
|
|
4994
|
+
apiKey: __classPrivateFieldGet(this, _AbuseIPDBClient_apiKey, "f"),
|
|
4995
|
+
url: __classPrivateFieldGet(this, _AbuseIPDBClient_url, "f"),
|
|
4996
|
+
};
|
|
4997
|
+
}
|
|
4998
|
+
/**
|
|
4999
|
+
* @see [Check API Endpoint](https://docs.abuseipdb.com/#check-endpoint)
|
|
5000
|
+
* @param ipAddress Single IPv4/IPv6 address to be verified.
|
|
5001
|
+
* @param options Optional parameters - {@link CheckOptions}
|
|
5002
|
+
*/
|
|
5003
|
+
async check(ipAddress, options) {
|
|
5004
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check', {
|
|
5005
|
+
ipAddress,
|
|
5006
|
+
...options,
|
|
5007
|
+
});
|
|
5008
|
+
}
|
|
5009
|
+
/**
|
|
5010
|
+
* @see [Reports API Endpoint](https://docs.abuseipdb.com/#reports-endpoint)
|
|
5011
|
+
* @param ipAddress Single IPv4/IPv6 address to be verified.
|
|
5012
|
+
* @param options Optional parameters - {@link ReportsOptions}
|
|
5013
|
+
* @beta
|
|
5014
|
+
*/
|
|
5015
|
+
async reports(ipAddress, options) {
|
|
5016
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'reports', { ipAddress, ...options });
|
|
5017
|
+
}
|
|
5018
|
+
/**
|
|
5019
|
+
* @see [Blacklist API Endpoint](https://docs.abuseipdb.com/#blacklist-endpoint)
|
|
5020
|
+
* @param options Optional parameters - {@link BlacklistOptions}
|
|
5021
|
+
*/
|
|
5022
|
+
async blacklist(options) {
|
|
5023
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'blacklist', { ...options });
|
|
5024
|
+
}
|
|
5025
|
+
/**
|
|
5026
|
+
* @see [Report API Endpoint](https://docs.abuseipdb.com/#report-endpoint)
|
|
5027
|
+
* @param ip Single IPv4/IPv6 address to be verified.
|
|
5028
|
+
* @param categories Array of categories to be reported.
|
|
5029
|
+
* @param options Optional parameters - {@link ReportOptions}
|
|
5030
|
+
*/
|
|
5031
|
+
async report(ip, categories, options) {
|
|
5032
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'report', { ip, categories, ...options });
|
|
5033
|
+
}
|
|
5034
|
+
/**
|
|
5035
|
+
* @see [Check-Block API Endpoint](https://docs.abuseipdb.com/#check-block-endpoint)
|
|
5036
|
+
* @param network Single IPv4/IPv6 address block in CIDR format.
|
|
5037
|
+
* @param options Optional parameters - {@link CheckBlockOptions}
|
|
5038
|
+
*/
|
|
5039
|
+
async checkBlock(network, options) {
|
|
5040
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check-block', { network, ...options });
|
|
5041
|
+
}
|
|
5042
|
+
/**
|
|
5043
|
+
* @see [Bulk-Report API Endpoint](https://docs.abuseipdb.com/#bulk-report-endpoint)
|
|
5044
|
+
* @param csv CSV filepath to be sent.
|
|
5045
|
+
*/
|
|
5046
|
+
async bulkReport(csv) {
|
|
5047
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'bulk-report', { csv });
|
|
5048
|
+
}
|
|
5049
|
+
/**
|
|
5050
|
+
* @see [Clear-Address API Endpoint](https://docs.abuseipdb.com/#clear-address-endpoint)
|
|
5051
|
+
* @param ipAddress Single IPv4/IPv6 address.
|
|
5052
|
+
*/
|
|
5053
|
+
async clearAddress(ipAddress) {
|
|
5054
|
+
return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'clear-address', { ipAddress });
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
5057
|
+
_AbuseIPDBClient_headers = new WeakMap(), _AbuseIPDBClient_apiKey = new WeakMap(), _AbuseIPDBClient_url = new WeakMap(), _AbuseIPDBClient_instances = new WeakSet(), _AbuseIPDBClient_setHeaders = function _AbuseIPDBClient_setHeaders(apiKey) {
|
|
5058
|
+
__classPrivateFieldSet(this, _AbuseIPDBClient_headers, {
|
|
5059
|
+
Key: apiKey,
|
|
5060
|
+
Accept: 'application/json',
|
|
5061
|
+
}, "f");
|
|
5062
|
+
}, _AbuseIPDBClient_buildResponseHeaders = function _AbuseIPDBClient_buildResponseHeaders(response) {
|
|
5063
|
+
const headersJson = {};
|
|
5064
|
+
// From fetch response.
|
|
5065
|
+
headersJson.url = response.url;
|
|
5066
|
+
headersJson.status = response.status;
|
|
5067
|
+
headersJson.statusText = response.statusText;
|
|
5068
|
+
// From AbuseIPDB API HTTP headers.
|
|
5069
|
+
const rateLimitKeys = [
|
|
5070
|
+
'retry-after',
|
|
5071
|
+
'x-ratelimit-limit',
|
|
5072
|
+
'x-ratelimit-remaining',
|
|
5073
|
+
'x-ratelimit-reset',
|
|
5074
|
+
'x-generated-at',
|
|
5075
|
+
];
|
|
5076
|
+
for (const key of rateLimitKeys) {
|
|
5077
|
+
const value = response.headers.get(key);
|
|
5078
|
+
if (value) {
|
|
5079
|
+
headersJson[key] = value;
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
return headersJson;
|
|
5083
|
+
}, _AbuseIPDBClient_formatResponse = async function _AbuseIPDBClient_formatResponse(fetchAPIResponse) {
|
|
5084
|
+
const headers = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_buildResponseHeaders).call(this, fetchAPIResponse);
|
|
5085
|
+
let formattedResponse;
|
|
5086
|
+
/**
|
|
5087
|
+
* The `x-generated-at` header is present on blacklist API text endpoint response, it
|
|
5088
|
+
* is formatted here to keep consistency.
|
|
5089
|
+
* @see {@link APIBlacklistEndpointTextResponse}
|
|
5090
|
+
*/
|
|
5091
|
+
if (headers['x-generated-at']) {
|
|
5092
|
+
const xGeneratedAt = headers['x-generated-at'];
|
|
5093
|
+
delete headers['x-generated-at'];
|
|
5094
|
+
const bodyWithMeta = {
|
|
5095
|
+
meta: {
|
|
5096
|
+
generatedAt: xGeneratedAt,
|
|
5097
|
+
},
|
|
5098
|
+
data: await fetchAPIResponse.text(),
|
|
5099
|
+
};
|
|
5100
|
+
formattedResponse = {
|
|
5101
|
+
headers,
|
|
5102
|
+
result: bodyWithMeta,
|
|
5103
|
+
};
|
|
5104
|
+
}
|
|
5105
|
+
else {
|
|
5106
|
+
const body = await fetchAPIResponse.json();
|
|
5107
|
+
if (body.errors) {
|
|
5108
|
+
formattedResponse = { headers, error: body };
|
|
5109
|
+
}
|
|
5110
|
+
else {
|
|
5111
|
+
formattedResponse = {
|
|
5112
|
+
headers,
|
|
5113
|
+
result: body,
|
|
5114
|
+
};
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
return formattedResponse;
|
|
5118
|
+
}, _AbuseIPDBClient_requestData = async function _AbuseIPDBClient_requestData(url, method, headers, body) {
|
|
5119
|
+
return fetch(url, {
|
|
5120
|
+
method,
|
|
5121
|
+
headers,
|
|
5122
|
+
body,
|
|
5123
|
+
});
|
|
5124
|
+
}, _AbuseIPDBClient_formatRequestBulkReport = function _AbuseIPDBClient_formatRequestBulkReport(headers, data) {
|
|
5125
|
+
const { csv } = data;
|
|
5126
|
+
const file = fileFromSync(csv);
|
|
5127
|
+
const formData = new FormData();
|
|
5128
|
+
formData.append('csv', file);
|
|
5129
|
+
return {
|
|
5130
|
+
headers,
|
|
5131
|
+
body: formData,
|
|
5132
|
+
};
|
|
5133
|
+
}, _AbuseIPDBClient_formatUrl = function _AbuseIPDBClient_formatUrl(uri, params) {
|
|
5134
|
+
const url = new URL(`${__classPrivateFieldGet(this, _AbuseIPDBClient_url, "f")}/${uri}`);
|
|
5135
|
+
for (const key of Object.keys(params ?? {})) {
|
|
5136
|
+
url.searchParams.append(key, params?.[key]);
|
|
5137
|
+
}
|
|
5138
|
+
return url.href;
|
|
5139
|
+
}, _AbuseIPDBClient_validateData = function _AbuseIPDBClient_validateData(parameters, schema) {
|
|
5140
|
+
const result = schema.safeParse(parameters);
|
|
5141
|
+
if (!result.success) {
|
|
5142
|
+
throw result.error;
|
|
5143
|
+
}
|
|
5144
|
+
else {
|
|
5145
|
+
return result.data;
|
|
5146
|
+
}
|
|
5147
|
+
}, _AbuseIPDBClient_handleRequest = async function _AbuseIPDBClient_handleRequest(endpointURI, parameters) {
|
|
5148
|
+
const { method, schema } = ENDPOINTS[endpointURI];
|
|
5149
|
+
// Validates the input parameters given by the client.
|
|
5150
|
+
const validatedInput = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, parameters, schema);
|
|
5151
|
+
let response;
|
|
5152
|
+
if (endpointURI === 'bulk-report') {
|
|
5153
|
+
// There is no need to append QueryParams for the bulk-report endpoint, so it is removed here.
|
|
5154
|
+
const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI);
|
|
5155
|
+
const { headers, body } = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatRequestBulkReport).call(this, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"), parameters);
|
|
5156
|
+
response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, headers, body);
|
|
5157
|
+
}
|
|
5158
|
+
else {
|
|
5159
|
+
const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI, validatedInput);
|
|
5160
|
+
response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"));
|
|
5161
|
+
}
|
|
5162
|
+
// Transforms the API fetch response to the library format.
|
|
5163
|
+
const formattedResponseData = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatResponse).call(this, response);
|
|
5164
|
+
return formattedResponseData;
|
|
5165
5165
|
};
|
|
5166
5166
|
|
|
5167
|
-
/**
|
|
5168
|
-
* AbuseIPDB Report Category types.
|
|
5169
|
-
* @see [AbuseIPDB Report Categories](https://www.abuseipdb.com/categories)
|
|
5170
|
-
* @enum
|
|
5171
|
-
* @group AbuseIPDB API Response
|
|
5172
|
-
* @example
|
|
5173
|
-
* ```typescript
|
|
5174
|
-
* import { ReportCategory } from 'abuseipdb-client';
|
|
5175
|
-
*
|
|
5176
|
-
* // `ReportCategory` enum can be used to populate an array of categories.
|
|
5177
|
-
* const categories: Array<ReportCategory> = [
|
|
5178
|
-
* ReportCategory.WebSpam,
|
|
5179
|
-
* ReportCategory.BadWebBot,
|
|
5180
|
-
* ReportCategory.BruteForce,
|
|
5181
|
-
* ];
|
|
5182
|
-
*
|
|
5183
|
-
* // Which translates to:
|
|
5184
|
-
* // categories = [ 10, 19, 18 ].
|
|
5185
|
-
*
|
|
5186
|
-
* // That way, it is possible to call the `report` endpoint using this reference directly:
|
|
5187
|
-
* client.report('127.0.0.1', categories);
|
|
5188
|
-
* ```
|
|
5189
|
-
*/
|
|
5190
|
-
exports.ReportCategory = void 0;
|
|
5191
|
-
(function (ReportCategory) {
|
|
5192
|
-
/**
|
|
5193
|
-
* Altering DNS records resulting in improper redirection.
|
|
5194
|
-
*/
|
|
5195
|
-
ReportCategory[ReportCategory["DNSCompromise"] = 1] = "DNSCompromise";
|
|
5196
|
-
/**
|
|
5197
|
-
* Falsifying domain server cache (cache poisoning).
|
|
5198
|
-
*/
|
|
5199
|
-
ReportCategory[ReportCategory["DNSPoisoning"] = 2] = "DNSPoisoning";
|
|
5200
|
-
/**
|
|
5201
|
-
* Fraudulent orders.
|
|
5202
|
-
*/
|
|
5203
|
-
ReportCategory[ReportCategory["FraudOrders"] = 3] = "FraudOrders";
|
|
5204
|
-
/**
|
|
5205
|
-
* Participating in distributed denial-of-service (usually part of botnet).
|
|
5206
|
-
*/
|
|
5207
|
-
ReportCategory[ReportCategory["DDOSAttack"] = 4] = "DDOSAttack";
|
|
5208
|
-
/**
|
|
5209
|
-
* FTP Brute force attempt.
|
|
5210
|
-
*/
|
|
5211
|
-
ReportCategory[ReportCategory["FTPBruteForce"] = 5] = "FTPBruteForce";
|
|
5212
|
-
/**
|
|
5213
|
-
* Oversized IP packet.
|
|
5214
|
-
*/
|
|
5215
|
-
ReportCategory[ReportCategory["PingOfDeath"] = 6] = "PingOfDeath";
|
|
5216
|
-
/**
|
|
5217
|
-
* Phishing websites and/or email.
|
|
5218
|
-
*/
|
|
5219
|
-
ReportCategory[ReportCategory["Phishing"] = 7] = "Phishing";
|
|
5220
|
-
/**
|
|
5221
|
-
* Voice-over-IP fraud.
|
|
5222
|
-
*/
|
|
5223
|
-
ReportCategory[ReportCategory["FraudVoIP"] = 8] = "FraudVoIP";
|
|
5224
|
-
/**
|
|
5225
|
-
* Open proxy, open relay, or Tor exit node.
|
|
5226
|
-
*/
|
|
5227
|
-
ReportCategory[ReportCategory["OpenProxy"] = 9] = "OpenProxy";
|
|
5228
|
-
/**
|
|
5229
|
-
* Comment/forum spam, HTTP referer spam, or other CMS spam.
|
|
5230
|
-
*/
|
|
5231
|
-
ReportCategory[ReportCategory["WebSpam"] = 10] = "WebSpam";
|
|
5232
|
-
/**
|
|
5233
|
-
* Spam email content, infected attachments, and phishing emails. Note: Limit comments to only relevent information (instead of log dumps) and be sure to remove PII if you want to remain anonymous.
|
|
5234
|
-
*/
|
|
5235
|
-
ReportCategory[ReportCategory["EmailSpam"] = 11] = "EmailSpam";
|
|
5236
|
-
/**
|
|
5237
|
-
* CMS blog comment spam.
|
|
5238
|
-
*/
|
|
5239
|
-
ReportCategory[ReportCategory["BlogSpam"] = 12] = "BlogSpam";
|
|
5240
|
-
/**
|
|
5241
|
-
* VPN IP address.
|
|
5242
|
-
*/
|
|
5243
|
-
ReportCategory[ReportCategory["VPNIP"] = 13] = "VPNIP";
|
|
5244
|
-
/**
|
|
5245
|
-
* Scanning for open ports and vulnerable services.
|
|
5246
|
-
*/
|
|
5247
|
-
ReportCategory[ReportCategory["PortScan"] = 14] = "PortScan";
|
|
5248
|
-
/**
|
|
5249
|
-
* General hacking attempt.
|
|
5250
|
-
*/
|
|
5251
|
-
ReportCategory[ReportCategory["Hacking"] = 15] = "Hacking";
|
|
5252
|
-
/**
|
|
5253
|
-
* Attempts at SQL injection.
|
|
5254
|
-
*/
|
|
5255
|
-
ReportCategory[ReportCategory["SQLInjection"] = 16] = "SQLInjection";
|
|
5256
|
-
/**
|
|
5257
|
-
* Email sender spoofing.
|
|
5258
|
-
*/
|
|
5259
|
-
ReportCategory[ReportCategory["Spoofing"] = 17] = "Spoofing";
|
|
5260
|
-
/**
|
|
5261
|
-
* Credential brute-force attacks on webpage logins and services like SSH, FTP, SIP, SMTP, RDP, etc. This category is seperate from DDoS attacks.
|
|
5262
|
-
*/
|
|
5263
|
-
ReportCategory[ReportCategory["BruteForce"] = 18] = "BruteForce";
|
|
5264
|
-
/**
|
|
5265
|
-
* Webpage scraping (for email addresses, content, etc) and crawlers that do not honor robots.txt. Excessive requests and user agent spoofing can also be reported here.
|
|
5266
|
-
*/
|
|
5267
|
-
ReportCategory[ReportCategory["BadWebBot"] = 19] = "BadWebBot";
|
|
5268
|
-
/**
|
|
5269
|
-
* Host is likely infected with malware and being used for other attacks or to host malicious content. The host owner may not be aware of the compromise. This category is often used in combination with other attack categories.
|
|
5270
|
-
*/
|
|
5271
|
-
ReportCategory[ReportCategory["ExploitedHost"] = 20] = "ExploitedHost";
|
|
5272
|
-
/**
|
|
5273
|
-
* Attempts to probe for or exploit installed web applications such as a CMS like WordPress/Drupal, e-commerce solutions, forum software, phpMyAdmin and various other software plugins/solutions.
|
|
5274
|
-
*/
|
|
5275
|
-
ReportCategory[ReportCategory["WebAppAttack"] = 21] = "WebAppAttack";
|
|
5276
|
-
/**
|
|
5277
|
-
* Secure Shell (SSH) abuse. Use this category in combination with more specific categories.
|
|
5278
|
-
*/
|
|
5279
|
-
ReportCategory[ReportCategory["SSH"] = 22] = "SSH";
|
|
5280
|
-
/**
|
|
5281
|
-
* Abuse was targeted at an "Internet of Things" type device. Include information about what type of device was targeted in the comments.
|
|
5282
|
-
*/
|
|
5283
|
-
ReportCategory[ReportCategory["IOTTargeted"] = 23] = "IOTTargeted";
|
|
5167
|
+
/**
|
|
5168
|
+
* AbuseIPDB Report Category types.
|
|
5169
|
+
* @see [AbuseIPDB Report Categories](https://www.abuseipdb.com/categories)
|
|
5170
|
+
* @enum
|
|
5171
|
+
* @group AbuseIPDB API Response
|
|
5172
|
+
* @example
|
|
5173
|
+
* ```typescript
|
|
5174
|
+
* import { ReportCategory } from 'abuseipdb-client';
|
|
5175
|
+
*
|
|
5176
|
+
* // `ReportCategory` enum can be used to populate an array of categories.
|
|
5177
|
+
* const categories: Array<ReportCategory> = [
|
|
5178
|
+
* ReportCategory.WebSpam,
|
|
5179
|
+
* ReportCategory.BadWebBot,
|
|
5180
|
+
* ReportCategory.BruteForce,
|
|
5181
|
+
* ];
|
|
5182
|
+
*
|
|
5183
|
+
* // Which translates to:
|
|
5184
|
+
* // categories = [ 10, 19, 18 ].
|
|
5185
|
+
*
|
|
5186
|
+
* // That way, it is possible to call the `report` endpoint using this reference directly:
|
|
5187
|
+
* client.report('127.0.0.1', categories);
|
|
5188
|
+
* ```
|
|
5189
|
+
*/
|
|
5190
|
+
exports.ReportCategory = void 0;
|
|
5191
|
+
(function (ReportCategory) {
|
|
5192
|
+
/**
|
|
5193
|
+
* Altering DNS records resulting in improper redirection.
|
|
5194
|
+
*/
|
|
5195
|
+
ReportCategory[ReportCategory["DNSCompromise"] = 1] = "DNSCompromise";
|
|
5196
|
+
/**
|
|
5197
|
+
* Falsifying domain server cache (cache poisoning).
|
|
5198
|
+
*/
|
|
5199
|
+
ReportCategory[ReportCategory["DNSPoisoning"] = 2] = "DNSPoisoning";
|
|
5200
|
+
/**
|
|
5201
|
+
* Fraudulent orders.
|
|
5202
|
+
*/
|
|
5203
|
+
ReportCategory[ReportCategory["FraudOrders"] = 3] = "FraudOrders";
|
|
5204
|
+
/**
|
|
5205
|
+
* Participating in distributed denial-of-service (usually part of botnet).
|
|
5206
|
+
*/
|
|
5207
|
+
ReportCategory[ReportCategory["DDOSAttack"] = 4] = "DDOSAttack";
|
|
5208
|
+
/**
|
|
5209
|
+
* FTP Brute force attempt.
|
|
5210
|
+
*/
|
|
5211
|
+
ReportCategory[ReportCategory["FTPBruteForce"] = 5] = "FTPBruteForce";
|
|
5212
|
+
/**
|
|
5213
|
+
* Oversized IP packet.
|
|
5214
|
+
*/
|
|
5215
|
+
ReportCategory[ReportCategory["PingOfDeath"] = 6] = "PingOfDeath";
|
|
5216
|
+
/**
|
|
5217
|
+
* Phishing websites and/or email.
|
|
5218
|
+
*/
|
|
5219
|
+
ReportCategory[ReportCategory["Phishing"] = 7] = "Phishing";
|
|
5220
|
+
/**
|
|
5221
|
+
* Voice-over-IP fraud.
|
|
5222
|
+
*/
|
|
5223
|
+
ReportCategory[ReportCategory["FraudVoIP"] = 8] = "FraudVoIP";
|
|
5224
|
+
/**
|
|
5225
|
+
* Open proxy, open relay, or Tor exit node.
|
|
5226
|
+
*/
|
|
5227
|
+
ReportCategory[ReportCategory["OpenProxy"] = 9] = "OpenProxy";
|
|
5228
|
+
/**
|
|
5229
|
+
* Comment/forum spam, HTTP referer spam, or other CMS spam.
|
|
5230
|
+
*/
|
|
5231
|
+
ReportCategory[ReportCategory["WebSpam"] = 10] = "WebSpam";
|
|
5232
|
+
/**
|
|
5233
|
+
* Spam email content, infected attachments, and phishing emails. Note: Limit comments to only relevent information (instead of log dumps) and be sure to remove PII if you want to remain anonymous.
|
|
5234
|
+
*/
|
|
5235
|
+
ReportCategory[ReportCategory["EmailSpam"] = 11] = "EmailSpam";
|
|
5236
|
+
/**
|
|
5237
|
+
* CMS blog comment spam.
|
|
5238
|
+
*/
|
|
5239
|
+
ReportCategory[ReportCategory["BlogSpam"] = 12] = "BlogSpam";
|
|
5240
|
+
/**
|
|
5241
|
+
* VPN IP address.
|
|
5242
|
+
*/
|
|
5243
|
+
ReportCategory[ReportCategory["VPNIP"] = 13] = "VPNIP";
|
|
5244
|
+
/**
|
|
5245
|
+
* Scanning for open ports and vulnerable services.
|
|
5246
|
+
*/
|
|
5247
|
+
ReportCategory[ReportCategory["PortScan"] = 14] = "PortScan";
|
|
5248
|
+
/**
|
|
5249
|
+
* General hacking attempt.
|
|
5250
|
+
*/
|
|
5251
|
+
ReportCategory[ReportCategory["Hacking"] = 15] = "Hacking";
|
|
5252
|
+
/**
|
|
5253
|
+
* Attempts at SQL injection.
|
|
5254
|
+
*/
|
|
5255
|
+
ReportCategory[ReportCategory["SQLInjection"] = 16] = "SQLInjection";
|
|
5256
|
+
/**
|
|
5257
|
+
* Email sender spoofing.
|
|
5258
|
+
*/
|
|
5259
|
+
ReportCategory[ReportCategory["Spoofing"] = 17] = "Spoofing";
|
|
5260
|
+
/**
|
|
5261
|
+
* Credential brute-force attacks on webpage logins and services like SSH, FTP, SIP, SMTP, RDP, etc. This category is seperate from DDoS attacks.
|
|
5262
|
+
*/
|
|
5263
|
+
ReportCategory[ReportCategory["BruteForce"] = 18] = "BruteForce";
|
|
5264
|
+
/**
|
|
5265
|
+
* Webpage scraping (for email addresses, content, etc) and crawlers that do not honor robots.txt. Excessive requests and user agent spoofing can also be reported here.
|
|
5266
|
+
*/
|
|
5267
|
+
ReportCategory[ReportCategory["BadWebBot"] = 19] = "BadWebBot";
|
|
5268
|
+
/**
|
|
5269
|
+
* Host is likely infected with malware and being used for other attacks or to host malicious content. The host owner may not be aware of the compromise. This category is often used in combination with other attack categories.
|
|
5270
|
+
*/
|
|
5271
|
+
ReportCategory[ReportCategory["ExploitedHost"] = 20] = "ExploitedHost";
|
|
5272
|
+
/**
|
|
5273
|
+
* Attempts to probe for or exploit installed web applications such as a CMS like WordPress/Drupal, e-commerce solutions, forum software, phpMyAdmin and various other software plugins/solutions.
|
|
5274
|
+
*/
|
|
5275
|
+
ReportCategory[ReportCategory["WebAppAttack"] = 21] = "WebAppAttack";
|
|
5276
|
+
/**
|
|
5277
|
+
* Secure Shell (SSH) abuse. Use this category in combination with more specific categories.
|
|
5278
|
+
*/
|
|
5279
|
+
ReportCategory[ReportCategory["SSH"] = 22] = "SSH";
|
|
5280
|
+
/**
|
|
5281
|
+
* Abuse was targeted at an "Internet of Things" type device. Include information about what type of device was targeted in the comments.
|
|
5282
|
+
*/
|
|
5283
|
+
ReportCategory[ReportCategory["IOTTargeted"] = 23] = "IOTTargeted";
|
|
5284
5284
|
})(exports.ReportCategory || (exports.ReportCategory = {}));
|
|
5285
5285
|
|
|
5286
5286
|
exports.AbuseIPDBClient = AbuseIPDBClient;
|