A Flask application that generates security reports from the Lookout API.
- Real-time security metrics dashboard
- CSV report export functionality
- Configurable time ranges for reporting
- Caching system for improved performance
- Production-ready configuration
- Python 3.8 or higher
- pip (Python package installer)
- Lookout API credentials
- Clone the repository:
git clone [your-repository-url]
cd [repository-name]- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .envEdit .env file and add your configuration:
- LOOKOUT_APP_KEY: Your Lookout API key
- SECRET_KEY: A secure random string for Flask
- Other optional configurations
Run the development server:
flask runThe application will be available at http://localhost:5000
- Set environment variables for production:
export FLASK_ENV=production
export FLASK_APP=app.py- Configure your production settings in
.env:
- Set FLASK_ENV=production
- Configure proper SECRET_KEY
- Set appropriate CACHE settings
- Configure Gunicorn settings if needed
- Run with Gunicorn:
gunicorn -c gunicorn.conf.py app:app-
Environment Variables:
- Never commit
.envfile to version control - Use proper secret management in production
- Rotate SECRET_KEY and API keys regularly
- Never commit
-
Security:
- Enable HTTPS in production
- Set secure headers
- Configure proper firewall rules
-
Monitoring:
- Set up application monitoring
- Configure proper logging
- Set up alerts for errors
-
Caching:
- Consider using Redis or Memcached in production
- Configure appropriate cache timeouts
-
Performance:
- Adjust Gunicorn workers based on server capacity
- Monitor memory usage
- Set up proper load balancing if needed
The application provides two main endpoints:
-
/api/report- GET request
- Query parameter: timeframe (optional)
- Returns JSON security report
-
/api/report/export- GET request
- Query parameter: timeframe (optional)
- Returns CSV file
Valid timeframe values:
- LAST_30_DAYS (default)
- LAST_60_DAYS
- LAST_90_DAYS
- LAST_6_MONTHS
- ALL
- Regularly update dependencies
- Monitor API rate limits
- Review and rotate API keys
- Check logs for errors and issues
- Update security patches
For issues and support, please contact your system administrator or create an issue in the repository.