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 @@