Skip to content

Commit

Permalink
Merge pull request #350 from DedSecInside/dev
Browse files Browse the repository at this point in the history
Fixes TorBot Dependencies
  • Loading branch information
KingAkeem authored Nov 3, 2024
2 parents 98901ac + 00472f9 commit 2fcade7
Show file tree
Hide file tree
Showing 24 changed files with 91 additions and 855 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Test with pytest
run: |
pytest
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ WORKDIR /app
# Clone the TorBot repository from GitHub
RUN git clone https://github.com/DedSecInside/TorBot.git /app

# Install Poetry
RUN pip install --no-cache-dir poetry
# Install dependencies
RUN pip install -r /app/requirements.txt

# Install TorBot dependencies using Poetry
RUN cd /app && poetry install
# Set the SOCKS5_PORT environment variable
ENV SOCKS5_PORT=9050

# Expose the port specified in the .env file
EXPOSE $SOCKS5_PORT

# Run the TorBot script
CMD ["poetry", "run", "python", "torbot"]
# Example way to run the container:
# docker run --network="host" your-image-name poetry run python torbot -u https://www.example.com --depth 2 --visualize tree --save json
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,14 @@

### TorBot

#### Using `poetry`
* TorBot dependencies are managed using `poetry`, you can find the installation commands below:
```sh
poetry install # to install dependencies
poetry run python torbot -u https://www.example.com --depth 2 --visualize tree --save json # example of running command with poetry
poetry run python torbot -h # for help
```

#### Using `venv`
* If using Python ^3.4,
```sh
python -m venv torbot_venv
source torbot_venv/bin/activate
pip install -r requirements.txt
python torbot -u https://www.example.com
pip install -e .
./main.py --help
```

#### Using `docker`
Expand Down
File renamed without changes.
21 changes: 9 additions & 12 deletions torbot/__main__.py → main.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
"""
Core
"""
#!/usr/bin/env python3

import os
import argparse
import sys
import logging
import toml
import httpx

from modules.api import get_ip
from modules.color import color
from modules.updater import check_version
from modules.info import execute_all
from modules.linktree import LinkTree
from modules.config import project_root_directory
from torbot.modules.api import get_ip
from torbot.modules.color import color
from torbot.modules.updater import check_version
from torbot.modules.info import execute_all
from torbot.modules.linktree import LinkTree


def print_tor_ip_address(client: httpx.Client) -> None:
Expand Down Expand Up @@ -167,12 +165,11 @@ def set_arguments() -> argparse.ArgumentParser:
if __name__ == "__main__":
try:
arg_parser = set_arguments()
config_file_path = os.path.join(project_root_directory, "pyproject.toml")
config_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "pyproject.toml")
try:
version = None
with open(config_file_path, "r") as f:
data = toml.load(f)
version = data["tool"]["poetry"]["version"]
version = data["project"]["version"]
except Exception as e:
raise Exception("unable to find version from pyproject.toml.\n", e)

Expand Down
777 changes: 0 additions & 777 deletions poetry.lock

This file was deleted.

101 changes: 53 additions & 48 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
[tool.poetry]
name = "torbot"
version = "4.0.0"
description = "OSINT for the dark web"
authors = ["Akeem King <[email protected]>", "PS Narayanan <[email protected]>"]
license = "GNU GPL"
include = [".env"]

