hack-ip-address / app.py
Kvikontent's picture
Update app.py
84edcb2 verified
raw
history blame
2.11 kB
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]}""")