Search code examples
djangohoneypot

Fake admin login page in Django


I would like to have a fake login page, a.k.a honeypot, in Django. The real admin login page would have a different than standard URL, of course. I know that there is a django-admin-honeypot app, but it doesn't seem to work with Django 2+. Is there a quick way to create such a fake admin page which doesn't even have to have the IP logging capability? Alternatively, do you have a configuration of django-admin-honeypot that works with Django 2+? If yes, would you be able to share your URL file(s), please?

Your help would be much appreciated.

Best wishes,

Marcin


Solution

  • Funny enough, I just ran into the same issue with the django-admin-honeypot app and managed to get it to work with Django 2+ with a few modifications! :)

    Because I was lazy, I simply edited the local django-admin-honeypot app files. This will break when the package is updated (but I guess it would be fixed by then).

    1. Edit the following 2 files:

      • admin_honeypot/listeners.py line 7
      • admin_honeypot/views.py line 4

    Those go from being

    from django.core.urlresolvers import reverse
    

    to

    from django.urls import reverse
    
    1. Instead of what is stated in the admin_honeypot docs, use the following for the urlpattern.

    This is similar to 'Specifying a namespace in include() without providing an app_name'

    Instead of

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

    use

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

    Then run migrate.py and restart server etc etc.

    That fixed it for me. Good luck!