-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - viewdns_info #17742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
components/viewdns_info/actions/dns-record-lookup/dns-record-lookup.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-dns-record-lookup", | ||
name: "DNS Record Lookup", | ||
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/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
domain: { | ||
type: "string", | ||
label: "Domain", | ||
description: "The hostname to retrieve DNS records for (e.g., example.com).", | ||
}, | ||
recordType: { | ||
type: "string", | ||
label: "Record Type", | ||
description: "The type of DNS record to retrieve (e.g., A,AAAA,MX,TXT,ANY).", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.viewdnsInfo.dnsLookup({ | ||
$, | ||
params: { | ||
domain: this.domain, | ||
recordtype: this.recordType, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Retrieved DNS records for ${this.domain}.`); | ||
|
||
return response; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-ip-history", | ||
name: "IP History", | ||
description: "Retrieves the IP address history for a domain. [See the documentation](https://viewdns.info/api/ip-history/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
domain: { | ||
type: "string", | ||
label: "Domain", | ||
description: "The domain name to retrieve the historical IP addresses for (e.g., example.com).", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.viewdnsInfo.ipHistory({ | ||
$, | ||
params: { | ||
domain: this.domain, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Retrieved IP history for ${this.domain}.`); | ||
|
||
return response; | ||
}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
components/viewdns_info/actions/reverse-ip-lookup/reverse-ip-lookup.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-reverse-ip-lookup", | ||
name: "Reverse IP Lookup", | ||
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/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
host: { | ||
type: "string", | ||
label: "Host", | ||
description: "The domain or IP to perform the reverse IP lookup on (e.g., example.com)", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const results = await this.viewdnsInfo.getPaginatedResources({ | ||
fn: this.viewdnsInfo.reverseIpLookup, | ||
args: { | ||
$, | ||
params: { | ||
host: this.host, | ||
}, | ||
}, | ||
resourceKey: "domains", | ||
}); | ||
|
||
$.export("$summary", `Found ${results.length} domain${results.length === 1 | ||
? "" | ||
: "s"} hosted on the IP address.`); | ||
|
||
return results; | ||
}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
components/viewdns_info/actions/reverse-whois-lookup/reverse-whois-lookup.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-reverse-whois-lookup", | ||
name: "Reverse Whois Lookup", | ||
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/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
q: { | ||
type: "string", | ||
label: "Query", | ||
description: "The registrant name or email address to search for (e.g., [email protected]).", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const results = await this.viewdnsInfo.getPaginatedResources({ | ||
fn: this.viewdnsInfo.reverseWhoisLookup, | ||
args: { | ||
$, | ||
params: { | ||
q: this.q, | ||
}, | ||
}, | ||
resourceKey: "matches", | ||
}); | ||
|
||
$.export("$summary", `Found ${results.length} domain${results.length === 1 | ||
? "" | ||
: "s"} matching the query.`); | ||
|
||
return results; | ||
}, | ||
}; |
35 changes: 35 additions & 0 deletions
35
components/viewdns_info/actions/subdomain-discovery/subdomain-discovery.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-subdomain-discovery", | ||
name: "Subdomain Discovery", | ||
description: "Discovers subdomains associated with a given domain. [See the documentation](https://viewdns.info/api/subdomain-discovery/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
domain: { | ||
type: "string", | ||
label: "Domain", | ||
description: "The domain name to retrieve subdomains for (e.g., example.com).", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const results = await this.viewdnsInfo.getPaginatedResources({ | ||
fn: this.viewdnsInfo.subdomainDiscovery, | ||
args: { | ||
$, | ||
params: { | ||
domain: this.domain, | ||
}, | ||
}, | ||
resourceKey: "subdomains", | ||
}); | ||
|
||
$.export("$summary", `Found ${results.length} subdomain${results.length === 1 | ||
? "" | ||
: "s"} for ${this.domain}.`); | ||
|
||
return results; | ||
}, | ||
}; |
29 changes: 29 additions & 0 deletions
29
components/viewdns_info/actions/whois-lookup/whois-lookup.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import viewdnsInfo from "../../viewdns_info.app.mjs"; | ||
|
||
export default { | ||
key: "viewdns_info-whois-lookup", | ||
name: "Whois Lookup", | ||
description: "Performs a WHOIS lookup to retrieve domain registration information. [See the documentation](https://viewdns.info/api/whois/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
viewdnsInfo, | ||
domain: { | ||
type: "string", | ||
label: "Domain", | ||
description: "The domain or IP to perform a whois lookup on (e.g., example.com)", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.viewdnsInfo.whoisLookup({ | ||
$, | ||
params: { | ||
domain: this.domain, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully retrieved WHOIS information for ${this.domain}`); | ||
|
||
return response; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/viewdns_info", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream ViewDNS.info Components", | ||
"main": "viewdns_info.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.1.0" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,95 @@ | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
type: "app", | ||
app: "viewdns_info", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "https://api.viewdns.info"; | ||
}, | ||
_makeRequest({ | ||
$ = this, path, params = {}, ...opts | ||
}) { | ||
return axios($, { | ||
url: `${this._baseUrl()}${path}`, | ||
params: { | ||
...params, | ||
apikey: `${this.$auth.api_key}`, | ||
output: "json", | ||
}, | ||
...opts, | ||
}); | ||
}, | ||
whoisLookup(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/whois/v2", | ||
...opts, | ||
}); | ||
}, | ||
reverseWhoisLookup(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/reversewhois/", | ||
...opts, | ||
}); | ||
}, | ||
subdomainDiscovery(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/subdomains/", | ||
...opts, | ||
}); | ||
}, | ||
reverseIpLookup(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/reverseip/", | ||
...opts, | ||
}); | ||
}, | ||
ipHistory(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/iphistory/", | ||
...opts, | ||
}); | ||
}, | ||
dnsLookup(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/dnsrecord/", | ||
...opts, | ||
}); | ||
}, | ||
async *paginate({ | ||
fn, args, resourceKey, max, | ||
}) { | ||
args = { | ||
...args, | ||
params: { | ||
...args?.params, | ||
page: 1, | ||
}, | ||
}; | ||
let totalPages, count = 0; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
do { | ||
const { response } = await fn(args); | ||
const items = response[resourceKey]; | ||
if (!items?.length) { | ||
return; | ||
} | ||
for (const item of items) { | ||
yield item; | ||
if (max && ++count >= max) { | ||
return; | ||
} | ||
} | ||
totalPages = +response.total_pages; | ||
args.params.page++; | ||
} while (totalPages > args.params.page); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
async getPaginatedResources(opts) { | ||
const results = []; | ||
for await (const item of this.paginate(opts)) { | ||
results.push(item); | ||
} | ||
return results; | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.