Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions h4xtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ def main() -> None:
MENU_OPTIONS[user_input]() # Call the corresponding function based on the selected option
except KeyboardInterrupt:
printer.warning("Cancelled..!")
time.sleep(3) # Sleep so the user has time to see results.
elif user_input.lower() == "?":
help()
time.sleep(3)
printer.inp("Done reading? Press the Enter key.")
else:
printer.error("Invalid option!")
time.sleep(0.5)
Expand Down
32 changes: 16 additions & 16 deletions helper/handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def handle_ig_scrape() -> None:
Note, you have to log in to Instagram in order to use this util.
"""
target = str(printer.inp("Enter a target username : \t")).replace(" ", "_")
ig_scrape.Scrape(target)
ig_scrape.scrape(target=target)


def handle_web_search() -> None:
Expand All @@ -51,31 +51,31 @@ def handle_web_search() -> None:
"""
printer.info("For advanced searching, you can use DuckDuckGo's advanced syntaxing. Please refer to this guide: \nhttps://duckduckgo.com/duckduckgo-help-pages/results/syntax/")
query = str(printer.inp("Search query : \t"))
websearch.Search(query)
websearch.websearch(query=query)


def handle_phone_lookup() -> None:
"""
Handles the Phone number Lookup util.
"""
no = str(printer.inp("Enter a phone-number with country code : \t"))
phonenumber_lookup.LookUp(no)
phonenumber_lookup.lookup(phone_number=no)


def handle_ip_lookup() -> None:
"""
Handles the IP/Domain Lookup util.
"""
ip = str(printer.inp("Enter a IP address OR domain : \t"))
ip_lookup.Lookup(ip)
ip_lookup.lookup(ip_address=ip)


def handle_username_search() -> None:
"""
Handles the Username Search util.
"""
username = str(printer.inp("Enter a Username : \t")).replace(" ", "_")
search_username.Search(username)
search_username.search(username=username)


def handle_email_search() -> None:
Expand All @@ -85,7 +85,7 @@ def handle_email_search() -> None:
Windows support is not available yet.
"""
email = str(printer.inp("Enter a email address : \t"))
email_search.Holehe(email)
email_search.search(email=email)


def handle_port_scanner() -> None:
Expand All @@ -94,67 +94,67 @@ def handle_port_scanner() -> None:
"""
ip = str(printer.inp("Enter a IP address OR domain : \t"))
port_range = int(printer.inp("Enter number of ports to scan : \t"))
port_scanner.Scan(ip, port_range)
port_scanner.scan(ip=ip, port_range=port_range)


def handle_whois_lookup() -> None:
"""
Handles the WhoIs Lookup util.
"""
domain = str(printer.inp("Enter a domain : \t"))
whois_lookup.Lookup(domain)
whois_lookup.check_whois(domain=domain)


def handle_fake_info_generator() -> None:
"""
Handles the Fake Info Generator util.
"""
fake_info_generator.Generate()
fake_info_generator.generate()


def handle_web_scrape() -> None:
"""
Handles the Web Scrape util.
"""
url = str(printer.inp(f"Enter a url : \t"))
web_scrape.Scrape(url)
web_scrape.scrape(url=url)


def handle_wifi_finder() -> None:
"""
Handles the Wi-Fi Finder util.
"""
printer.info(f"Scanning for nearby Wi-Fi networks...")
wifi_finder.Scan()
wifi_finder.scan_nearby_wifis()


def handle_wifi_vault() -> None:
"""
Handles the Wi-Fi Password Getter util.
"""
printer.info(f"Scanning for locally saved Wi-Fi passwords...")
wifi_vault.Scan()
wifi_vault.get_local_passwords()


def handle_dir_buster() -> None:
"""
Handles the Dir Buster util.
"""
url = printer.inp(f"Enter a domain : \t")
dirbuster.Scan(url)
domain = printer.inp(f"Enter a domain : \t")
dirbuster.bust(domain=domain)


def handle_local_users() -> None:
"""
Handles the Local User Enum.
"""
printer.info(f"Scanning for local accounts...")
local_users.Scan()
local_users.scan_for_local_users()


def handle_leak_search() -> None:
"""
Handles the Cybercrime Intelligence util.
"""
target = printer.inp("Enter a target (email/domain) : \t")
leak_search.Scan(target)
leak_search.lookup(target=target)
2 changes: 1 addition & 1 deletion helper/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def wrapper(*args, **kwargs) -> str:

# If require_input is True, prompt the user for input after execution
if require_input:
printer.inp("Press any key to continue...") # Prompt for input
printer.inp("Press Enter key to continue...") # Prompt for input

return result # Return the result of the wrapped function
return wrapper
Expand Down
120 changes: 60 additions & 60 deletions utils/dirbuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,67 +20,67 @@
from helper import randomuser
from colorama import Style

class Scan:
@timer.timer(require_input=True)
def bust(domain) -> None:
"""
Scans the given url for valid paths

:param domain: url to scan
param domain: url to scan
"""
@timer.timer(require_input=True)
def __init__(self, domain) -> None:
self.domain = domain
self.url_set = set()

printer.info(f"Scanning for valid URLs for {Style.BRIGHT}{domain}{Style.RESET_ALL}...")
printer.warning("This may take a while...")
self.scan_urls()
printer.success(f"Scan Completed..! There were {Style.BRIGHT}{len(self.url_set)}{Style.RESET_ALL} valid URLs!")

@staticmethod
def get_wordlist() -> str:
"""
Reads the wordlist from the url and returns a list of names

:return: list of names
"""
try:
content = url_helper.read_local_content("resources/wordlist.txt")
return {line.strip() for line in content.splitlines() if line.strip()}
except requests.exceptions.ConnectionError:
return None

