|
21 | 21 |
|
22 | 22 | const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, AttachmentBuilder } = require('discord.js'); |
23 | 23 | const axios = require('axios'); |
24 | | -const { validateUrlNotInternal } = require('../utils/ssrf'); |
| 24 | +const { validateUrlNotInternal, getSafeAxiosConfig } = require('../utils/ssrf'); |
25 | 25 | const { isValidDomain } = require('../utils/validation'); |
26 | 26 | const cheerio = require('cheerio'); |
27 | 27 | const fs = require('fs'); |
@@ -153,7 +153,7 @@ module.exports = { |
153 | 153 | ); |
154 | 154 | await interaction.editReply({ embeds: [embed] }); |
155 | 155 |
|
156 | | - const crtshResponse = await axios.get(`https://crt.sh/json?q=${domain}`); |
| 156 | + const crtshResponse = await axios.get(`https://crt.sh/json?q=${domain}`, getSafeAxiosConfig()); |
157 | 157 | const certs = crtshResponse.data; |
158 | 158 |
|
159 | 159 | if (certs && certs.length > 0) { |
@@ -214,7 +214,7 @@ module.exports = { |
214 | 214 |
|
215 | 215 | const waybackResponse = await axios.get( |
216 | 216 | `https://web.archive.org/cdx/search/cdx?fl=original&collapse=urlkey&url=*.${domain}`, |
217 | | - { responseType: 'text' } |
| 217 | + { responseType: 'text', ...getSafeAxiosConfig() } |
218 | 218 | ); |
219 | 219 |
|
220 | 220 | const urls = waybackResponse.data.trim().split('\n'); |
@@ -285,7 +285,7 @@ module.exports = { |
285 | 285 | const domainName = sanitizeFilenameComponent(rawDomainName); |
286 | 286 |
|
287 | 287 | // Fetch the webpage content |
288 | | - const response = await axios.get(targetUrl); |
| 288 | + const response = await axios.get(targetUrl, getSafeAxiosConfig()); |
289 | 289 | const html = response.data; |
290 | 290 |
|
291 | 291 | // Use cheerio to parse HTML |
@@ -337,7 +337,7 @@ module.exports = { |
337 | 337 | } |
338 | 338 |
|
339 | 339 | // Download the favicon |
340 | | - const faviconResponse = await axios.get(faviconData.url, { responseType: 'arraybuffer' }); |
| 340 | + const faviconResponse = await axios.get(faviconData.url, { responseType: 'arraybuffer', ...getSafeAxiosConfig() }); |
341 | 341 | const contentType = faviconResponse.headers['content-type'] || ''; |
342 | 342 |
|
343 | 343 | // If it's an image, save it |
|
0 commit comments