Skip to content

Commit fe69b0d

Browse files
authored
Merging pull request #17742
* new components * pnpm-lock.yaml
1 parent aa12d70 commit fe69b0d

File tree

9 files changed

+296
-6
lines changed

9 files changed

+296
-6
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-dns-record-lookup",
5+
name: "DNS Record Lookup",
6+
description: "Performs a DNS record lookup to retrieve various DNS record types for a domain. [See the documentation](https://viewdns.info/api/dns-record-lookup/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
domain: {
12+
type: "string",
13+
label: "Domain",
14+
description: "The hostname to retrieve DNS records for (e.g., example.com).",
15+
},
16+
recordType: {
17+
type: "string",
18+
label: "Record Type",
19+
description: "The type of DNS record to retrieve (e.g., A,AAAA,MX,TXT,ANY).",
20+
optional: true,
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.viewdnsInfo.dnsLookup({
25+
$,
26+
params: {
27+
domain: this.domain,
28+
recordtype: this.recordType,
29+
},
30+
});
31+
32+
$.export("$summary", `Retrieved DNS records for ${this.domain}.`);
33+
34+
return response;
35+
},
36+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-ip-history",
5+
name: "IP History",
6+
description: "Retrieves the IP address history for a domain. [See the documentation](https://viewdns.info/api/ip-history/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
domain: {
12+
type: "string",
13+
label: "Domain",
14+
description: "The domain name to retrieve the historical IP addresses for (e.g., example.com).",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.viewdnsInfo.ipHistory({
19+
$,
20+
params: {
21+
domain: this.domain,
22+
},
23+
});
24+
25+
$.export("$summary", `Retrieved IP history for ${this.domain}.`);
26+
27+
return response;
28+
},
29+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-reverse-ip-lookup",
5+
name: "Reverse IP Lookup",
6+
description: "Performs a reverse IP lookup to find domains hosted on the same IP address. [See the documentation](https://viewdns.info/api/reverse-ip-lookup/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
host: {
12+
type: "string",
13+
label: "Host",
14+
description: "The domain or IP to perform the reverse IP lookup on (e.g., example.com)",
15+
},
16+
},
17+
async run({ $ }) {
18+
const results = await this.viewdnsInfo.getPaginatedResources({
19+
fn: this.viewdnsInfo.reverseIpLookup,
20+
args: {
21+
$,
22+
params: {
23+
host: this.host,
24+
},
25+
},
26+
resourceKey: "domains",
27+
});
28+
29+
$.export("$summary", `Found ${results.length} domain${results.length === 1
30+
? ""
31+
: "s"} hosted on the IP address.`);
32+
33+
return results;
34+
},
35+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-reverse-whois-lookup",
5+
name: "Reverse Whois Lookup",
6+
description: "Performs a reverse WHOIS search to find domains registered by the same person or organization. [See the documentation](https://viewdns.info/api/reverse-whois-lookup/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
q: {
12+
type: "string",
13+
label: "Query",
14+
description: "The registrant name or email address to search for (e.g., domain@example.com).",
15+
},
16+
},
17+
async run({ $ }) {
18+
const results = await this.viewdnsInfo.getPaginatedResources({
19+
fn: this.viewdnsInfo.reverseWhoisLookup,
20+
args: {
21+
$,
22+
params: {
23+
q: this.q,
24+
},
25+
},
26+
resourceKey: "matches",
27+
});
28+
29+
$.export("$summary", `Found ${results.length} domain${results.length === 1
30+
? ""
31+
: "s"} matching the query.`);
32+
33+
return results;
34+
},
35+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-subdomain-discovery",
5+
name: "Subdomain Discovery",
6+
description: "Discovers subdomains associated with a given domain. [See the documentation](https://viewdns.info/api/subdomain-discovery/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
domain: {
12+
type: "string",
13+
label: "Domain",
14+
description: "The domain name to retrieve subdomains for (e.g., example.com).",
15+
},
16+
},
17+
async run({ $ }) {
18+
const results = await this.viewdnsInfo.getPaginatedResources({
19+
fn: this.viewdnsInfo.subdomainDiscovery,
20+
args: {
21+
$,
22+
params: {
23+
domain: this.domain,
24+
},
25+
},
26+
resourceKey: "subdomains",
27+
});
28+
29+
$.export("$summary", `Found ${results.length} subdomain${results.length === 1
30+
? ""
31+
: "s"} for ${this.domain}.`);
32+
33+
return results;
34+
},
35+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import viewdnsInfo from "../../viewdns_info.app.mjs";
2+
3+
export default {
4+
key: "viewdns_info-whois-lookup",
5+
name: "Whois Lookup",
6+
description: "Performs a WHOIS lookup to retrieve domain registration information. [See the documentation](https://viewdns.info/api/whois/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
viewdnsInfo,
11+
domain: {
12+
type: "string",
13+
label: "Domain",
14+
description: "The domain or IP to perform a whois lookup on (e.g., example.com)",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.viewdnsInfo.whoisLookup({
19+
$,
20+
params: {
21+
domain: this.domain,
22+
},
23+
});
24+
25+
$.export("$summary", `Successfully retrieved WHOIS information for ${this.domain}`);
26+
27+
return response;
28+
},
29+
};

