express-honeypots
Version:
This repository contains a collection of honeypots for the Express framework to prevent automated scanning.
32 lines (23 loc) • 858 B
JavaScript
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* This honeypot simulates the static files that are generated by Next.js
* @param router
* @param options
*/
export default function(router, options = {}) {
router.get('/_next/static/*/_buildManifest.js', (req, res) => {
res.sendFile(__dirname + '/_buildManifest.js');
});
router.get('/_next/static/*/_ssgManifest.js', (req, res) => {
res.sendFile(__dirname + '/_ssgManifest.js');
});
router.get('/_next/static/chunks/*.js', (req, res) => {
res.sendFile(__dirname + '/chunkFile.js');
});
router.get('/_next/static/css/*.css', (req, res) => {
res.sendFile(__dirname + '/someCss.css');
});
}