Skip to content

Commit 9c60078

Browse files
committedSep 22, 2022
Adding a script which print IP info
1 parent c4bef27 commit 9c60078

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ So far, the following projects have been integrated to this repo:
4949
|[Image circle formatter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Image-Circulator) |[Berk Gureken](https://github.com/bureken) |
5050
|[Image To PDF](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/images2pdf)|[msaoudallah](https://github.com/msaoudallah)|
5151
|[Instadp Web Scrapper](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/InstadpShower)|[Psychiquest](https://github.com/psychiquest)|
52+
|[IP Address ](https://github.com/hashtagAB/Awesome-Python-Scripts/tree/master/ipaddress)|[Xenium](https://github.com/xeniumcode)|
5253
|[Keylogger](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Keylogger) |[Preet Mishra](https://github.com/preetmishra) |
5354
|[Minecraft Server in background](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Minecraft_server_in_background)|[Max von Forell](https://github.com/mvforell)|
5455
|[Own IP locator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Location_Of_Own_IP_Adress)|[Chris]()|

‎ipaddress/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# IP Address
2+
3+
This scripts will print IP address of machine and info realted to the IP address .

‎ipaddress/main.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import requests
2+
3+
ip_provider = "http://ipaddr.in/json"
4+
user_agent = {
5+
'User-agent': 'curl/7.82.0'
6+
}
7+
try :
8+
web_request = requests.get(ip_provider, headers=user_agent , timeout=10)
9+
response = web_request.json()
10+
11+
ip = response["ip"]
12+
city = response["city"]
13+
area = response["region_name"]
14+
zip_code = response["zip_code"]
15+
country = response["country"]
16+
17+
print(
18+
f"""
19+
IP address : {ip}
20+
City : {city}
21+
Area : {area}
22+
Postal code : {zip_code}
23+
Country : {country}
24+
"""
25+
)
26+
except :
27+
print("Error !! Check your internt connection")

‎ipaddress/requirments.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests

0 commit comments

Comments
 (0)