-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Miguel Sanchez
authored and
Miguel Sanchez
committed
Nov 7, 2023
1 parent
4b0490e
commit bf033a9
Showing
7 changed files
with
76 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import requests | ||
from colorama import Fore | ||
import json | ||
import socket | ||
|
||
def scan_ip(domain: str) -> str: | ||
if "https://" in domain: | ||
domain = domain.replace("https://", "") | ||
if "http://" in domain: | ||
domain = domain.replace("http://", "") | ||
if "https://www." in domain: | ||
domain = domain.replace("https://www.", "") | ||
if "http://www." in domain: | ||
domain = domain.replace("http://www.", "") | ||
|
||
try: | ||
ip = socket.gethostbyname(domain) | ||
url = f'https://geolocation-db.com/jsonp/{ip}' | ||
r = requests.get(url) | ||
result = r.content.decode() | ||
result = result.split("(")[1].strip(")") | ||
result = json.loads(result) | ||
info = [] | ||
for k,v in result.items(): | ||
if "country_name" in k: | ||
info.append(v) | ||
if "city" in k: | ||
if v is None: | ||
pass | ||
else: | ||
info.append(v) | ||
print(f"{Fore.MAGENTA}[+] {Fore.CYAN}-{Fore.WHITE} GeoLocation: {Fore.GREEN}{', '.join(map(str, info))}") | ||
except socket.gaierror: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters