OTRF / ThreatHunter-Playbook

A community-driven, open-source project to share detection logic, adversary tradecraft and resources to make detection development more efficient.
MIT License
3.97k stars 803 forks source link

Dockerfile question #44

Closed jasonblanks closed 2 years ago

jasonblanks commented 3 years ago

Hi, just want to say I am not familiar with jupyter noebook so this is more of a question than an issue at this point. Dockerfile build was successful without errors, looks like the default is to 8888. Able to connect fine, but it just looks like a blank jupyter instance. Am I missing something, I was expecting notebooks etc to all be populated, not sure what to expect. Is there more getting started documentation?

Cyb3rWard0g commented 3 years ago

Hello @jasonblanks ! that docker image is to be used with Binder. however, it should work locally too. I believe Binder sets the working directory to HOME/jovyan which has the docs folder in it and in there there are notebooks for each playbook.

I believe, locally, it is setting the working directory to another location. most likely /opt/jupyter/notebooks I believe that is the default directory assigned in the entrypoint script of the JUPYTER BASE image created for OTR. Would you mind sharing logs of the Jupyter server when it initializes. it should tell you which directory is using when being initialized locally.

Thank you @jasonblanks !

jasonblanks commented 3 years ago

Oh yea, definitely need to learn up on binder & jupyter. I feel like I made this harder than it needed to be. Just edited the image's /opt/jupyter/scripts/jupyter-cmd.sh to point to '/home/jovyan/docs' below.

NOTEBOOK-JUPYTER-DOCKER-INSTALLATION-INFO] Running Jupyter Type: notebook.. [NOTEBOOK-JUPYTER-DOCKER-INSTALLATION-INFO] Running the following parameters --ip=0.0.0.0 --port=8888 --notebook-dir=/opt/jupyter/notebooks --no-browser --NotebookApp.max_buffer_size=5 36870912 --NotebookApp.base_url=/ [NOTEBOOK-JUPYTER-DOCKER-INSTALLATION-INFO] Starting Jupyter notebook.. [I 17:59:04.362 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret [I 17:59:05.526 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab [I 17:59:05.527 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab [I 17:59:05.530 NotebookApp] Serving notebooks from local directory: /opt/jupyter/notebooks [I 17:59:05.531 NotebookApp] The Jupyter Notebook is running at: [I 17:59:05.531 NotebookApp] http://1062e7d44996:8888/?token=bad5b1287853e141a21f80840856b [I 17:59:05.531 NotebookApp] or http://127.0.0.1:8888/?token=bad5b12878580ce2444d8566e6940c3e141a21f80840856b [I 17:59:05.531 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 17:59:05.538 NotebookApp]

entrypoint cmd after inspecting the image and EDITING the "/opt/jupyter/scripts/jupyter-cmd.sh"

# Notebooks Forge script: jupyter-cmd.sh # Notebooks Forge script description: Runs Jupyter type and specific parameters # Notebooks Forge build Stage: Alpha # Author: Roberto Rodriguez (@Cyb3rWard0g) # License: GPL-3.0 NOTEBOOK_INFO_TAG="[NOTEBOOK-JUPYTER-DOCKER-INSTALLATION-INFO]" NOTEBOOK_ERROR_TAG="[NOTEBOOK-JUPYTER-DOCKER-INSTALLATION-ERROR]" #JUPYTER_NOTEBOOKS=/opt/jupyter/notebooks JUPYTER_NOTEBOOKS=/home/jovyan/docs

Cyb3rWard0g commented 2 years ago

Thank you @jasonblanks !