There are several APIs that can help you retrieve DNS records while DNS footprinting in Node.js
Services like ipinfo.io, dnslookup.io, or whoisxmlapi.com provide various DNS record types (A, MX, TXT, etc.).
Consider the following example using Node.js’s built-in dns module:
const dns = require('dns');
dns.resolve('example.com', 'A', (err, addresses) => {
if (err) throw err;
console.log('A records:', addresses);
});
This uses Node.js's built-in dns module to resolve a domain name to its corresponding IP addresses.
You can consider using libraries like axios for API requests or node-fetch for complex needs:
const axios = require('axios');
axios.get('https://api.dnslookup.io/v1/example.com')
.then(response => console.log(response.data))
.catch(error => console.error(error));
This uses the axios library to make an HTTP GET request to an external DNS lookup API to retrieve similar information.