Commit Graph

33 Commits

Author SHA1 Message Date
salvacybersec
9943f0cf1f Fix: rsync → cp in deploy.sh, add admin scripts, CORS dev mode, .env.example 2025-11-11 05:18:34 +03:00
salvacybersec
3f89ed2158 env 2025-11-11 05:16:12 +03:00
salvacybersec
16f5b39fc6 Add CORS development mode - allow all origins in dev 2025-11-11 05:08:03 +03:00
salvacybersec
b2cb3cb1bb admin user 2025-11-11 05:02:08 +03:00
salvacybersec
686556c7dd cors 2025-11-11 04:58:38 +03:00
salvacybersec
6a0d9169ed fix second time 2025-11-11 04:50:04 +03:00
salvacybersec
e339477f66 dix docker 2025-11-11 04:43:08 +03:00
salvacybersec
05bb2fc55c setup script 2025-11-11 04:36:35 +03:00
salvacybersec
f0b61735cc dockerized v2 2025-11-11 04:31:25 +03:00
salvacybersec
c62478937e dockerized 2025-11-11 04:30:25 +03:00
salvacybersec
8ddd6a983f Login Form 2025-11-11 04:16:13 +03:00
salvacybersec
fa6259e0bd Mail scheme updated v2 2025-11-11 04:09:45 +03:00
salvacybersec
06136294da Mail schemes updated auto system 2025-11-11 03:02:11 +03:00
salvacybersec
a8bedc7fbc feat: Significantly improve AI prompt quality for template generation
Enhanced system prompt:
- Professional cyber security expert role
- Modern HTML/CSS styling instructions
- Responsive design requirements
- Persuasive and urgent tone guidance
- Turkish language grammar emphasis
- Realistic corporate email appearance

Enhanced user prompt:
- Better structured input with emojis (📌)
- Clear field labels (HEDEF ŞİRKET, SENARYO, etc.)
- Detailed HTML example with inline CSS
- Button styling, footer, responsive design
- Max 70 char subject line guidance
- Multiple warnings for quality output

All user inputs are sent to AI:
 company_name (Şirket Adı)
 scenario (Senaryo)
 employee_info (Çalışan Bilgisi) - optional
 custom_prompt (Ek Talimatlar) - optional

template_name and template_type are for DB only, NOT sent to AI.

This will produce much higher quality, styled HTML emails.
2025-11-11 02:49:12 +03:00
salvacybersec
eb2205e4ff fix: Correct preview response data access
Fixed double .data access in template preview:
- Changed response.data.data.rendered_html
- To response.data.rendered_html

templateService already returns response.data, no need to access .data twice.
2025-11-11 02:46:35 +03:00
salvacybersec
69702c4700 fix: Correct database field names in Ollama template creation
The bug was in field mapping when saving AI-generated templates:
- Changed 'type' to 'template_type' (correct column name)
- Changed 'body_template' to 'body_html' (correct column name)

This fixes the 400 Bad Request validation error:
'notNull Violation: MailTemplate.template_type cannot be null'

Now AI template generation works correctly.
2025-11-10 23:45:38 +03:00
salvacybersec
1b3d6f263f fix: Remove unique constraint from template_type and improve AI response handling
Database Changes:
- Remove UNIQUE constraint from mail_templates.template_type
- Allow multiple templates with same type (e.g., multiple bank templates)

Ollama Service Improvements:
- Add detailed logging for AI responses (first 500 chars)
- Check multiple field name variations (subject/Subject/konu/title, body/Body/html/content)
- Improve error messages with actual field names
- Better JSON parsing with fallback
- Clearer prompt instructions to AI

This fixes:
- 400 Validation Error when creating templates with existing type
- AI response parsing issues with different field names
2025-11-10 23:40:46 +03:00
salvacybersec
1107ce1af1 feat: Improve Ollama settings UX
- Auto-save settings before testing connection
- Make model list clickable for easy selection
- Models auto-populate when clicked
- Better user experience for Ollama configuration

Now users can click on a model from the list to select it instantly.
2025-11-10 21:21:29 +03:00
salvacybersec
947d2b521b fix: Add missing logger.js and fix Ollama routes middleware
- Add backend/src/utils/logger.js (Winston logger)
- Fix ollama.routes.js middleware import (requireAuth instead of isAuthenticated)
- Add axios to package.json dependencies
- Create logs directory for Winston
- Fix module paths for Ollama integration

This fixes the backend startup issues after Ollama integration.
2025-11-10 21:19:20 +03:00
salvacybersec
af0510e486 feat: Add Ollama AI integration for automatic mail template generation
 New Features:
- 🤖 AI-powered mail template generation with Ollama
- 📧 Test mail sending with preview
- 🔧 Ollama server and model management
- 🎨 Beautiful AI generation dialog in Templates page
- ⚙️ Ollama settings panel with connection test