async def fetch_url(self, session, path) -> None:
"""
Fetches the url and checks if it is valid

:param session: aiohttp session
:param path: path to check
"""
url = f"https://{self.domain}/{path}"
headers = {"User-Agent": f"{randomuser.GetUser()}"}
async with session.get(url, headers=headers) as response:
if response.status == 200:
printer.success(f"{len(self.url_set) + 1} Valid URL(s) found : {Style.BRIGHT}{url}{Style.RESET_ALL}")
self.url_set.add(url)

async def scan_async(self, paths) -> None:
"""
Scans the url asynchronously

:param paths: list of paths to scan
"""
async with aiohttp.ClientSession() as session:
tasks = [self.fetch_url(session, path) for path in paths]
await asyncio.gather(*tasks, return_exceptions=True)

def scan_urls(self) -> None:
paths = self.get_wordlist()
if paths is None:
printer.error("Connection Error..!")
return

try:
loop = asyncio.get_event_loop()
loop.run_until_complete(self.scan_async(paths))
except KeyboardInterrupt:
printer.error("Cancelled..!")
domain = domain
url_set = set()

printer.info(f"Scanning for valid URLs for {Style.BRIGHT}{domain}{Style.RESET_ALL}...")
printer.warning("This may take a while...")

scan_urls()

printer.success(f"Scan Completed..! There were {Style.BRIGHT}{len(url_set)}{Style.RESET_ALL} valid URLs!")

def get_wordlist() -> str:
"""
Reads the wordlist from the url and returns a list of names

:return: list of names
"""
try:
content = url_helper.read_local_content("resources/wordlist.txt")
return {line.strip() for line in content.splitlines() if line.strip()}
except requests.exceptions.ConnectionError:
return None

async def fetch_url(session, path) -> None:
"""
Fetches the url and checks if it is valid

:param session: aiohttp session
:param path: path to check
"""
url = f"https://{domain}/{path}"
headers = {"User-Agent": f"{randomuser.GetUser()}"}
async with session.get(url, headers=headers) as response:
if response.status == 200:
printer.success(f"{len(url_set) + 1} Valid URL(s) found : {Style.BRIGHT}{url}{Style.RESET_ALL}")
url_set.add(url)

async def scan_async(paths) -> None:
"""
Scans the url asynchronously

:param paths: list of paths to scan
"""
async with aiohttp.ClientSession() as session:
tasks = [fetch_url(session, path) for path in paths]
await asyncio.gather(*tasks, return_exceptions=True)

def scan_urls() -> None:
paths = get_wordlist()
if paths is None:
printer.error("Connection Error..!")
return

try:
loop = asyncio.get_event_loop()
loop.run_until_complete(scan_async(paths))
except KeyboardInterrupt:
printer.error("Cancelled..!")
60 changes: 29 additions & 31 deletions utils/email_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,39 @@
from helper import printer, timer
from colorama import Style

class Holehe:
@timer.timer(require_input=True)
def search(email) -> None:
"""
Searches for the email address in various websites using holehe.

Thanks to Holehe, https://github.com/megadose/holehe

:param email: The email address to search for.
"""
@timer.timer(require_input=True)
def __init__(self, email) -> None:
printer.info(f"Trying to find sites where {Style.BRIGHT}{email}{Style.RESET_ALL} is used, thanks to holehe.")
try:
result = subprocess.run(["holehe", email], capture_output=True, text=True, check=True)
output = self._format_output(result.stdout)
if output:
printer.nonprefix(output)
printer.nonprefix("Credits to megadose (Palenath) for holehe.")
else:
printer.error("No results found..!")
except FileNotFoundError:
printer.error(f"Error : {Style.BRIGHT}holehe{Style.RESET_ALL} was not found or it isn't in the PATH. Please make sure you have holehe installed and in your PATH.")
printer.error(f"You can install holehe by executing {Style.BRIGHT}pip install holehe{Style.RESET_ALL}.")
except subprocess.CalledProcessError as e:
printer.error(f"Error : {e}")
except Exception as e:
printer.error(f"Unexpected error : {e}")

@staticmethod
def _format_output(output) -> str:
lines = output.split("\n")[4:-4]
for i, line in enumerate(lines):
if "[+]" in line:
lines[i] = f"\033[92m{line}\033[0m"
elif "[-]" in line:
lines[i] = f"\033[91m{line}\033[0m"
elif "[x]" in line:
lines[i] = f"\033[93m{line}\033[0m"
return "\n".join(lines)
printer.info(f"Trying to find sites where {Style.BRIGHT}{email}{Style.RESET_ALL} is used, thanks to holehe.")
try:
result = subprocess.run(["holehe", email], capture_output=True, text=True, check=True)
output = _format_output(result.stdout)
if output:
printer.nonprefix(output)
printer.nonprefix("Credits to megadose (Palenath) for holehe.")
else:
printer.error("No results found..!")
except FileNotFoundError:
printer.error(f"Error : {Style.BRIGHT}holehe{Style.RESET_ALL} was not found or it isn't in the PATH. Please make sure you have holehe installed and in your PATH.")
printer.error(f"You can install holehe by executing {Style.BRIGHT}pip install holehe{Style.RESET_ALL}.")
except subprocess.CalledProcessError as e:
printer.error(f"Error : {e}")
except Exception as e:
printer.error(f"Unexpected error : {e}")

def _format_output(output) -> str:
lines = output.split("\n")[4:-4]
for i, line in enumerate(lines):
if "[+]" in line:
lines[i] = f"\033[92m{line}\033[0m"
elif "[-]" in line:
lines[i] = f"\033[91m{line}\033[0m"
elif "[x]" in line:
lines[i] = f"\033[93m{line}\033[0m"
return "\n".join(lines)
Loading
Loading