add sourcecode

This commit is contained in:
Jimmy Xiang
2020-11-12 17:02:10 +08:00
parent bf7c50956c
commit f698082a29
23 changed files with 2746 additions and 0 deletions

24
01/inforecon.py Normal file
View File

@@ -0,0 +1,24 @@
import sys
import requests
import socket
import json
if len(sys.argv) < 2:
print("Usage: " + sys.argv[0] + "<url>")
sys.exit(1)
req = requests.get("https://"+sys.argv[1])
print("\n"+str(req.headers))
gethostby_ = socket.gethostbyname(sys.argv[1])
print("\nThe IP address of "+sys.argv[1]+" is: "+gethostby_ + "\n")
#ipinfo.io
req_two = requests.get("https://ipinfo.io/"+gethostby_+"/json")
resp_ = json.loads(req_two.text)
print("Location: "+resp_["loc"])
print("Region: "+resp_["region"])
print("City: "+resp_["city"])
print("Country: "+resp_["country"])