Skip to content

Commit

Permalink
Merge pull request #3 from rly0nheart/dev
Browse files Browse the repository at this point in the history
Major changes for everyone!!!!
  • Loading branch information
rly0nheart authored Jul 27, 2024
2 parents 6d735d5 + 3a1215d commit c60039b
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 150 deletions.
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ WORKDIR /app

COPY . .

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl firefox-esr \
&& rm -fr /var/lib/apt/lists/* \
&& curl -L https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz | tar xz -C /usr/local/bin \
&& apt-get purge -y ca-certificates curl

RUN pip install --upgrade pip && pip install build && python -m build
RUN pip install dist/*.whl

Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# thedevilseye

An osint tool that uses Ahmia.fi to get Tor hidden services and descriptions that match with the users query.
An osint tool that uses Ahmia.fi to get hidden Tor services and descriptions that match with the users query.

![2023-05-20_01-12](https://github.com/rly0nheart/thedevilseye/assets/74001397/dca2fc47-7ed2-4402-ae3b-b49cfdda6cb9)
![Screenshot from 2024-07-27 17-16-00](https://github.com/user-attachments/assets/1b177134-0381-4bc5-8f42-3375e3cbd8d2)

![Python Version](https://img.shields.io/badge/python-3.x-blue?style=flat&logo=python)
![GitHub](https://img.shields.io/github/license/rly0nheart/thedevilseye?style=flat&logo=github)
Expand All @@ -10,33 +11,39 @@ An osint tool that uses Ahmia.fi to get Tor hidden services and descriptions tha
![GitHub repo size](https://img.shields.io/github/repo-size/rly0nheart/thedevilseye?style=flat&logo=github)
[![Upload Python Package](https://github.com/rly0nheart/thedevilseye/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rly0nheart/thedevilseye/actions/workflows/python-publish.yml)


# Installation

## Github

```
pip install git+https://github.com/rly0nheart/thedevilseye
```

## PyPI

```
pip install thedevilseye
```

# Usage

```
thedevilseye --help
```

```
usage: thedevilseye [-h] [-c COUNT] [-d] query
usage: thedevilseye [-h] [-e EXPORT] [-v] query
thedevilseye — by Richard Mwewa | https://about.me/rly0nheart
thedevilseye — by Richard Mwewa | https://gravatar.com/rly0nheart
positional arguments:
query search query
optional arguments:
options:
-h, --help show this help message and exit
-c COUNT, --count COUNT
number of results to return (default 10)
-d, --debug enable debug mode
-e EXPORT, --export EXPORT
a comma-separated list of file types to export the output to (supported: csv,html,json,xml)
-v, --version show program's version number and exit
thedevilseye is an osint tool that uses Ahmia.fi to get Tor hidden services and descriptions that match with the user's query.
An OSINT tool that uses Ahmia.fi to get hidden Tor services and descriptions that match with the user's query.
```
30 changes: 13 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
59 changes: 59 additions & 0 deletions thedevilseye/cli.py
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}")
48 changes: 0 additions & 48 deletions thedevilseye/config.py

This file was deleted.

110 changes: 94 additions & 16 deletions thedevilseye/main.py
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
53 changes: 0 additions & 53 deletions thedevilseye/thedevilseye.py

This file was deleted.

Loading

0 comments on commit c60039b

Please sign in to comment.