From 7f80ca1b1e88cef2f6d50c3e01de02ac131d0158 Mon Sep 17 00:00:00 2001 From: BuffTechTalk Date: Mon, 30 Sep 2024 22:27:26 -0500 Subject: [PATCH] remove IP analysis function --- files/visitor_locations.db | Bin 12288 -> 0 bytes requirements.txt | Bin 2374 -> 2348 bytes webpages/testing.py | 119 +------------------------------------ 3 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 files/visitor_locations.db diff --git a/files/visitor_locations.db b/files/visitor_locations.db deleted file mode 100644 index 5b3f6fda27f7a74340ed72487bab37f454c5d3f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2J8Tq37=U+e@SV^1aGoX!XHSO__UNDI&Ti!+*+D04$1!KgmJ%fw`$$f@2l&WAqt9=DJfG$h$?B2ON$CoSyap+T@eR^GFbtLm34&nGt>bPTMd%JrjS_A@OusAU0($jX$z3&8z8{ni-39{< zpaC?12G9T+Km%w14WI!ufCkXOu?E)0CT1>N2)DB4kDb=wddE#!zaO-&@3nf{N0Z}U zuBWv|N*c9`%PBc>?R>A6ixtwm1+D7B+`l@5Bq^pgE{}t;rvv#(((;}{_%Wuf;_kMa? z{&qXNNgCG|Q@d^Y!6Q2DcRtukNUFW)V% zmGh-Xr5hzE9u$8sZWgDf{+hZqWeU#=4+=jN&P+a@yfe9!Kg|D;|2a=`|G2^!XaEhM z0W^RH(14c#JDUq~x$3#vQtjTiFCYGU@MvqW|Mbb7ziZv*ZoAXzZ}i;9&knhgHM7=$ z1DA^sFA5->B|;}EqS|Pwm92VkWCB11m{>A<)`KGwC8>}~DzIO8aipe77$v3s+=Igt z$B7wNv9O!* zFqO!N#sE5sY{icQRDl3jpRxysCmiUo`-#Aoyf{oyh*YGMEqZVuanD^#_oga4<;CIB zdFDn$w&2BKhDJteq3xs}$N5pN^N(%bivya9*nl=RcXAHsVgJLqR*Kt+lXBckVTS!P zm)s2*_Ou5_C4x~QT>D}6lotnt8!sZsr5*R+ydDRQWQ>6w^WwPr0Dxk`h8`TAFy`8` y5OFk||A&mv_@!y4krK$@&bGS delta 34 kcmZ1@bWCW24yRNBLoq`sLkUABLk@#25SlUQF&Ka`0F>?qqW}N^ diff --git a/webpages/testing.py b/webpages/testing.py index 99008402b..354bb9bdb 100644 --- a/webpages/testing.py +++ b/webpages/testing.py @@ -1,125 +1,8 @@ -import pandas as pd -import streamlit as st -import requests -import folium -from streamlit_folium import folium_static -import sqlite3 -from datetime import datetime - -from webpages import code_editor as ce - - -# def get_ip(): -# try: -# response = requests.get('https://api.ipify.org') -# return response.text -# except: -# return "Unable to get IP" - -# def get_location(ip_address): -# try: -# response = requests.get(f'https://ipapi.co/{ip_address}/json/') -# data = response.json() -# return data['latitude'], data['longitude'], data['city'], data['country_name'] -# except: -# return None, None, "Unknown", "Unknown" - -# def save_visitor(conn, lat, lon, city, country): -# timestamp = datetime.now() -# c = conn.cursor() -# c.execute("INSERT INTO visitors (latitude, longitude, city, country, timestamp) VALUES (?, ?, ?, ?, ?)", -# (lat, lon, city, country, timestamp)) -# conn.commit() - -# def get_all_visitors(conn): -# df = pd.read_sql_query("SELECT * from visitors", conn) -# return df - - - -# def create_map(df): -# m = folium.Map(location=[41.2706, -97.1749], zoom_start=4) -# # Create a custom icon - -# for _, row in df.iterrows(): -# folium.Marker( -# location = [row['latitude'], row['longitude']], -# popup=f"{row['city']}", -# tooltip=f"{row['city']}" -# ).add_to(m) -# return m -import psutil - -def get_connected_ips(): - connections = psutil.net_connections() - ips = [] - for conn in connections: - if conn.status == psutil.CONN_ESTABLISHED: - ips.append(conn.raddr.ip) - return ips +improt streamlit as st def testing(): st.title("Testing Page") - st.write(get_connected_ips()) - # ce.code_editor() - - # # # [Work]code for instering youtube videos - # # video = "https://youtu.be/HluANRwPyNo?feature=shared" - # # st.video(video) - - - # Initialize the database - # conn = sqlite3.connect('./files/visitor_locations.db') - # c = conn.cursor() - # c.execute('''CREATE TABLE IF NOT EXISTS visitors - # (id INTEGER PRIMARY KEY AUTOINCREMENT, - # latitude REAL, - # longitude REAL, - # city TEXT, - # country TEXT, - # timestamp DATETIME)''') - # conn.commit() - - - - # st.title('Visitor Location Tracker') - - # # Get and save current visitor's location - # ip = get_ip() - # lat, lon, city, country = get_location(ip) - # if lat and lon: - # save_visitor(conn, lat, lon, city, country) - # st.write(f"Your location: {city}, {country}") - # else: - # st.write("Unable to determine your location") - - # # Display all visitors on a map - # st.subheader('All Visitor Locations') - # df = get_all_visitors(conn) - # if not df.empty: - # m = create_map(df) - # folium_static(m) - # else: - # st.write("No visitor data available yet.") - - # # Display visitor statistics - # st.subheader('Visitor Statistics') - # col_visitors, col_cities, col_countries = st.columns(3) - # if not df.empty: - # with col_visitors: - # st.metric(label="Total visitors", value= df['id'].nunique()) - # with col_cities: - # st.metric(label="Total cities", value= df['city'].nunique()) - # with col_countries: - # st.metric(label="Total countries", value= df['country'].nunique()) - # st.write("Top 5 cities:") - # st.write(df['city'].value_counts().head()) - # else: - # st.write("No visitor data available yet.") - - # # Close the database connection - # conn.close() \ No newline at end of file