Spaces:
Sleeping
Sleeping
File size: 2,111 Bytes
2671e44 84edcb2 2671e44 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
import streamlit as st
import requests
def get_ip():
response = requests.get('https://api64.ipify.org?format=json').json()
return response["ip"]
def get_location(ip_address):
response = requests.get(f'https://ipapi.co/{ip_address}/json/').json()
location_data = {
"ip": ip_address,
"city": response.get("city"),
"region": response.get("region"),
"country": response.get("country_name"),
"postalcode": response.get("postal"),
"latitude": response.get("latitude"),
"longitude": response.get("longitude"),
"timezone": response.get("timezone"),
"utc_offset": response.get("utc_offset"),
"country_calling_code": response.get("country_calling_code"),
"country_population": response.get("country_population")
}
return location_data
st.title("Hack any ip adress and get info")
get = st.selectbox(
'Choose way to get ip adress',
"Input", "Get yours"
)
if get == "Input":
ip = st.text_input("Enter IP adress")
sub = st.button("Hack")
if sub:
data = get_location(ip)
if data:
st.header(f"""Information that we searched for this ip address: {data[0]}
City: {data[1]}
Region: {data[2]}
Country: {data[3]}
Postal code: {data[4]}
Latitude: {data[5]}
Longitude: {data[6]}
Timezone: {data[7]}
UTC Offset: {data[8]}
Country Calling Code: {data[9]}
Country Population: {data[10]}""")
if get == "Get yours":
ip = get_ip()
sub = st.button("Hack")
if sub:
data = get_location(ip)
if data:
st.header(f"""Information that we searched for this ip address: {data[0]}
City: {data[1]}
Region: {data[2]}
Country: {data[3]}
Postal code: {data[4]}
Latitude: {data[5]}
Longitude: {data[6]}
Timezone: {data[7]}
UTC Offset: {data[8]}
Country Calling Code: {data[9]}
Country Population: {data[10]}""") |