DedSecInside / TorBot

Dark Web OSINT Tool
Other
2.9k stars 531 forks source link

Changes to dockerfile and install.sh #260

Closed cackymonger closed 1 year ago

cackymonger commented 1 year ago

Issue #

Changes Proposed

Explanation of Changes

Building docker image fails w/o these changes.

Screenshots of new feature/change

cackymonger commented 1 year ago

Hm.

When I use the docker build command "docker build -f docker/Dockerfile -t dedsecinside/torbot ." as per the instructions here:

image

it works for me.

It looks like your build command is slightly different: "docker build docker/". Indeed, when I run that command I get the same error as you.

Do you get the same error when you run it from the instructions verbatim?

KingAkeem commented 1 year ago

That does resolve the initial issue, I'm now seeing an error when trying to run the container image

hortonew commented 1 year ago

That does resolve the initial issue, I'm now seeing an error when trying to run the container image

This one requires another container called tor to be running. That's in the documentation under "Ensure than you have a tor container running on port 9050"

cackymonger commented 1 year ago

There is actually something else going on, too, at least for me. Even when running the tor container there seems to be a broken reference. I plan on digging more into that by the weekend. I just thought I'd get the pull request in for a successful docker build as a baby step. This is my first time contributing so I don't know what's best. Is it better to figure it all out and then put in one massive pull request?

KingAkeem commented 1 year ago

https://github.com/DedSecInside/TorBot/pull/260#issuecomment-1366265489 I have a Tor service running on that port.

KingAkeem commented 1 year ago

https://github.com/DedSecInside/TorBot/pull/260#issuecomment-1366266731

@cackymonger

You may have been running into an issue with install.sh being removed. It has been re-added, so let me know if that resolves your issue.

If this PR works then I'm fine with merging it now. If not, then I think it would be best to hold off and figure everything out.

cackymonger commented 1 year ago

The error predates install.sh being removed if I recall correctly. I first isolated it back in November. I will try to get it figured out then added to this pull request.

hortonew commented 1 year ago

I have it building with these two changes. But now I'm not sure what needs to be in .env as it looks like it tries to load HOST and PORT in the config.

Dockerfile

# remove
-RUN virtualenv venv --python=python3.9
-RUN source venv/bin/activate
-RUN pip install -r requirements.txt

# add
+RUN python3 -m venv venv
+RUN . venv/bin/activate && pip install --upgrade pip && pip install -r requirements.txt
+RUN chmod +x run.py

# remove
-RUN chmod +x install.sh
-RUN bash install.sh

requirements.txt (full)

beautifulsoup4==4.11.1
certifi==2022.12.7
charset-normalizer==2.1.1
decorator==5.1.1
ete3==3.1.2
idna==3.4
joblib==1.2.0
numpy==1.24.1
progress==1.6
python-dotenv==0.21.0
requests==2.28.1
scikit-learn==1.2.0
scipy==1.9.3
six==1.16.0
soupsieve==2.3.2.post1
termcolor==2.1.1
threadpoolctl==3.1.0
threadsafe==1.0.0
urllib3==1.26.13
validators==0.20.0
KingAkeem commented 1 year ago

The new env file is moved to the home directory and has been renamed to .env. I think that docker ignores those files when using COPY by default so that file will need to be explicitly copied over. image

hortonew commented 1 year ago

Which process creates the .env file, or is it manual? If manual, can you add instructions on what should be in it?

KingAkeem commented 1 year ago

The .env file isn't created, it's hosted in the repository. The .gitignore file was ignoring it which is why it wasn't there. I updated the .gitignore and pushed the .env file.

hortonew commented 1 year ago

Perfect, thanks!

KingAkeem commented 1 year ago

You're welcome, let me know if you see anything else.

hortonew commented 1 year ago

Does the go server need to be running on port 8081 for python run.py -u https://www.example.com --depth 2 -v to work? Currently getting connection refused. I don't see anything in the gotor directory and wondering if install.sh is supposed to be creating it? If so, I can try that, and then add the steps into the dockerfile.

KingAkeem commented 1 year ago

Yes and the latest version of gotor has a docker build with the port included https://github.com/DedSecInside/gotor

hortonew commented 1 year ago

