From e798c12146d4b3bd2d9d3f6b2d785acf9248f2b4 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Wed, 4 Dec 2024 15:11:47 -0600 Subject: [PATCH] HELP --- index.js | 7 +++++-- package-lock.json | 9 ++++++++- package.json | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 6b29bc1..cf6651b 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,11 @@ app.listen(PORT, () => { console.log("Shit ass dumb ip grabber is on port " + PORT) }) -app.set('trust proxy', true) +app.use app.get("*", (req, res) => { - console.log("This motherfucker's IP is " + req.ip || req.ips || req.headers['x-forwarded-for'] || req.socket.remoteAddress || req.hostname) + var IP = req.headers['x-forwarded-for'] || req.connection.remoteAddress + var IPtext = "This motherfucker's IP is " + IP + console.log(IPtext) + res.send(IPtext + ", probably!") }) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cec268a..6819cd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,8 @@ "packages": { "": { "dependencies": { - "express": "^4.21.1" + "express": "^4.21.1", + "ip": "^2.0.1" } }, "node_modules/accepts": { @@ -414,6 +415,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/ip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", + "license": "MIT" + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", diff --git a/package.json b/package.json index e395546..91623cb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "express": "^4.21.1" + "express": "^4.21.1", + "ip": "^2.0.1" } }