mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Hash IP Address to protect them, like what discord does
This commit is contained in:
parent
3ed0b10ed7
commit
8fe63dee0f
@ -67,7 +67,7 @@
|
||||
<th>Username</th>
|
||||
<th>Discrim</th>
|
||||
<th>Last Visit</th>
|
||||
<th>IP Address</th>
|
||||
<th>IP Address Hash</th>
|
||||
<th>Banned Timestamp</th>
|
||||
<th>Banned by</th>
|
||||
<th>Banned Reason</th>
|
||||
|
@ -6,15 +6,17 @@ from flask_limiter import Limiter
|
||||
from config import config
|
||||
import random
|
||||
import string
|
||||
import hashlib
|
||||
|
||||
discord_api = DiscordREST(config['bot-token'])
|
||||
cache = Cache()
|
||||
|
||||
def get_client_ipaddr():
|
||||
if "X-Real-IP" in request.headers: # pythonanywhere specific
|
||||
return request.headers['X-Real-IP']
|
||||
ip = request.headers['X-Real-IP']
|
||||
else: # general
|
||||
return request.remote_addr
|
||||
ip = request.remote_addr
|
||||
return hashlib.sha512(config['app-secret'] + ip).hexdigest()[:15]
|
||||
|
||||
def generate_session_key():
|
||||
sess = session.get("sessionunique", None)
|
||||
|
Loading…
Reference in New Issue
Block a user