This commit is contained in:
bingus_violet 2024-12-04 15:11:47 -06:00
parent c248f645a9
commit e798c12146
3 changed files with 15 additions and 4 deletions

View file

@ -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!")
})

9
package-lock.json generated
View file

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

View file

@ -1,5 +1,6 @@
{
"dependencies": {
"express": "^4.21.1"
"express": "^4.21.1",
"ip": "^2.0.1"
}
}