-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major cleanup and restructuring: - Removed unnecessary files - Added …
…MIT license - Updated project structure - Cleaned up dependencies - Improved configuration - Enhanced documentation
- Loading branch information
Showing
35 changed files
with
649 additions
and
879 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 |
---|---|---|
@@ -1,17 +1,51 @@ | ||
*.pyc | ||
# Python | ||
__pycache__/ | ||
.env | ||
*.db | ||
instance/ | ||
.pytest_cache/ | ||
.coverage | ||
htmlcov/ | ||
dist/ | ||
*.py[cod] | ||
*$py.class | ||
*.so | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Virtual Environment | ||
venv/ | ||
ENV/ | ||
env/ | ||
|
||
# IDE | ||
.idea/ | ||
.vscode/ | ||
*.swp | ||
*.swo | ||
|
||
# Flask | ||
instance/ | ||
.webassets-cache | ||
*.db | ||
|
||
# Environment variables | ||
.env | ||
|
||
# Logs | ||
logs/ | ||
*.log | ||
|
||
# Uploads | ||
uploads/ | ||
venv/ | ||
ghostsec.db | ||
|
||
# OS | ||
.DS_Store | ||
Thumbs.db |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 GhostSec | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Binary file not shown.
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 |
---|---|---|
@@ -1,2 +1,89 @@ | ||
# GhostSec - Cybersecurity Learning Platform | ||
|
||
A Flask-based web application for cybersecurity education and training. | ||
|
||
## Features | ||
|
||
- User Authentication (Login/Register) | ||
- User Dashboard | ||
- Email Integration | ||
- Rate Limiting | ||
- Secure Password Handling | ||
- Error Logging | ||
|
||
## Installation | ||
|
||
1. Clone the repository: | ||
```bash | ||
git clone https://github.com/yourusername/ghostsec.git | ||
cd ghostsec | ||
``` | ||
|
||
2. Create a virtual environment and activate it: | ||
```bash | ||
python -m venv venv | ||
venv\Scripts\activate # Windows | ||
source venv/bin/activate # Linux/Mac | ||
``` | ||
|
||
3. Install dependencies: | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
4. Configure environment variables: | ||
- Copy `.env.example` to `.env` | ||
- Update the values in `.env` with your configuration | ||
|
||
5. Initialize the database: | ||
```bash | ||
python | ||
>>> from app import db | ||
>>> db.create_all() | ||
>>> exit() | ||
``` | ||
|
||
6. Run the application: | ||
```bash | ||
python app.py | ||
``` | ||
|
||
The application will be available at `http://localhost:5000` | ||
|
||
## Project Structure | ||
|
||
``` | ||
ghostsec/ | ||
├── app.py # Application initialization | ||
├── models.py # Database models | ||
├── routes.py # Route handlers | ||
├── requirements.txt # Project dependencies | ||
├── .env # Environment variables | ||
├── instance/ # Instance-specific files | ||
├── logs/ # Application logs | ||
├── static/ # Static files (CSS, JS) | ||
├── templates/ # HTML templates | ||
└── uploads/ # User uploads | ||
``` | ||
|
||
## Development | ||
|
||
1. Set up environment variables in `.env`: | ||
``` | ||
SECRET_KEY=your_secret_key | ||
DATABASE_URL=sqlite:///ghostsec.db | ||
MAIL_SERVER=smtp.gmail.com | ||
MAIL_PORT=587 | ||
MAIL_USE_TLS=True | ||
[email protected] | ||
MAIL_PASSWORD=your_app_password | ||
``` | ||
|
||
2. Run in development mode: | ||
```bash | ||
python app.py | ||
``` | ||
|
||
## License | ||
|
||
MIT License |
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 |
---|---|---|
@@ -1,6 +1,51 @@ | ||
from ghostsec import create_app | ||
from flask import Flask | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_bcrypt import Bcrypt | ||
from flask_login import LoginManager | ||
from flask_mail import Mail | ||
from flask_limiter import Limiter | ||
from flask_limiter.util import get_remote_address | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
app = create_app() | ||
# Load environment variables | ||
load_dotenv() | ||
|
||
# Initialize Flask and extensions | ||
app = Flask(__name__) | ||
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'dev_key_123') | ||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'sqlite:///ghostsec.db') | ||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | ||
|
||
# Email configuration | ||
app.config['MAIL_SERVER'] = os.getenv('MAIL_SERVER', 'smtp.gmail.com') | ||
app.config['MAIL_PORT'] = int(os.getenv('MAIL_PORT', 587)) | ||
app.config['MAIL_USE_TLS'] = os.getenv('MAIL_USE_TLS', 'True').lower() == 'true' | ||
app.config['MAIL_USERNAME'] = os.getenv('MAIL_USERNAME') | ||
app.config['MAIL_PASSWORD'] = os.getenv('MAIL_PASSWORD') | ||
|
||
# Initialize extensions | ||
db = SQLAlchemy(app) | ||
bcrypt = Bcrypt(app) | ||
login_manager = LoginManager(app) | ||
mail = Mail(app) | ||
limiter = Limiter( | ||
app=app, | ||
key_func=get_remote_address, | ||
default_limits=["200 per day", "50 per hour"] | ||
) | ||
|
||
# Configure login | ||
login_manager.login_view = 'login' | ||
login_manager.login_message_category = 'info' | ||
|
||
# Import routes after app initialization to avoid circular imports | ||
from routes import * | ||
|
||
if __name__ == '__main__': | ||
app.run() | ||
# Create required directories | ||
os.makedirs('logs', exist_ok=True) | ||
os.makedirs('uploads', exist_ok=True) | ||
os.makedirs('instance', exist_ok=True) | ||
|
||
app.run(debug=True) |
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 os | ||
|
||
files_to_remove = [ | ||
"debug_app.py", | ||
"debug_server.py", | ||
"ghostsec_app.py", | ||
"gunicorn_config.py", | ||
"host.py", | ||
"ngrok_server.py", | ||
"production_server.py", | ||
"run_debug.py", | ||
"run_production.py", | ||
"run_public.py", | ||
"run_server.py", | ||
"run_with_ngrok.py", | ||
"simple_server.py", | ||
"start_server.py", | ||
"waitress_server.py", | ||
"wsgi.py", | ||
"test_redis.py", | ||
"run.py", | ||
"deploy.py", | ||
"Procfile", | ||
"render.yaml", | ||
"ngrok.yml", | ||
"Memurai-Developer.msi" | ||
] | ||
|
||
for file in files_to_remove: | ||
try: | ||
if os.path.exists(file): | ||
os.remove(file) | ||
print(f"Removed {file}") | ||
except Exception as e: | ||
print(f"Error removing {file}: {e}") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.