Initial Commit

This commit is contained in:
Evan Reichard 2021-03-16 17:56:23 -04:00
commit 11c83eca13
13 changed files with 124 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
**/__pycache__/
src/overseer.egg-info/
build/
dist/
notes/
overseer_venv/

4
MANIFEST.in Normal file
View File

@ -0,0 +1,4 @@
include src/overseer/static/*
include src/overseer/templates/*
include src/overseer/api/*
include src/overseer/api/v1/*

9
README.md Normal file
View File

@ -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

21
setup.py Normal file
View File

@ -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"
],
)

16
src/overseer/__init__.py Normal file
View File

@ -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

View File

View File

@ -0,0 +1,3 @@
from flask import Blueprint
api = Blueprint('v1', __name__, url_prefix="/api/v1")
from overseer.api.v1 import routes, events

View File

@ -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)

View File

@ -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"

9
src/overseer/config.py Normal file
View File

@ -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")

0
src/overseer/database.py Normal file
View File

20
src/overseer/overseer.py Normal file
View File

@ -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/<path:path>")
def static_resources(path):
return send_from_directory("static", path)
# Version API's
app.register_blueprint(api_v1)

View File

@ -0,0 +1,15 @@
<html>
<head>
<title>Overseer - Port Scanner</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.3/socket.io.min.js" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8">
var socket = io({ path: "/api/v1/socket.io" });
socket.on('connect', function() {
socket.emit('json', {data: 'I\'m connected!'});
});
</script>
</head>
<body>
<p>This is a test</p>
</body>
</html>