File size: 2,382 Bytes
fd46906
2671e44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd46906
84edcb2
fd46906
ce14741
2671e44
 
fd46906
2671e44
 
 
 
4d61ea8
 
 
 
 
 
 
 
 
 
 
2671e44
 
 
 
 
 
 
4d61ea8
 
 
 
 
 
 
 
 
 
 
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
65
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 address and get info")
get = st.selectbox(
    'Choose way to get ip address',
    ("Input", "Get yours")
)
if get == "Input":
    ip = st.text_input("Enter IP address")
    sub = st.button("Hack")
    if sub:
        data = get_location(ip)
        if data:
            st.write(f"""Information that we searched for this ip address: {data['ip']}\n
            City: {data['city']}\n
            Region: {data['region']}\n
            Country: {data['country']}\n
            Postal code: {data['postalcode']}\n
            Latitude: {data['latitude']}\n
            Longitude: {data['longitude']}\n
            Timezone: {data['timezone']}\n
            UTC Offset: {data['utc_offset']}\n
            Country Calling Code: {data['country_calling_code']}\n
            Country Population: {data['country_population']}\n""")

if get == "Get yours":
    ip = get_ip()
    sub = st.button("Hack")
    if sub:
        data = get_location(ip)
        if data:
            st.write(f"""Information that we searched for this ip address: {data['ip']}\n
            City: {data['city']}\n
            Region: {data['region']}\n
            Country: {data['country']}\n
            Postal code: {data['postalcode']}\n
            Latitude: {data['latitude']}\n
            Longitude: {data['longitude']}\n
            Timezone: {data['timezone']}\n
            UTC Offset: {data['utc_offset']}\n
            Country Calling Code: {data['country_calling_code']}\n
            Country Population: {data['country_population']}\n""")