diff --git a/index.js b/index.js index f85f937..6beb037 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,18 @@ app.post('/reverseLookup', async (req, res) => { } }); +// Endpoint for performing reverse domain lookup by IP +app.post('/reverseLookupByIP', async (req, res) => { + try { + const { ip } = req.body; + const reverseResult = await dns.reverse(ip); + res.json({ success: true, ip, reverseResult }); + } catch (error) { + console.error(error); + res.status(500).json({ success: false, message: 'Reverse lookup failed', error: error.message }); + } +}); + app.post('/whoisLookup', (req, res) => { const { domain } = req.body; whois.lookup(domain, (err, data) => { @@ -39,4 +51,4 @@ app.post('/whoisLookup', (req, res) => { app.listen(port, () => { console.log(`Server running at http://localhost:${port}`); -}); +}); \ No newline at end of file diff --git a/public/index.html b/public/index.html index 7b0472f..2571db9 100644 --- a/public/index.html +++ b/public/index.html @@ -7,15 +7,23 @@

l00kup// - Domain Lookup Services

+ by abrendan
-

DNS Lookup

+

Domain Lookup

+
+

Reverse Lookup by IP

+
+ + +
+

WHOIS Lookup

@@ -49,6 +57,28 @@ }); }); + // Reverse Lookup by IP + document.getElementById('reverseLookupByIPForm').addEventListener('submit', function(e) { + e.preventDefault(); + const ip = document.getElementById('reverseIPInput').value; + document.getElementById('output').innerHTML = ''; // Clear previous output + + fetch('/reverseLookupByIP', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ ip }), + }) + .then(response => response.json()) + .then(data => { + document.getElementById('output').innerHTML = `

Reverse Lookup by IP Result

${JSON.stringify(data, null, 2)}
`; + }) + .catch(error => { + console.error('Error:', error); + }); + }); + // WHOIS Lookup document.getElementById('whoisLookupForm').addEventListener('submit', function(e) { e.preventDefault();