[tool.poetry.dependencies]
python = ">=3.9,<=3.11.4"
altgraph = "0.17.2"
beautifulsoup4 = "4.11.1"
certifi = "2023.7.22"
charset-normalizer = "2.0.12"
decorator = "5.1.1"
idna = "3.3"
igraph = "0.10.6"
joblib = "1.2.0"
macholib = "1.16"
progress = "1.6"
pyinstaller = "5.13.1"
pyinstaller-hooks-contrib = "2022.7"
PySocks = "1.7.1"
python-dotenv = "0.20.0"
scikit-learn = "1.3.0"
scipy = "1.10.0"
six = "1.16.0"
sklearn = "0.0"
soupsieve = "2.3.2.post1"
termcolor = "1.1.0"
texttable = "1.6.4"
threadpoolctl = "3.1.0"
urllib3 = "1.26.18"
validators = "0.20.0"
treelib = "^1.6.1"
numpy = "1.24.4"
unipath = "^1.1"
httpx = {extras = ["socks"], version = "^0.25.0"}
tabulate = "^0.9.0"
phonenumbers = "^8.13.22"
pytest = "^7.4.2"
yattag = "^1.15.1"
toml = "^0.10.2"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "torbot"
version = "4.1.0"
authors = [
{ name="Akeem King", email="[email protected]" },
{ name="PS Narayanan", email="[email protected]" },
]
description = "TorBot is an OSINT tool for the dark web."
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
]
dependencies = [
"altgraph==0.17.2",
"beautifulsoup4==4.11.1",
"certifi==2024.7.4",
"charset-normalizer==2.0.12",
"decorator==5.1.1",
"idna==3.7",
"igraph==0.10.6",
"joblib==1.2.0",
"macholib==1.16",
"progress==1.6",
"pyinstaller==5.13.1",
"pyinstaller-hooks-contrib==2022.7",
"PySocks==1.7.1",
"python-dotenv==0.20.0",
"scikit-learn==1.3.0",
"scipy==1.10.0",
"six==1.16.0",
"sklearn==0.0",
"soupsieve==2.3.2.post1",
"termcolor==1.1.0",
"texttable==1.6.4",
"threadpoolctl==3.1.0",
"urllib3==1.26.19",
"validators==0.20.0",
"treelib==1.6.1",
"numpy==1.24.4",
"unipath==1.1",
"httpx[socks]==0.25.0",
"tabulate==0.9.0",
"phonenumbers==8.13.22",
"pytest==7.4.2",
"yattag==1.15.1",
"toml==0.10.2",
]
15 changes: 15 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,18 @@ validators==0.20.0 ; python_version >= "3.9" and python_full_version <= "3.11.4"
--hash=sha256:24148ce4e64100a2d5e267233e23e7afeb55316b47d30faae7eb6e7292bc226a
yattag==1.15.1 ; python_version >= "3.9" and python_full_version <= "3.11.4" \
--hash=sha256:960fa54be1229d96f43178133e0b195c003391fdc49ecdb6b69b7374db6be416

numpy~=1.24.4
beautifulsoup4~=4.11.1
sklearn~=0.0
scikit-learn~=1.3.0
httpx~=0.25.0
yattag~=1.15.1
termcolor~=1.1.0
python-dotenv~=0.20.0
Unipath~=1.1
validators~=0.20.0
phonenumbers~=8.13.22
tabulate~=0.9.0
treelib~=1.7.0
toml~=0.10.2
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions torbot/modules/linktree.py → src/torbot/modules/linktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def load(self) -> None:
self._append_node(id=self._url, parent_id=None)
self._build_tree(url=self._url, depth=self._depth)

def _append_node(self, id: str, parent_id: str | None) -> None:
def _append_node(self, id: str, parent_id: str or None) -> None:
"""
Creates a node for a tree using the given ID which corresponds to a URL.
If the parent_id is None, this will be considered a root node.
Expand Down Expand Up @@ -144,9 +144,9 @@ def insert(node, color_code):

for node in nodes:
status_code = node.data.status
if status_code >= 200 and status_code < 300:
if 200 <= status_code < 300:
insert(node, "green")
elif status_code >= 300 and status_code < 400:
elif 300 <= status_code < 400:
insert(node, "yellow")
else:
insert(node, "red")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion torbot/modules/tests/test_api.py → tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from yattag import Doc
from unittest.mock import patch, Mock

from ..api import get_ip
from torbot.modules.api import get_ip


def generate_mock_torproject_page(header: str, body: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from bs4 import BeautifulSoup
from yattag import Doc

from ..linktree import parse_hostname, parse_links, parse_emails, parse_phone_numbers
from torbot.modules.linktree import parse_hostname, parse_links, parse_emails, parse_phone_numbers


def test_parse_hostname() -> None:
Expand Down

0 comments on commit 2fcade7

Please sign in to comment.