Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
theMiddleBlue committed Oct 26, 2018
1 parent d32c6a4 commit 2a0269a
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WebMap
# -
# https://github.com/Rev3rseSecurity/WebMap
# Rev3rse Security: https://www.youtube.com/rev3rsesecurity
# Author: theMiddle
# -
# Usage:
# $ cd /opt
# $ git clone https://github.com/Rev3rseSecurity/WebMap.git
# $ cd WebMap/docker
# $ docker build -t webmap:latest .
# $ docker run -d -v /opt/WebMap/docker/xml:/opt/xml -p 8000:8000 webmap:latest
#
# Nmap Example:
# $ nmap -sT -A -oX /tmp/myscan.xml 192.168.1.0/24
# $ mv /tmp/myscan.xml /opt/WebMap/docker/xml
#
# Now you can point your browser to http://localhost:8000

FROM ubuntu:latest

RUN apt-get update && apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
python3 python3-pip curl wget git wkhtmltopdf libssl1.0-dev

RUN mkdir /opt/xml && mkdir /opt/notes && \
wget -P /opt/ https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz && \
cd /opt/ && tar -xvf /opt/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

RUN pip3 install Django requests xmltodict && \
cd /opt/ && django-admin startproject nmapdashboard && cd /opt/nmapdashboard && \
git clone https://github.com/Rev3rseSecurity/WebMap.git && \
mv WebMap nmapreport && cd nmapreport && git checkout v2/master

COPY settings.py /opt/nmapdashboard/nmapdashboard/
COPY urls.py /opt/nmapdashboard/nmapdashboard/

RUN cd /opt/nmapdashboard && python3 manage.py migrate

EXPOSE 8000

ENTRYPOINT ["python3", "/opt/nmapdashboard/manage.py", "runserver", "0:8000"]
113 changes: 113 additions & 0 deletions docker/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'rev3rse-notes:_you_should-change_this..._but_webmap_should_run_on_localhost_only..._so_no_problem_here.'
# ^^^ -> yes, not safe for production. This is the why you shouldn't expose this app on the internet.


# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# ^^^ leave it active for better understand issues and bug
# ^^^ (again, this is a good reason to not expose this app on the internet)

ALLOWED_HOSTS = ['*']
# ^ keep in mind that this app is not designed to be exposed on the internet. Please don't do it.

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'nmapreport',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'nmapdashboard.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'nmapdashboard.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/opt/nmapdashboard/db.sqlite3',
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'
8 changes: 8 additions & 0 deletions docker/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('nmapreport.urls')),
path('report/', include('nmapreport.urls')),
path('admin/', admin.site.urls),
]
Empty file added docker/xml/empty.txt
Empty file.

0 comments on commit 2a0269a

Please sign in to comment.