Thanks - with gotor up and running, I reinstall dependencies using poetry. I'm getting a lot further, but I'm now getting:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/ete3/treeview/qt.py", line 2, in <module>
    from PyQt4 import QtGui, QtCore
ModuleNotFoundError: No module named 'PyQt4'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/run.py", line 8, in <module>
    torbot.perform_action()
  File "/app/torbot/main.py", line 108, in perform_action
    self.handle_tree_args(args)
  File "/app/torbot/main.py", line 76, in handle_tree_args
    tree.show()
  File "/app/torbot/modules/linktree.py", line 74, in show
    self._tree.show()
  File "/usr/local/lib/python3.9/site-packages/ete3/coretype/tree.py", line 1362, in show
    from ..treeview import drawer
  File "/usr/local/lib/python3.9/site-packages/ete3/treeview/__init__.py", line 42, in <module>
    from .main import *
  File "/usr/local/lib/python3.9/site-packages/ete3/treeview/main.py", line 48, in <module>
    from .qt import *
  File "/usr/local/lib/python3.9/site-packages/ete3/treeview/qt.py", line 27, in <module>
    from PyQt5 import QtGui, QtCore
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
KingAkeem commented 1 year ago

Did you run the project using poetry?

hortonew commented 1 year ago

Yep, with poetry run python run.py -u https://www.example.com --depth 2 -v

KingAkeem commented 1 year ago

I just tested and I'm not able to reproduce. You need to be on Python 3.8 or higher and the latest version of poetry, there seems to be a problem with your configuration.

hortonew commented 1 year ago

It looks like it might need exactly python 3.8 - I think PyQt4 doesn't have support past that (i'm on python3.9). Are you on python3.8 ?

hortonew commented 1 year ago

I think the bigger problem is that it should be using PyQt5 but for some reason ete3 is looking for PyQt4

KingAkeem commented 1 year ago

It looks like it might need exactly python 3.8 - I think PyQt4 doesn't have support past that (i'm on python3.9). Are you on python3.8 ?

I'm on Python 10 so this isn't the issue

I think the bigger problem is that it should be using PyQt5 but for some reason ete3 is looking for PyQt4

This is a known issue with the library and why PyQt5 is included in the poetry dependencies.

hortonew commented 1 year ago

Gotcha. Looks like the issue is with ImportError: libGL.so.1: cannot open shared object file: No such file or directory. Looking into resolving that in the container now.

KingAkeem commented 1 year ago

That's likely an issue with install.sh, I haven't touched that file in a while so I have no clue if it's working.

hortonew commented 1 year ago

I fixed that issue by adding the following to the container apt-get update && apt-get install -y libgl1 from https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo.

New error I'm working through:

28-Dec-22 17:47:12 - INFO - building tree for https://www.example.com at 2
28-Dec-22 17:47:25 - INFO - tree built
      /-https://www.icann.org/privacy/policy
     |
     |--https://www.icann.org/privacy/tos
     |
     |--http://www.icann.org/
     |
-- /-|--http://pti.icann.org
     |
     |--http://www.icann.org/
     |
     |--http://www.icann.org/topics/idn/
     |
      \-http://www.icann.org/en/registries/agreements.htm
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)
hortonew commented 1 year ago

It looks like the error above is caused by not having a display. Removing the -v on the end of the command will work. Like: poetry run python run.py -u https://www.example.com --depth 2

KingAkeem commented 1 year ago

Yes the issue is with ete3 this is the library used to visualize and download trees. If you don't use the visualize/download arguments then the library won't be used so removing the -v would still work.

cackymonger commented 1 year ago

Closed by accident.

KingAkeem commented 1 year ago

I've replaced ete3 with another library. This seems to work if I replace pip with poetry which is recommended.

KingAkeem commented 1 year ago

Any update on this? If not, I'm going to close it soon.

KingAkeem commented 1 year ago

@candaceamelia Are you new? I've been seeing an influx of accounts with no GitHub activity and their first activity is with TorBot.

https://github.com/DedSecInside/TorBot/issues/277 This is also a brand new account that was created just to submit an issue to TorBot.

Maybe the project has just become popular enough that people make accounts just to comment on it, seems a bit suspicious though. I tend to assume no one is pathetic enough to make a fake account, but you never know who has too much time on their hands and not enough to do. Going to close the PR for now.

cackymonger commented 1 year ago

Lol...signed into wrong account!