Skip to content

Commit 2fcade7

Browse files
authored
Merge pull request #350 from DedSecInside/dev
Fixes TorBot Dependencies
2 parents 98901ac + 00472f9 commit 2fcade7

24 files changed

+91
-855
lines changed

.github/workflows/pytest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
python -m pip install --upgrade pip
2929
pip install pytest
3030
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
pip install -e .
3132
- name: Test with pytest
3233
run: |
3334
pytest

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ WORKDIR /app
77
# Clone the TorBot repository from GitHub
88
RUN git clone https://github.com/DedSecInside/TorBot.git /app
99

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

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

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

19+
# Run the TorBot script
20+
CMD ["poetry", "run", "python", "torbot"]
1921
# Example way to run the container:
2022
# docker run --network="host" your-image-name poetry run python torbot -u https://www.example.com --depth 2 --visualize tree --save json

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,14 @@
5454

5555
### TorBot
5656

57-
#### Using `poetry`
58-
* TorBot dependencies are managed using `poetry`, you can find the installation commands below:
59-
```sh
60-
poetry install # to install dependencies
61-
poetry run python torbot -u https://www.example.com --depth 2 --visualize tree --save json # example of running command with poetry
62-
poetry run python torbot -h # for help
63-
```
64-
6557
#### Using `venv`
6658
* If using Python ^3.4,
6759
```sh
6860
python -m venv torbot_venv
6961
source torbot_venv/bin/activate
7062
pip install -r requirements.txt
71-
python torbot -u https://www.example.com
63+
pip install -e .
64+
./main.py --help
7265
```
7366

7467
#### Using `docker`
File renamed without changes.

torbot/__main__.py renamed to main.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
"""
2-
Core
3-
"""
1+
#!/usr/bin/env python3
2+
43
import os
54
import argparse
65
import sys
76
import logging
87
import toml
98
import httpx
109

11-
from modules.api import get_ip
12-
from modules.color import color
13-
from modules.updater import check_version
14-
from modules.info import execute_all
15-
from modules.linktree import LinkTree
16-
from modules.config import project_root_directory
10+
from torbot.modules.api import get_ip
11+
from torbot.modules.color import color
12+
from torbot.modules.updater import check_version
13+
from torbot.modules.info import execute_all
14+
from torbot.modules.linktree import LinkTree
1715

1816

1917
def print_tor_ip_address(client: httpx.Client) -> None:
@@ -167,12 +165,11 @@ def set_arguments() -> argparse.ArgumentParser:
167165
if __name__ == "__main__":
168166
try:
169167
arg_parser = set_arguments()
170-
config_file_path = os.path.join(project_root_directory, "pyproject.toml")
168+
config_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "pyproject.toml")
171169
try:
172-
version = None
173170
with open(config_file_path, "r") as f:
174171
data = toml.load(f)
175-
version = data["tool"]["poetry"]["version"]
172+
version = data["project"]["version"]
176173
except Exception as e:
177174
raise Exception("unable to find version from pyproject.toml.\n", e)
178175

poetry.lock

Lines changed: 0 additions & 777 deletions
This file was deleted.

