Get remote user’s IP address using Flask

This is a simple function to get remote user’s IP address using Flask’s request_object. It is very simple and takes a lot of tweaks, like reading also the X-Forwarded-For field from received header for users who use proxies.

dependencies:

from flask import request

function:

def get_ip():
  # get creative here!
  return request.remote_addr

2 thoughts on “Get remote user’s IP address using Flask”

  1. Good guide! Very simple! Installetion went flawlessly! The divice is recognised and working.
    However when I get it connected, I get this:

    Listening on LPF/ra0/00:0f:53:80:33:2c
    Sending on LPF/ra0/00:0f:53:80:33:2c
    Sending on Socket/fallback
    DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 8
    DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 9
    DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 21
    DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 11
    DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 12
    No DHCPOFFERS received.
    No working leases in persistent database – sleeping.

    What would it be?

    1. I am pleased that my guide helped you, it seems that you haven’t set wpa correctly, install wireless tools and scan for wireless networks to see exactly the encryption algorithm you AP use. Some AP does not works with TKIP and use AES as encryption type also refer to README for all possible settings for you card.

      HTH

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top