mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-27 14:01:09 +00:00
Merge pull request #265 from xeniumcode/master
Adding a script which print IP info
This commit is contained in:
commit
4f56c75775
|
@ -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
3
ipaddress/README.md
Normal 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
27
ipaddress/main.py
Normal 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")
|
1
ipaddress/requirments.txt
Normal file
1
ipaddress/requirments.txt
Normal file
|
@ -0,0 +1 @@
|
|||
requests
|
Loading…
Reference in New Issue
Block a user