博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
捕捉攻击者
阅读量:4552 次
发布时间:2019-06-08

本文共 1009 字,大约阅读时间需要 3 分钟。

pip install django-admin-honeypot

Add admin_honeypot to INSTALLED_APPS

url(r'^admin/', include('admin_honeypot.urls', namespace='admin_honeypot')),url(r'^secret/', include(admin.site.urls)),

 生成数据库.捕捉攻击者

如果有使用代理的系统会记录127.0.0.1可通过设置中间件来实现

Why is the IP address logged as 127.0.0.1?

Django-admin-honeypot pulls the users IP address from the REMOTE_ADDR request header. If your Django app is behind a load balancer or proxy web server, this may not be set and instead you will instead have an HTTP_X_FORWARDED_FOR header which contains the IP address in a comma-separated string.

The simple solution is to use a middleware to automatically set REMOTE_ADDR to the value ofHTTP_X_FORWARDED_FOR, like so:

class RemoteAddrMiddleware(object):    def process_request(self, request):        if 'HTTP_X_FORWARDED_FOR' in request.META:            ip = request.META['HTTP_X_FORWARDED_FOR'].split(',')[0].strip()            request.META['REMOTE_ADDR'] = ip

 

See also: 

转载于:https://www.cnblogs.com/tuifeideyouran/p/4211230.html

你可能感兴趣的文章
单片机reg51.h头文件详解(1)
查看>>
python各种类型转换-int,str,char,float,ord,hex,oct等
查看>>
sublime Text3 快捷键
查看>>
19 年书单
查看>>
规范 : Sql statusEnum
查看>>
jQuery的.live()和.die() 使用介绍
查看>>
mybatis
查看>>
Chord算法(原理)
查看>>
cocos2d-html5
查看>>
不变模式
查看>>
RabbitMQ安装与搭建
查看>>
【转】UITextView检查已输入字符字数
查看>>
延迟初始化
查看>>
字符串格式化和format
查看>>
页面内容添加新的显示或者显示隐藏的内容,滚动条滚动到最低端,显示出新内容...
查看>>
【poj1182】 食物链
查看>>
Oracle学习之start with...connect by子句的用法
查看>>
matlab去云雾
查看>>
500lines项目简介
查看>>
Asp.net core logging 日志
查看>>