chapybara 0.1.1 → 0.2.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/index.d.ts +210 -23
- package/index.js +3 -2
- package/package.json +2 -3
package/index.d.ts
CHANGED
|
@@ -9,27 +9,186 @@ declare module "chapybara" {
|
|
|
9
9
|
cacheOptions?: LRUCache.Options<string, any, unknown>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface MxRecord {
|
|
13
|
+
priority: number;
|
|
14
|
+
exchange: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface SoaRecord {
|
|
18
|
+
nsname: string;
|
|
19
|
+
hostmaster: string;
|
|
20
|
+
serial: number;
|
|
21
|
+
refresh: number;
|
|
22
|
+
retry: number;
|
|
23
|
+
expire: number;
|
|
24
|
+
minttl: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface CaaRecord {
|
|
28
|
+
critical: number;
|
|
29
|
+
issue: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface TlsCertificate {
|
|
33
|
+
subject: Record<string, string>;
|
|
34
|
+
issuer: Record<string, string>;
|
|
35
|
+
subject_alternative_names: string[];
|
|
36
|
+
valid_from: string;
|
|
37
|
+
valid_to: string;
|
|
38
|
+
days_until_expiry: number;
|
|
39
|
+
is_expired: boolean;
|
|
40
|
+
is_self_signed: boolean;
|
|
41
|
+
fingerprint: string;
|
|
42
|
+
fingerprint256: string;
|
|
43
|
+
serial_number: string;
|
|
44
|
+
signature_algorithm: string;
|
|
45
|
+
public_key_algorithm: string | null;
|
|
46
|
+
key_size: number;
|
|
47
|
+
protocol: string;
|
|
48
|
+
cipher: { name: string; version: string };
|
|
49
|
+
}
|
|
50
|
+
|
|
13
51
|
interface DomainIntelligenceResponse {
|
|
14
|
-
domain_identity:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
52
|
+
domain_identity: {
|
|
53
|
+
domain: string;
|
|
54
|
+
punycode: string;
|
|
55
|
+
subdomain: string | null;
|
|
56
|
+
domain_name: string;
|
|
57
|
+
tld: string;
|
|
58
|
+
is_subdomain: boolean;
|
|
59
|
+
domain_hash: string;
|
|
60
|
+
};
|
|
61
|
+
classification: {
|
|
62
|
+
types: string[];
|
|
63
|
+
};
|
|
64
|
+
dns_records: {
|
|
65
|
+
A: string[] | null;
|
|
66
|
+
AAAA: string[] | null;
|
|
67
|
+
MX: MxRecord[] | null;
|
|
68
|
+
TXT: string[] | null;
|
|
69
|
+
NS: string[] | null;
|
|
70
|
+
CNAME: string[] | null;
|
|
71
|
+
SOA: SoaRecord | null;
|
|
72
|
+
CAA: CaaRecord[] | null;
|
|
73
|
+
PTR: string[] | null;
|
|
74
|
+
};
|
|
75
|
+
dns_analysis: {
|
|
76
|
+
spf: { record: string | null; valid: boolean };
|
|
77
|
+
dmarc: { record: string | null; valid: boolean };
|
|
78
|
+
dkim: { record: string | null; valid: boolean };
|
|
79
|
+
has_mx: boolean;
|
|
80
|
+
has_caa: boolean;
|
|
81
|
+
wildcard_cert: boolean;
|
|
82
|
+
subdomain_takeover_risk: boolean;
|
|
83
|
+
};
|
|
84
|
+
tls_certificate: TlsCertificate | null;
|
|
85
|
+
network_details: {
|
|
86
|
+
ip_addresses: {
|
|
87
|
+
ipv4: string[];
|
|
88
|
+
ipv6: string[];
|
|
89
|
+
};
|
|
90
|
+
mail_servers: MxRecord[] | null;
|
|
91
|
+
nameservers: string[] | null;
|
|
92
|
+
hosting_provider: string | null;
|
|
93
|
+
};
|
|
94
|
+
security_analysis: {
|
|
95
|
+
is_malicious: boolean;
|
|
96
|
+
threat_sources: string[];
|
|
97
|
+
risk_assessment: {
|
|
98
|
+
risk_score: number;
|
|
99
|
+
threat_types: string[];
|
|
100
|
+
risk_level: string;
|
|
101
|
+
};
|
|
102
|
+
is_disposable_email: boolean;
|
|
103
|
+
};
|
|
104
|
+
metadata: {
|
|
105
|
+
data_freshness: {
|
|
106
|
+
last_update_check: string;
|
|
107
|
+
};
|
|
108
|
+
timestamp: string;
|
|
109
|
+
response_time_ms: number;
|
|
110
|
+
request_id: string;
|
|
111
|
+
};
|
|
22
112
|
}
|
|
23
113
|
|
|
24
114
|
interface IPIntelligenceResponse {
|
|
25
115
|
ip: string;
|
|
26
116
|
hostnames: string[];
|
|
27
|
-
location:
|
|
28
|
-
|
|
117
|
+
location: {
|
|
118
|
+
continent: {
|
|
119
|
+
name: string | null;
|
|
120
|
+
code: string | null;
|
|
121
|
+
hemisphere: string[];
|
|
122
|
+
};
|
|
123
|
+
country: {
|
|
124
|
+
name: string | null;
|
|
125
|
+
code: string | null;
|
|
126
|
+
alpha3_code: string | null;
|
|
127
|
+
numeric_code: number | null;
|
|
128
|
+
capital: string | null;
|
|
129
|
+
demonym: string | null;
|
|
130
|
+
population: number | null;
|
|
131
|
+
total_area: number | null;
|
|
132
|
+
tld: string | null;
|
|
133
|
+
currency: {
|
|
134
|
+
code: string;
|
|
135
|
+
name: string;
|
|
136
|
+
symbol: string;
|
|
137
|
+
} | null;
|
|
138
|
+
language: {
|
|
139
|
+
code: string;
|
|
140
|
+
name: string;
|
|
141
|
+
} | null;
|
|
142
|
+
calling_codes: string | null;
|
|
143
|
+
};
|
|
144
|
+
region: {
|
|
145
|
+
name: string | null;
|
|
146
|
+
code: string | null;
|
|
147
|
+
};
|
|
148
|
+
city: {
|
|
149
|
+
name: string | null;
|
|
150
|
+
};
|
|
151
|
+
latitude: number | null;
|
|
152
|
+
longitude: number | null;
|
|
153
|
+
zip_code: string | null;
|
|
154
|
+
accuracy_radius: number | null;
|
|
155
|
+
};
|
|
156
|
+
network: {
|
|
157
|
+
asn: string | null;
|
|
158
|
+
organization: string | null;
|
|
159
|
+
isp: string | null;
|
|
160
|
+
usage_type: string | null;
|
|
161
|
+
net_speed: string | null;
|
|
162
|
+
mobile: {
|
|
163
|
+
is_mobile: boolean;
|
|
164
|
+
mcc: string | null;
|
|
165
|
+
mnc: string | null;
|
|
166
|
+
brand: string | null;
|
|
167
|
+
};
|
|
168
|
+
registration_date: string | null;
|
|
169
|
+
};
|
|
29
170
|
time_zone: string | null;
|
|
30
|
-
security:
|
|
31
|
-
|
|
32
|
-
|
|
171
|
+
security: {
|
|
172
|
+
is_proxy: boolean;
|
|
173
|
+
proxy_type: string | null;
|
|
174
|
+
is_tor: boolean;
|
|
175
|
+
is_vpn: boolean;
|
|
176
|
+
is_datacenter: boolean;
|
|
177
|
+
is_spammer: boolean;
|
|
178
|
+
threat_level: string;
|
|
179
|
+
};
|
|
180
|
+
ads: {
|
|
181
|
+
category_code: string;
|
|
182
|
+
category_name: string;
|
|
183
|
+
};
|
|
184
|
+
metadata: {
|
|
185
|
+
data_freshness: {
|
|
186
|
+
last_update_check: string;
|
|
187
|
+
};
|
|
188
|
+
timestamp: string;
|
|
189
|
+
response_time_ms: number;
|
|
190
|
+
request_id: string;
|
|
191
|
+
};
|
|
33
192
|
}
|
|
34
193
|
|
|
35
194
|
interface WebTechResponse {
|
|
@@ -37,15 +196,43 @@ declare module "chapybara" {
|
|
|
37
196
|
final_url: string;
|
|
38
197
|
status_code: number;
|
|
39
198
|
title: string | null;
|
|
40
|
-
|
|
199
|
+
html_lang: string | null;
|
|
200
|
+
meta: {
|
|
201
|
+
description: string | null;
|
|
202
|
+
keywords: string | null;
|
|
203
|
+
generator: string | null;
|
|
204
|
+
all_meta: Record<string, any>[];
|
|
205
|
+
open_graph: Record<string, any>;
|
|
206
|
+
twitter: Record<string, any>;
|
|
207
|
+
robots: string | null;
|
|
208
|
+
};
|
|
41
209
|
headers: Record<string, string | string[]>;
|
|
42
210
|
security_headers: Record<string, string | string[]>;
|
|
43
211
|
cookies: string[];
|
|
44
|
-
links:
|
|
45
|
-
|
|
212
|
+
links: {
|
|
213
|
+
canonical: string | null;
|
|
214
|
+
favicon: string | null;
|
|
215
|
+
manifest: string | null;
|
|
216
|
+
};
|
|
217
|
+
structure: {
|
|
218
|
+
script_count: number;
|
|
219
|
+
stylesheet_count: number;
|
|
220
|
+
image_count: number;
|
|
221
|
+
form_count: number;
|
|
222
|
+
anchor_count: number;
|
|
223
|
+
external_links: number;
|
|
224
|
+
internal_links: number;
|
|
225
|
+
};
|
|
46
226
|
technologies: string[];
|
|
47
227
|
redirect_chain: any[];
|
|
48
|
-
metadata:
|
|
228
|
+
metadata: {
|
|
229
|
+
data_freshness: {
|
|
230
|
+
last_update_check: string;
|
|
231
|
+
};
|
|
232
|
+
timestamp: string;
|
|
233
|
+
request_id: string;
|
|
234
|
+
response_time_ms: number;
|
|
235
|
+
};
|
|
49
236
|
}
|
|
50
237
|
|
|
51
238
|
interface AccountInfoResponse {
|
|
@@ -60,10 +247,12 @@ declare module "chapybara" {
|
|
|
60
247
|
requests_made: number;
|
|
61
248
|
allowed_endpoints: string[];
|
|
62
249
|
};
|
|
63
|
-
metadata:
|
|
250
|
+
metadata: {
|
|
251
|
+
response_time_ms: number;
|
|
252
|
+
request_id: string;
|
|
253
|
+
};
|
|
64
254
|
}
|
|
65
255
|
|
|
66
|
-
// Error Types
|
|
67
256
|
export class ChapybaraError extends Error {}
|
|
68
257
|
export class APIError extends ChapybaraError {
|
|
69
258
|
status: number;
|
|
@@ -80,9 +269,7 @@ declare module "chapybara" {
|
|
|
80
269
|
constructor(options: ChapybaraClientOptions);
|
|
81
270
|
|
|
82
271
|
domain: {
|
|
83
|
-
getIntelligence: (
|
|
84
|
-
domain: string,
|
|
85
|
-
) => Promise<DomainIntelligenceResponse>;
|
|
272
|
+
getIntelligence: (domain: string) => Promise<DomainIntelligenceResponse>;
|
|
86
273
|
};
|
|
87
274
|
|
|
88
275
|
ip: {
|
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fetch from "node-fetch";
|
|
2
1
|
import { LRUCache } from "lru-cache";
|
|
3
2
|
import { APIError, AuthenticationError, BadRequestError, NotFoundError, RateLimitError, ServerError } from "./lib/errors.js";
|
|
4
3
|
|
|
@@ -6,6 +5,8 @@ const DEFAULT_BASE_URL = "https://api.chapyapi.com/api/v1";
|
|
|
6
5
|
const DEFAULT_RETRIES = 2;
|
|
7
6
|
const DEFAULT_TIMEOUT = 20000;
|
|
8
7
|
|
|
8
|
+
const SDK_VERSION = "0.2.1";
|
|
9
|
+
|
|
9
10
|
export class ChapybaraClient {
|
|
10
11
|
constructor(options) {
|
|
11
12
|
if (!options || !options.apiKey) {
|
|
@@ -55,7 +56,7 @@ export class ChapybaraClient {
|
|
|
55
56
|
headers: {
|
|
56
57
|
"X-API-Key": this.apiKey,
|
|
57
58
|
"Content-Type": "application/json",
|
|
58
|
-
"User-Agent":
|
|
59
|
+
"User-Agent": `Chapybara-NodeJS-SDK/${SDK_VERSION}`,
|
|
59
60
|
},
|
|
60
61
|
signal: controller.signal,
|
|
61
62
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chapybara",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Official NodeJS SDK for the Chapybara Domain & IP Intelligence API.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"author": "Alpha System",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"lru-cache": "^11.2.1"
|
|
24
|
-
"node-fetch": "^3.3.2"
|
|
23
|
+
"lru-cache": "^11.2.1"
|
|
25
24
|
},
|
|
26
25
|
"engines": {
|
|
27
26
|
"node": ">=18.0.0"
|