components/viewdns_info/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/viewdns_info",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream ViewDNS.info Components",
55
"main": "viewdns_info.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}
Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,95 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "viewdns_info",
46
propDefinitions: {},
57
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
8+
_baseUrl() {
9+
return "https://api.viewdns.info";
10+
},
11+
_makeRequest({
12+
$ = this, path, params = {}, ...opts
13+
}) {
14+
return axios($, {
15+
url: `${this._baseUrl()}${path}`,
16+
params: {
17+
...params,
18+
apikey: `${this.$auth.api_key}`,
19+
output: "json",
20+
},
21+
...opts,
22+
});
23+
},
24+
whoisLookup(opts = {}) {
25+
return this._makeRequest({
26+
path: "/whois/v2",
27+
...opts,
28+
});
29+
},
30+
reverseWhoisLookup(opts = {}) {
31+
return this._makeRequest({
32+
path: "/reversewhois/",
33+
...opts,
34+
});
35+
},
36+
subdomainDiscovery(opts = {}) {
37+
return this._makeRequest({
38+
path: "/subdomains/",
39+
...opts,
40+
});
41+
},
42+
reverseIpLookup(opts = {}) {
43+
return this._makeRequest({
44+
path: "/reverseip/",
45+
...opts,
46+
});
47+
},
48+
ipHistory(opts = {}) {
49+
return this._makeRequest({
50+
path: "/iphistory/",
51+
...opts,
52+
});
53+
},
54+
dnsLookup(opts = {}) {
55+
return this._makeRequest({
56+
path: "/dnsrecord/",
57+
...opts,
58+
});
59+
},
60+
async *paginate({
61+
fn, args, resourceKey, max,
62+
}) {
63+
args = {
64+
...args,
65+
params: {
66+
...args?.params,
67+
page: 1,
68+
},
69+
};
70+
let totalPages, count = 0;
71+
do {
72+
const { response } = await fn(args);
73+
const items = response[resourceKey];
74+
if (!items?.length) {
75+
return;
76+
}
77+
for (const item of items) {
78+
yield item;
79+
if (max && ++count >= max) {
80+
return;
81+
}
82+
}
83+
totalPages = +response.total_pages;
84+
args.params.page++;
85+
} while (totalPages > args.params.page);
86+
},
87+
async getPaginatedResources(opts) {
88+
const results = [];
89+
for await (const item of this.paginate(opts)) {
90+
results.push(item);
91+
}
92+
return results;
993
},
1094
},
1195
};

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)