From 11c83eca13df2f0c7ccc4c50395cc1aa3d49315a Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Tue, 16 Mar 2021 17:56:23 -0400 Subject: [PATCH] Initial Commit --- .gitignore | 6 ++++++ MANIFEST.in | 4 ++++ README.md | 9 +++++++++ setup.py | 21 +++++++++++++++++++++ src/overseer/__init__.py | 16 ++++++++++++++++ src/overseer/api/__init__.py | 0 src/overseer/api/v1/__init__.py | 3 +++ src/overseer/api/v1/events.py | 12 ++++++++++++ src/overseer/api/v1/routes.py | 9 +++++++++ src/overseer/config.py | 9 +++++++++ src/overseer/database.py | 0 src/overseer/overseer.py | 20 ++++++++++++++++++++ src/overseer/templates/index.html | 15 +++++++++++++++ 13 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 MANIFEST.in create mode 100644 README.md create mode 100644 setup.py create mode 100644 src/overseer/__init__.py create mode 100644 src/overseer/api/__init__.py create mode 100644 src/overseer/api/v1/__init__.py create mode 100644 src/overseer/api/v1/events.py create mode 100644 src/overseer/api/v1/routes.py create mode 100644 src/overseer/config.py create mode 100644 src/overseer/database.py create mode 100644 src/overseer/overseer.py create mode 100644 src/overseer/templates/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9dbd1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +**/__pycache__/ +src/overseer.egg-info/ +build/ +dist/ +notes/ +overseer_venv/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..7285a76 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include src/overseer/static/* +include src/overseer/templates/* +include src/overseer/api/* +include src/overseer/api/v1/* diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf88877 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Overseer +## Description +Overseer is a port scanning web interface. All current and historical results are stored in a database. + +## Building + + +## Running + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b2f04be --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +from setuptools import setup, find_packages + +setup( + name = "overseer", + description = "Port Scanning Web Interface", + author = "Evan Reichard", + version = "0.0.1", + packages = find_packages("src"), + package_dir= {'': 'src'}, + zip_safe = False, + include_package_data = True, + entry_points = { + "console_scripts": [ + "overseer = overseer:cli" + ] + }, + install_requires = [ + "Flask", + "flask_socketio" + ], +) diff --git a/src/overseer/__init__.py b/src/overseer/__init__.py new file mode 100644 index 0000000..1f0990a --- /dev/null +++ b/src/overseer/__init__.py @@ -0,0 +1,16 @@ +import click +from overseer.config import EnvConfig +from flask import Flask +from flask.cli import FlaskGroup + +app = Flask(__name__) +config = EnvConfig() + +def create_app(): + return app + +@click.group(cls=FlaskGroup, create_app=create_app) +def cli(): + """Management script for the Wiki application.""" + +import overseer.overseer diff --git a/src/overseer/api/__init__.py b/src/overseer/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/overseer/api/v1/__init__.py b/src/overseer/api/v1/__init__.py new file mode 100644 index 0000000..10d1d78 --- /dev/null +++ b/src/overseer/api/v1/__init__.py @@ -0,0 +1,3 @@ +from flask import Blueprint +api = Blueprint('v1', __name__, url_prefix="/api/v1") +from overseer.api.v1 import routes, events diff --git a/src/overseer/api/v1/events.py b/src/overseer/api/v1/events.py new file mode 100644 index 0000000..bf1817f --- /dev/null +++ b/src/overseer/api/v1/events.py @@ -0,0 +1,12 @@ +from overseer import app +from flask_socketio import SocketIO + +socketio = SocketIO(app, path="/api/v1/socket.io") + +@socketio.on("message") +def handle_message(data): + print("RAW DATA: %s" % data) + +@socketio.on("json") +def handle_json(json): + print("JSON DATA: %s" % json) diff --git a/src/overseer/api/v1/routes.py b/src/overseer/api/v1/routes.py new file mode 100644 index 0000000..a2166e0 --- /dev/null +++ b/src/overseer/api/v1/routes.py @@ -0,0 +1,9 @@ +from overseer.api.v1 import api + +@api.route('/status', methods=["GET"]) +def status(): + return "STATUS PLACEHOLDER" + +@api.route('/scan', methods=["GET"]) +def scan(): + return "SCAN PLACEHOLDER" diff --git a/src/overseer/config.py b/src/overseer/config.py new file mode 100644 index 0000000..12e5d7d --- /dev/null +++ b/src/overseer/config.py @@ -0,0 +1,9 @@ +import os + +def get_env(key, default=None, required=False): + if required: + assert key in os.environ, "Missing Environment Variable: %s" % key + return os.environ.get(key, default) + +class EnvConfig: + DATABASE = get_env("OVERSEER_DB", default="sqlite") diff --git a/src/overseer/database.py b/src/overseer/database.py new file mode 100644 index 0000000..e69de29 diff --git a/src/overseer/overseer.py b/src/overseer/overseer.py new file mode 100644 index 0000000..626fe12 --- /dev/null +++ b/src/overseer/overseer.py @@ -0,0 +1,20 @@ +from overseer import app +from flask import Flask, make_response, render_template, send_from_directory +from overseer.api.v1 import api as api_v1 + +""" +Initial Entrypoint to the SPA (i.e. 'index.html') +""" +@app.route("/", methods=["GET"]) +def main_entry(): + return make_response(render_template("index.html")) + +""" +Front End Static Resources +""" +@app.route("/static/") +def static_resources(path): + return send_from_directory("static", path) + +# Version API's +app.register_blueprint(api_v1) diff --git a/src/overseer/templates/index.html b/src/overseer/templates/index.html new file mode 100644 index 0000000..e3ba218 --- /dev/null +++ b/src/overseer/templates/index.html @@ -0,0 +1,15 @@ + + + Overseer - Port Scanner + + + + +

This is a test

+ +