Skip to content

Commit

Permalink
blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Sep 30, 2020
1 parent cf07ccc commit c17ea4d
Show file tree
Hide file tree
Showing 30 changed files with 628 additions and 420 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dump.rdb
reports/
**/reports/*.html
**/logs/nerve.log
tests/
35 changes: 35 additions & 0 deletions core/security.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import config

from core.redis import rds
from flask import session, redirect, request
from flask_httpauth import HTTPBasicAuth
from functools import wraps

from werkzeug.security import (
generate_password_hash,
check_password_hash
)

auth = HTTPBasicAuth()

@auth.verify_password
def verify_password(username, password):
if rds.is_ip_blocked(request.remote_addr):
return False

if username == config.WEB_USER and \
check_password_hash(generate_password_hash(config.WEB_PASSW), password):
return True

rds.log_attempt(request.remote_addr)
return False

def session_required(function_to_protect):
@wraps(function_to_protect)
def wrapper(*args, **kwargs):
if not session.get('session'):
return redirect('/login', 307)

return function_to_protect(*args, **kwargs)
return wrapper

22 changes: 22 additions & 0 deletions core/workers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import threading

from bin.scanner import scanner
from bin.attacker import attacker
from bin.scheduler import scheduler


def start_workers():
thread = threading.Thread(target=scanner)
thread.name = "scanner"
thread.daemon = True
thread.start()

thread = threading.Thread(target=attacker)
thread.name = "attacker"
thread.daemon = True
thread.start()

thread = threading.Thread(target=scheduler)
thread.name = "scheduler"
thread.daemon = True
thread.start()
4 changes: 3 additions & 1 deletion db/db_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
'/documents', '/backup', '/backups', '/data'
]

COMMON_LOGIN_PATHS = ['/', '/login', '/remote/login', '/admin', '/administrator', '/panel', '/dashboard', '/adm', '/members', '/private', '/manager']
COMMON_LOGIN_PATHS = ['/', '/login', '/remote/login', '/admin', '/administrator', '/panel', '/dashboard', '/adm', '/members', '/private', '/manager']

COMMON_CGI_PATHS = ['/cgi-bin/status', '/cgi-bin', '/cgi-bin/php', '/cgi-bin/php5', '/cgi-bin/php4']
Loading

0 comments on commit c17ea4d

Please sign in to comment.