-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
628 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ dump.rdb | |
reports/ | ||
**/reports/*.html | ||
**/logs/nerve.log | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.