Kvikontent commited on
Commit
2671e44
·
verified ·
1 Parent(s): 6119c83

Create app.py

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