Example #1
0
def address(ip):
    # Get host info from Shodan
    page = sh.lookup_host(str(ip))
    
    # Add interactive map
    lat, lon = geo.get_coordinates(str(ip))
    ip_map = folium.Map(location=[lat, lon], zoom_start=7, tiles='CartoDB positron')
    folium.Marker(location=(lat, lon)).add_to(ip_map)
    page += "<div style=\"height:30%; width:30%;\">"
    page += str(ip_map.get_root().render())
    page += "</div>"
    return page
def get_users_coordinates(users: list):
    unique_locations = []
    names_and_coordinates = []
    for user in users:
        if user['location'] not in unique_locations:
            names_and_coordinates.append([
                user['screen_name'],
                geo_helper.get_coordinates(user['location'])
            ])
            unique_locations.append(user['location'])

    return names_and_coordinates
Example #3
0
def recent(num):
    db, curs = database.connect()
    recents = database.get_recent(db, curs, num)
    db.close()
    
    recent_map = folium.Map(location=[24.635246, 2.616971], zoom_start=2, tiles='CartoDB positron')
    
    for row in recents:
        coords = geo.get_coordinates(row[2])
        if coords is None:
            continue
        folium.Marker(location=coords).add_to(recent_map)
        
    recent_page = "<div style=\"height:50%; width:60%;\">" + str(recent_map.get_root().render()) + "</div>"
    
    return recent_page #send_from_directory('res/html', 'recent.html')