Absolutely! Building an OSINT (Open Source Intelligence) tool for your home lab with Python is a great project. Below, I’ll outline a simple, modular OSINT tool that you can expand as you learn. This tool will:
- Take a target (username, email, domain, or IP)
- Search public sources for information
- Output results in a readable format
Note: Always use OSINT tools ethically and legally.
Example: Simple OSINT Tool in Python
Features
- Username search on social media
- Email breach check (using HaveIBeenPwned API)
- Domain WHOIS lookup
- IP geolocation
Requirements
Install dependencies:
pip install requests beautifulsoup4 python-whois
osint_tool.py
import requests
import whois
def username_search(username):
print(f"\n[+] Searching for username: {username}")
social_sites = {
"Twitter": f"https://twitter.com/{username}",
"GitHub": f"https://github.com/{username}",
"Instagram": f"https://instagram.com/{username}",
}
for site, url in social_sites.items():
try:
r = requests.get(url)
if r.status_code == 200:
print(f" [FOUND] {site}: {url}")
else:
print(f" [NOT FOUND] {site}")
except Exception as e:
print(f" [ERROR] {site}: {e}")
def email_breach_check(email):
print(f"\n[+] Checking breaches for email: {email}")
url = f"https://haveibeenpwned.com/unifiedsearch/{email}"
headers = {"User-Agent": "OSINT-Tool"}
r = requests.get(url, headers=headers)
if r.status_code == 200 and "No breached account" not in r.text:
print(" [!] This email has been found in breaches!")
else:
print(" [OK] No breaches found (or API limit reached).")
def domain_whois(domain):
print(f"\n[+] WHOIS lookup for domain: {domain}")
try:
w = whois.whois(domain)
print(f" Domain Name: {w.domain_name}")
print(f" Registrar: {w.registrar}")
print(f" Creation Date: {w.creation_date}")
print(f" Expiration Date: {w.expiration_date}")
print(f" Name Servers: {w.name_servers}")
except Exception as e:
print(f" [ERROR] {e}")
def ip_geolocation(ip):
print(f"\n[+] IP Geolocation for: {ip}")
try:
r = requests.get(f"https://ipinfo.io/{ip}/json")
data = r.json()
for k, v in data.items():
print(f" {k}: {v}")
except Exception as e:
print(f" [ERROR] {e}")
if __name__ == "__main__":
print("Simple OSINT Tool")
print("1. Username search")
print("2. Email breach check")
print("3. Domain WHOIS")
print("4. IP Geolocation")
choice = input("Select option: ")
if choice == "1":
username = input("Enter username: ")
username_search(username)
elif choice == "2":
email = input("Enter email: ")
email_breach_check(email)
elif choice == "3":
domain = input("Enter domain: ")
domain_whois(domain)
elif choice == "4":
ip = input("Enter IP address: ")
ip_geolocation(ip)
else:
print("Invalid option.")
How to Use
- Save as
osint_tool.py
- Run:
python osint_tool.py
- Choose an option and enter your target
Expand Further
- Add more social networks or data sources
- Integrate with Shodan, Censys, or other APIs
- Export results to a file
- Add a simple GUI with
tkinter or PySimpleGUI
- Use threading for faster searches
Let me know if you want a more advanced version, a specific feature, or a web-based interface!