-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from rly0nheart/dev
Major changes for everyone!!!!
- Loading branch information
Showing
9 changed files
with
256 additions
and
150 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,32 +4,28 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "thedevilseye" | ||
version = "1.6.1" | ||
description = "Get Tor hidden services and descriptions that match with the user's query." | ||
version = "1.7.0" | ||
description = "Get hidden Tor services and descriptions that match with the user's query." | ||
readme = "README.md" | ||
requires-python = ">=3.9" | ||
license = {file = "LICENSE"} | ||
license = { file = "LICENSE" } | ||
keywords = ["osint", "tor", "darknet", "deepweb", "darkweb", "darkweb-data", "osint-python", "osint-tool", "deepweb-links"] | ||
authors = [{name = "Richard Mwewa", email = "[email protected]"}] | ||
authors = [{ name = "Richard Mwewa", email = "[email protected]" }] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Programming Language :: Python :: 3", | ||
"Intended Audience :: Information Technology", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Operating System :: OS Independent", | ||
"Natural Language :: English" | ||
"Development Status :: 5 - Production/Stable", | ||
"Programming Language :: Python :: 3", | ||
"Intended Audience :: Information Technology", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Operating System :: OS Independent", | ||
"Natural Language :: English" | ||
] | ||
|
||
dependencies = [ | ||
"rich", | ||
"requests", | ||
"beautifulsoup4" | ||
] | ||
dependencies = ["beautifulsoup4", "pandas", "rich", "requests"] | ||
|
||
[project.urls] | ||
homepage = "https://github.com/rly0nheart/thedevilseye" | ||
homepage = "https://pypi.org/project/thedevilseye" | ||
documentation = "https://github.com/rly0nheart/thedevilseye/blob/master/README.md" | ||
repository = "https://github.com/rly0nheart/thedevilseye.git" | ||
|
||
[project.scripts] | ||
thedevilseye = "thedevilseye.main:thedevilseye" | ||
thedevilseye = "thedevilseye.cli:start" |
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,59 @@ | ||
import argparse | ||
|
||
import pandas as pd | ||
from requests import Session | ||
|
||
from .main import get_hidden_services, check_updates | ||
from .utils import console, export_dataframe, print_banner | ||
from .version import Version | ||
|
||
|
||
def arg_parser(): | ||
author: str = "Richard Mwewa" | ||
parser = argparse.ArgumentParser( | ||
description=f"thedevilseye — by {author} | https://gravatar.com/rly0nheart", | ||
epilog="An OSINT tool that uses Ahmia.fi to get hidden Tor " | ||
"services and descriptions that match with the user's query.", | ||
) | ||
parser.add_argument("query", help="search query") | ||
parser.add_argument( | ||
"-e", | ||
"--export", | ||
type=str, | ||
help="a comma-separated list of file types to export the output to (supported: csv,html,json,xml)", | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--version", | ||
action="version", | ||
version=f"thedevilseye {Version.release} © GPL-3.0 License {author}. All rights reserved.", | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def start(): | ||
args = arg_parser() | ||
console.clear() | ||
print_banner() | ||
with console.status("Establishing connection w/ new session...") as status: | ||
try: | ||
session = Session() | ||
check_updates(session=session) | ||
results = get_hidden_services( | ||
query=args.query, status=status, session=session | ||
) | ||
|
||
pd.set_option("display.max_rows", None) | ||
dataframe = pd.DataFrame(results) | ||
console.log(dataframe) | ||
if args.export: | ||
export_dataframe( | ||
dataframe=dataframe, | ||
filename=args.query, | ||
formats=args.export.split(","), | ||
) | ||
|
||
except KeyboardInterrupt: | ||
console.log("User interruption detected (CTRL+C)") | ||
except Exception as e: | ||
console.log(f"An unknown error occurred: {e}") |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,99 @@ | ||
import os | ||
import time | ||
from thedevilseye.thedevilseye import * | ||
import bs4 | ||
import requests | ||
from bs4 import BeautifulSoup | ||
from rich.console import Console | ||
from rich.markdown import Markdown | ||
|
||
from .utils import console | ||
from .version import Version | ||
|
||
def clear_screen(): | ||
os.system("cls" if os.name == "nt" else "clear") | ||
|
||
def get_page_source(url: str, session: requests.Session) -> bs4.BeautifulSoup: | ||
""" | ||
Gets the HTML source of the specified URL. | ||
def thedevilseye(): | ||
clear_screen() | ||
xprint(f"thedevilseye v{current_version} - {time.asctime()}\n") | ||
xprint(f"{COLOURS['GREEN']}[*]{COLOURS['RESET']} initialized <query='{arguments.query}', result_count={arguments.count}> ...") | ||
try: | ||
check_updates() | ||
get_hidden_services(query=arguments.query, result_count=int(arguments.count)) | ||
except KeyboardInterrupt: | ||
xprint(f"{COLOURS['YELLOW']}[!]{COLOURS['RESET']} User interruption detected.") | ||
:param url: URL to get HTML source from. | ||
:type url: str | ||
:param session: A requests.Session to use for the request. | ||
:type session: requests.Session | ||
:return: The HTML source of the specified URL. | ||
:rtype: bs4.BeautifulSoup | ||
""" | ||
response = make_request(url=url, session=session) | ||
html_content = BeautifulSoup(response.content, "html.parser") | ||
return html_content | ||
|
||
except Exception as e: | ||
xprint(f"{COLOURS['RED']}[x]{COLOURS['RESET']} An error occurred: {COLOURS['RED']}{e}{COLOURS['RESET']}") | ||
|
||
def make_request(url: str, session: requests.Session) -> requests.Response: | ||
""" | ||
Sends a GET request to the specified URL. | ||
:param url: URL to send request to. | ||
:type url: str | ||
:param session: A requests.Session to use for the request. | ||
:type session: requests.Session | ||
:return: Response from the specified URL. | ||
:rtype: requests.Response | ||
""" | ||
response = session.get(url) | ||
return response | ||
|
||
|
||
def check_updates(session: requests.Session): | ||
release = make_request( | ||
url="https://api.github.com/repos/rly0nheart/thedevilseye/releases/latest", | ||
session=session, | ||
).json() | ||
|
||
if release.get("tag_name"): | ||
remote_version: str = release.get("tag_name") | ||
markup_release_notes: str = release.get("body") | ||
markdown_release_notes = Markdown(markup=markup_release_notes) | ||
|
||
# Splitting the version strings into components | ||
remote_parts: list = remote_version.split(".") | ||
|
||
update_level: str = "" | ||
|
||
# Check for differences in version parts | ||
if remote_parts[0] != Version.major: | ||
update_level = "MAJOR" | ||
|
||
elif remote_parts[1] != Version.minor: | ||
update_level = "MINOR" | ||
|
||
elif remote_parts[2] != Version.patch: | ||
update_level = "PATCH" | ||
|
||
if update_level: | ||
upgrade_instructions = Markdown( | ||
markup=f""" | ||
## How To Upgrade | ||
* **PyPI Package**: *`pip install --upgrade thedevilseye`* | ||
""" | ||
) | ||
console.log( | ||
f"\n[bold]{update_level}[/] update available: [underline]{remote_version}[/]", | ||
justify="center", | ||
) | ||
console.log(markdown_release_notes) | ||
console.log(upgrade_instructions, "\n") | ||
|
||
|
||
def get_hidden_services(query: str, status: Console.status, session: requests.Session): | ||
status.update(f"Searching for `{query} on Ahmia.fi...") | ||
response_content = get_page_source( | ||
f"https://ahmia.fi/search/?q={query}", session=session | ||
) | ||
results = response_content.find_all("li", {"class": "result"}) | ||
status.update(f"Found {len(results)} results for `{query}`") | ||
results_list: list = [] | ||
for index, result in enumerate(results, start=1): | ||
url = " ".join(result.find("cite").text.split()) | ||
title = " ".join(result.find("h4").text.split()) | ||
description = " ".join(result.find("p").text.split()) | ||
results_list.append( | ||
{"title": title, "description": description, "onion_url": url} | ||
) | ||
|
||
return results_list |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.