pyproject.toml

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,54 @@
1-
[tool.poetry]
2-
name = "torbot"
3-
version = "4.0.0"
4-
description = "OSINT for the dark web"
5-
authors = ["Akeem King <[email protected]>", "PS Narayanan <[email protected]>"]
6-
license = "GNU GPL"
7-
include = [".env"]
8-
9-
[tool.poetry.dependencies]
10-
python = ">=3.9,<=3.11.4"
11-
altgraph = "0.17.2"
12-
beautifulsoup4 = "4.11.1"
13-
certifi = "2023.7.22"
14-
charset-normalizer = "2.0.12"
15-
decorator = "5.1.1"
16-
idna = "3.3"
17-
igraph = "0.10.6"
18-
joblib = "1.2.0"
19-
macholib = "1.16"
20-
progress = "1.6"
21-
pyinstaller = "5.13.1"
22-
pyinstaller-hooks-contrib = "2022.7"
23-
PySocks = "1.7.1"
24-
python-dotenv = "0.20.0"
25-
scikit-learn = "1.3.0"
26-
scipy = "1.10.0"
27-
six = "1.16.0"
28-
sklearn = "0.0"
29-
soupsieve = "2.3.2.post1"
30-
termcolor = "1.1.0"
31-
texttable = "1.6.4"
32-
threadpoolctl = "3.1.0"
33-
urllib3 = "1.26.18"
34-
validators = "0.20.0"
35-
treelib = "^1.6.1"
36-
numpy = "1.24.4"
37-
unipath = "^1.1"
38-
httpx = {extras = ["socks"], version = "^0.25.0"}
39-
tabulate = "^0.9.0"
40-
phonenumbers = "^8.13.22"
41-
pytest = "^7.4.2"
42-
yattag = "^1.15.1"
43-
toml = "^0.10.2"
44-
45-
[tool.poetry.dev-dependencies]
46-
471
[build-system]
48-
requires = ["poetry-core>=1.0.0"]
49-
build-backend = "poetry.core.masonry.api"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "torbot"
7+
version = "4.1.0"
8+
authors = [
9+
{ name="Akeem King", email="[email protected]" },
10+
{ name="PS Narayanan", email="[email protected]" },
11+
]
12+
description = "TorBot is an OSINT tool for the dark web."
13+
readme = "README.md"
14+
requires-python = ">=3.7"
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
18+
"Operating System :: OS Independent",
19+
]
20+
dependencies = [
21+
"altgraph==0.17.2",
22+
"beautifulsoup4==4.11.1",
23+
"certifi==2024.7.4",
24+
"charset-normalizer==2.0.12",
25+
"decorator==5.1.1",
26+
"idna==3.7",
27+
"igraph==0.10.6",
28+
"joblib==1.2.0",
29+
"macholib==1.16",
30+
"progress==1.6",
31+
"pyinstaller==5.13.1",
32+
"pyinstaller-hooks-contrib==2022.7",
33+
"PySocks==1.7.1",
34+
"python-dotenv==0.20.0",
35+
"scikit-learn==1.3.0",
36+
"scipy==1.10.0",
37+
"six==1.16.0",
38+
"sklearn==0.0",
39+
"soupsieve==2.3.2.post1",
40+
"termcolor==1.1.0",
41+
"texttable==1.6.4",
42+
"threadpoolctl==3.1.0",
43+
"urllib3==1.26.19",
44+
"validators==0.20.0",
45+
"treelib==1.6.1",
46+
"numpy==1.24.4",
47+
"unipath==1.1",
48+
"httpx[socks]==0.25.0",
49+
"tabulate==0.9.0",
50+
"phonenumbers==8.13.22",
51+
"pytest==7.4.2",
52+
"yattag==1.15.1",
53+
"toml==0.10.2",
54+
]

requirements.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,18 @@ validators==0.20.0 ; python_version >= "3.9" and python_full_version <= "3.11.4"
257257
--hash=sha256:24148ce4e64100a2d5e267233e23e7afeb55316b47d30faae7eb6e7292bc226a
258258
yattag==1.15.1 ; python_version >= "3.9" and python_full_version <= "3.11.4" \
259259
--hash=sha256:960fa54be1229d96f43178133e0b195c003391fdc49ecdb6b69b7374db6be416
260+
261+
numpy~=1.24.4
262+
beautifulsoup4~=4.11.1
263+
sklearn~=0.0
264+
scikit-learn~=1.3.0
265+
httpx~=0.25.0
266+
yattag~=1.15.1
267+
termcolor~=1.1.0
268+
python-dotenv~=0.20.0
269+
Unipath~=1.1
270+
validators~=0.20.0
271+
phonenumbers~=8.13.22
272+
tabulate~=0.9.0
273+
treelib~=1.7.0
274+
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.

torbot/modules/linktree.py renamed to src/torbot/modules/linktree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def load(self) -> None:
5151
self._append_node(id=self._url, parent_id=None)
5252
self._build_tree(url=self._url, depth=self._depth)
5353

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

145145
for node in nodes:
146146
status_code = node.data.status
147-
if status_code >= 200 and status_code < 300:
147+
if 200 <= status_code < 300:
148148
insert(node, "green")
149-
elif status_code >= 300 and status_code < 400:
149+
elif 300 <= status_code < 400:
150150
insert(node, "yellow")
151151
else:
152152
insert(node, "red")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/__init__.py

Whitespace-only changes.

torbot/modules/tests/test_api.py renamed to tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from yattag import Doc
33
from unittest.mock import patch, Mock
44

5-
from ..api import get_ip
5+
from torbot.modules.api import get_ip
66

77

88
def generate_mock_torproject_page(header: str, body: str) -> str:

torbot/modules/tests/test_linktree.py renamed to tests/test_linktree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from bs4 import BeautifulSoup
22
from yattag import Doc
33

4-
from ..linktree import parse_hostname, parse_links, parse_emails, parse_phone_numbers
4+
from torbot.modules.linktree import parse_hostname, parse_links, parse_emails, parse_phone_numbers
55

66

77
def test_parse_hostname() -> None:

0 commit comments

Comments
 (0)