-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SecurityTrails: New action components (#13808)
- Loading branch information
Showing
7 changed files
with
200 additions
and
8 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
components/securitytrails/actions/get-domain-details/get-domain-details.mjs
This file contains 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,41 @@ | ||
import app from "../../securitytrails.app.mjs"; | ||
|
||
export default { | ||
key: "securitytrails-get-domain-details", | ||
name: "Get Domain Details", | ||
description: "Returns the current data about the given hostname. [See the documentation](https://docs.securitytrails.com/reference/domain-details)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
hostname: { | ||
propDefinition: [ | ||
app, | ||
"hostname", | ||
], | ||
}, | ||
}, | ||
methods: { | ||
getDomainDetails({ | ||
hostname, ...args | ||
} = {}) { | ||
return this.app._makeRequest({ | ||
path: `/domain/${hostname}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
getDomainDetails, | ||
hostname, | ||
} = this; | ||
|
||
const response = await getDomainDetails({ | ||
$, | ||
hostname, | ||
}); | ||
$.export("$summary", `Successfully retrieved details for hostname \`${response.hostname}\`.`); | ||
return response; | ||
}, | ||
}; |
74 changes: 74 additions & 0 deletions
74
components/securitytrails/actions/get-history-dns/get-history-dns.mjs
This file contains 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,74 @@ | ||
import app from "../../securitytrails.app.mjs"; | ||
|
||
export default { | ||
key: "securitytrails-get-history-dns", | ||
name: "Get Historical DNS", | ||
description: "Lists out specific historical information about the given hostname parameter. [See the documentation](https://docs.securitytrails.com/reference/history-dns)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
hostname: { | ||
propDefinition: [ | ||
app, | ||
"hostname", | ||
], | ||
}, | ||
type: { | ||
type: "string", | ||
label: "Record Type", | ||
description: "Select the DNS record type to query historical data for.", | ||
options: [ | ||
{ | ||
label: "A", | ||
value: "a", | ||
}, | ||
{ | ||
label: "AAAA", | ||
value: "aaaa", | ||
}, | ||
{ | ||
label: "MX", | ||
value: "mx", | ||
}, | ||
{ | ||
label: "NS", | ||
value: "ns", | ||
}, | ||
{ | ||
label: "SOA", | ||
value: "soa", | ||
}, | ||
{ | ||
label: "TXT", | ||
value: "txt", | ||
}, | ||
], | ||
}, | ||
}, | ||
methods: { | ||
getHistoryDns({ | ||
hostname, type, ...args | ||
} = {}) { | ||
return this.app._makeRequest({ | ||
path: `/history/${hostname}/dns/${type}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
getHistoryDns, | ||
hostname, | ||
type, | ||
} = this; | ||
|
||
const response = await getHistoryDns({ | ||
$, | ||
hostname, | ||
type, | ||
}); | ||
$.export("$summary", `Successfully retrieved historical DNS data for type \`${response.type}\`.`); | ||
return response; | ||
}, | ||
}; |
41 changes: 41 additions & 0 deletions
41
components/securitytrails/actions/get-ips-neighbors/get-ips-neighbors.mjs
This file contains 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,41 @@ | ||
import app from "../../securitytrails.app.mjs"; | ||
|
||
export default { | ||
key: "securitytrails-get-ips-neighbors", | ||
name: "Get IPs Neighbors", | ||
description: "Returns the neighbors in any given IP level range and essentially allows you to explore closeby IP addresses.", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
ipaddress: { | ||
type: "string", | ||
label: "IP Address", | ||
description: "Enter the IP address to find neighbors for. Eg. `8.8.8.8`.", | ||
}, | ||
}, | ||
methods: { | ||
getIpNeighbors({ | ||
ipaddress, ...args | ||
}) { | ||
return this.app._makeRequest({ | ||
path: `/ips/nearby/${ipaddress}`, | ||
...args, | ||
}); | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
getIpNeighbors, | ||
ipaddress, | ||
} = this; | ||
|
||
const response = await getIpNeighbors({ | ||
$, | ||
ipaddress, | ||
}); | ||
|
||
$.export("$summary", `Successfully retrieved \`${response?.blocks.length}\` neighbor(s).`); | ||
return response; | ||
}, | ||
}; |
This file contains 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,7 @@ | ||
const BASE_URL = "https://api.securitytrails.com"; | ||
const VERSION_PATH = "/v1"; | ||
|
||
export default { | ||
BASE_URL, | ||
VERSION_PATH, | ||
}; |
This file contains 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/securitytrails", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream SecurityTrails Components", | ||
"main": "securitytrails.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,8 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "3.0.1" | ||
} | ||
} | ||
} |
This file contains 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,34 @@ | ||
import { axios } from "@pipedream/platform"; | ||
import constants from "./common/constants.mjs"; | ||
|
||
export default { | ||
type: "app", | ||
app: "securitytrails", | ||
propDefinitions: {}, | ||
propDefinitions: { | ||
hostname: { | ||
type: "string", | ||
label: "Hostname", | ||
description: "Enter the hostname to query information for. Eg. `oracle.com`", | ||
}, | ||
}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
getUrl(path) { | ||
return `${constants.BASE_URL}${constants.VERSION_PATH}${path}`; | ||
}, | ||
getHeaders(headers = {}) { | ||
return { | ||
...headers, | ||
APIKEY: this.$auth.api_key, | ||
}; | ||
}, | ||
_makeRequest({ | ||
$ = this, path, headers, ...args | ||
} = {}) { | ||
return axios($, { | ||
...args, | ||
url: this.getUrl(path), | ||
headers: this.getHeaders(headers), | ||
}); | ||
}, | ||
}, | ||
}; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.