Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/wp-includes/post-template.php on line 284
Jul 122012
 

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 Responses to “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?

    • 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 Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)