Adding a script which print IP info

This commit is contained in:
xenium 2022-09-22 23:50:39 +05:30
parent c4bef279f2
commit 9c6007870b
4 changed files with 32 additions and 0 deletions

View File

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

3
ipaddress/README.md Normal file
View File

@ -0,0 +1,3 @@
# IP Address
This scripts will print IP address of machine and info realted to the IP address .

27
ipaddress/main.py Normal file
View File

@ -0,0 +1,27 @@
import requests
ip_provider = "http://ipaddr.in/json"
user_agent = {
'User-agent': 'curl/7.82.0'
}
try :
web_request = requests.get(ip_provider, headers=user_agent , timeout=10)
response = web_request.json()
ip = response["ip"]
city = response["city"]
area = response["region_name"]
zip_code = response["zip_code"]
country = response["country"]
print(
f"""
IP address : {ip}
City : {city}
Area : {area}
Postal code : {zip_code}
Country : {country}
"""
)
except :
print("Error !! Check your internt connection")

View File

@ -0,0 +1 @@
requests