Backend:
- Add ollama.service.js - Ollama API integration
- Add ollama.controller.js - Template generation endpoint
- Add ollama.routes.js - /api/ollama/* routes
- Support for multiple Ollama models (llama3.2, mistral, gemma)
- JSON-formatted AI responses with subject + HTML body
- Configurable server URL and model selection

Frontend:
- Settings: Ollama configuration panel
  - Server URL input
  - Model selection
  - Connection test with model listing
- Templates: AI generation dialog
  - Company name, scenario, employee info inputs
  - Custom prompt for AI instructions
  - Auto-save to database
  - Test mail sending functionality

Documentation:
- OLLAMA_SETUP.md - Comprehensive setup guide
- Installation instructions
- Model recommendations
- Usage examples
- Troubleshooting

Tech Stack:
- Ollama API integration (REST)
- Axios HTTP client
- React dialogs with MUI
- Self-hosted AI (privacy-friendly)
- Zero external API dependencies

Example Usage:
  Company: Garanti Bankası
  Scenario: Account security warning
  → AI generates professional phishing test mail in seconds!
2025-11-10 21:13:58 +03:00
salvacybersec
d41ff7671e feat: Complete phishing panel with MUI v7 Grid fixes
-  Full backend implementation (Auth, Companies, Tokens, Templates, Tracking)
-  Complete frontend with Material-UI v7
-  Fixed MUI Grid syntax for v7 (xs/sm/md -> size prop)
-  Domain configuration (single/dual domain support with CORS)
-  Gmail integration with App Password
-  Telegram notifications
-  Mail template management with HTML editor
-  Security features (bcrypt, session-based auth, CORS)
-  Deployment scripts and comprehensive documentation
-  Admin user management scripts
- 📚 7 detailed documentation files (DEPLOYMENT, SECURITY, DOMAIN_SETUP, etc.)

Backend: Node.js + Express + SQLite + Sequelize
Frontend: React + Vite + MUI v7
Features: Token tracking, IP/GeoIP logging, company management, mail templates
2025-11-10 21:03:17 +03:00
salvacybersec
f86cda2978 Domain support 2025-11-10 20:01:41 +03:00
salvacybersec
dea1b874b5 feat: Send actual test email instead of just verifying connection
- testConnection now sends a real test email to the configured Gmail address
- User receives actual email confirmation that setup works
- Email contains success message and system info
2025-11-10 19:31:42 +03:00
salvacybersec
c9ff811cc1 fix: Auto-remove spaces from Gmail App Password
- Google provides App Password with spaces (e.g. 'abcd efgh ijkl mnop')
- Backend now automatically removes all spaces before saving
- Users can paste password directly from Google without manual cleanup
- Also trim gmail_user for safety
2025-11-10 19:27:20 +03:00
salvacybersec
ce31698cc4 fix: Gmail App Password parameter name in settings controller
- Changed gmail_password to gmail_app_password in request body destructuring
- Matches frontend Settings.jsx which sends gmail_app_password
- Backend still stores as 'gmail_password' key in database (for backward compatibility)
2025-11-10 19:24:49 +03:00
salvacybersec
37e9745a4d fix: Settings page API endpoints and data handling
- Fixed handleSave to use separate /gmail and /telegram endpoints
- Changed /test-mail to /test-gmail endpoint
- Added proper null checks in loadSettings to prevent uncontrolled input warnings
- Settings now properly saved to backend with correct endpoint structure
2025-11-10 19:22:27 +03:00
salvacybersec
64c7c392bc fix: templateService return format and Templates page array handling
- Updated templateService to return response.data like other services
- Added fallback to empty array in Templates.jsx to prevent map errors
- Ensures consistency across all service modules
2025-11-10 19:17:13 +03:00
salvacybersec
aed4f759b3 fix: Clean up export statements in detail pages
- Removed extra blank lines after export default in TokenDetail, CompanyDetail, Templates
- Trigger Vite HMR to reload modules with fresh exports
2025-11-10 19:15:13 +03:00
salvacybersec
ec0af5fcf7 fix: Blank page issue - improve auth loading state and error handling
- Fixed AuthContext to properly set user to null on auth check failure
- Added loading spinner in PrivateRoute instead of returning null
- Removed automatic redirect from API interceptor (let React Router handle it)
- Improved error handling in checkAuth to prevent stuck loading state
2025-11-10 19:03:55 +03:00
salvacybersec
20191eb35d feat: Mail template management UI and API CRUD
- Added full CRUD endpoints for mail templates (create, update, delete, preview)
- Introduced Joi validators for template create/update/preview
- Updated routes/controller to support ID and type lookups
- Built React Templates page with HTML editor, preview, and clipboard helpers
- Added navigation entry and route for /templates
- Enhanced documentation (README, QUICKSTART, KULLANIM, frontend/backend README)
2025-11-10 17:27:19 +03:00
salvacybersec
dc16d0c549 feat: Add detail pages for Companies and Tokens
- Created CompanyDetail page with stats, info, and tokens list
- Created TokenDetail page with click history and full tracking info
- Added routes for /companies/:id and /tokens/:id
- Made table rows clickable to navigate to detail pages
- Added edit, delete, and mail resend functionality
- Shows IP addresses, GeoIP location, device and browser info in click logs
2025-11-10 17:13:05 +03:00
salvacybersec
0e5dffb7fc fix: CORS configuration and update all README files
- Fixed dotenv path in app.js to properly load .env from backend root
- Updated CORS to allow http://localhost:5173 (frontend URL)
- Updated README.md with accurate project statistics (58 files, 6677+ lines)
- Updated backend/README.md - marked as Production Ready
- Updated frontend/README.md with complete feature list
- All systems tested and working (backend + frontend)
2025-11-10 17:09:35 +03:00
salvacybersec
19e551f33b first commit: Complete phishing test management panel with Node.js backend and React frontend 2025-11-10 17:00:40 +03:00