Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/welefen/ssrf-agent
make http(s) request to prevent SSRF
https://github.com/welefen/ssrf-agent
agent dns http https lookup ssrf
Last synced: 9 days ago
JSON representation
make http(s) request to prevent SSRF
- Host: GitHub
- URL: https://github.com/welefen/ssrf-agent
- Owner: welefen
- License: mit
- Created: 2018-08-31T09:45:25.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T04:40:19.000Z (almost 3 years ago)
- Last Synced: 2024-10-05T19:21:07.643Z (about 1 month ago)
- Topics: agent, dns, http, https, lookup, ssrf
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 20
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ssrf-agent
prevent SSRF in http(s) request
## Install
```
npm install ssrf-agent --save
```## Usage
```js
const ssrfAgent = require('ssrf-agent');
const request = require('request');
// with request module
const url = 'http://www.welefen.com'
request(url, {
agent: ssrfAgent(url)
}, (err, response, body) => {
})
``````js
const ssrfAgent = require('ssrf-agent');
const fetch = require('node-fetch');
// with node-fetch module
const url = 'http://www.welefen.com'
fetch(url, {
agent: ssrfAgent(url)
}).then(res => res.text).then(data => {}).catch(err => {
})
```## Options
```js
const getAgent = require('ssrf-agent');
const agent = getAgent(ipChecker, agent);
```
* `ipChecker(ip)` {Function} check ip is allowed, default is `require('ip').isPrivate`
* `agent` {String | Object} default is `http`, support `http` `https` or `agent instance`