https://github.com/affix/pentest-reporter
A simple pentest report generator using Python, Pandoc and Angular
https://github.com/affix/pentest-reporter
Last synced: 6 months ago
JSON representation
A simple pentest report generator using Python, Pandoc and Angular
- Host: GitHub
- URL: https://github.com/affix/pentest-reporter
- Owner: affix
- License: mit
- Created: 2025-12-12T10:21:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-14T21:45:15.000Z (7 months ago)
- Last Synced: 2025-12-17T10:16:49.738Z (7 months ago)
- Language: Python
- Size: 230 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pentest Report Generator Web Application
A Flask + Angular web application for generating professional pentest reports from markdown files. Based on the note-to-report.py script logic.
## Features
- Upload multiple markdown files
- Configurable report settings:
- Title and subtitle
- Author information (name, position, email)
- Title page colors (background, text, rule)
- Logo (file upload or remote URL)
- Automatic CVSS vector parsing and severity table generation
- PDF generation using Pandoc with the Eisvogel template
- Modern, responsive Angular frontend
## Prerequisites
### Backend Requirements
- Python 3.8+
- Pandoc (with LaTeX support)
- Eisvogel template for Pandoc
### Frontend Requirements
- Node.js 18+ and npm
### Installing Pandoc and Eisvogel Template
#### Ubuntu/Debian:
```bash
sudo apt-get update
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra
```
#### macOS:
```bash
brew install pandoc
brew install basictex
```
#### Install Eisvogel Template:
```bash
mkdir -p ~/.pandoc/templates
cd ~/.pandoc/templates
wget https://raw.githubusercontent.com/enhuiz/eisvogel/refs/heads/master/eisvogel.tex
```
## Installation
### Backend Setup
1. Navigate to the backend directory:
```bash
cd backend
```
2. Create a virtual environment:
```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install Python dependencies:
```bash
pip install -r requirements.txt
```
4. Run the Flask server:
```bash
python app.py
```
The backend will start on `http://localhost:5000`
### Frontend Setup
1. Navigate to the frontend directory:
```bash
cd frontend
```
2. Install npm dependencies:
```bash
npm install
```
3. Start the Angular development server:
```bash
npm start
```
The frontend will start on `http://localhost:4200`
## Usage
1. Open your browser and navigate to `http://localhost:4200`
2. Upload one or more markdown files (.md)
3. Configure your report settings:
- Enter a title and subtitle
- Add author information
- Customize title page colors (use hex color picker or enter hex codes)
- Add a logo (upload a file or provide a URL)
4. Click "Generate Report"
5. The PDF will be automatically downloaded when ready
## Markdown File Format
Your markdown files can include YAML frontmatter with CVSS vectors:
```markdown
---
cvss: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
severity: [High]
---
## Vulnerability Title
Description of the vulnerability...
### Impact
Impact details...
### Remediation
Remediation steps...
```
If a CVSS vector is provided, the application will automatically generate a severity table in the report.
## API Endpoints
### Health Check
```
GET /api/health
```
Returns the health status of the API.
### Generate Report
```
POST /api/generate-report
```
**Form Data:**
- `files`: Multiple markdown files
- `config`: JSON configuration object
- `logo`: (Optional) Logo image file
**Config Object:**
```json
{
"title": "Report Title",
"subtitle": "Report Subtitle",
"author": ["Name", "Position", "Email"],
"titlepage_color": "241C3A",
"titlepage_text_color": "FFFAFA",
"titlepage_rule_color": "FFFAFA",
"logo_url": "https://example.com/logo.png"
}
```
**Response:**
- Content-Type: `application/pdf`
- Binary PDF file
## Project Structure
```
.
├── backend/
│ ├── app.py # Flask application
│ ├── requirements.txt # Python dependencies
│ ├── uploads/ # Temporary file uploads (created at runtime)
│ └── temp/ # Temporary processing directory (created at runtime)
│
├── frontend/
│ ├── src/
│ │ ├── app/
│ │ │ ├── app.component.ts # Main component
│ │ │ ├── app.component.html # Component template
│ │ │ ├── app.component.css # Component styles
│ │ │ ├── app.module.ts # App module
│ │ │ └── report.service.ts # API service
│ │ ├── index.html # Main HTML file
│ │ ├── main.ts # Bootstrap file
│ │ └── styles.css # Global styles
│ ├── angular.json # Angular configuration
│ ├── package.json # npm dependencies
│ └── tsconfig.json # TypeScript configuration
│
└── README.md # This file
```
## Development
### Backend Development
The Flask app runs in debug mode by default. Any changes to `app.py` will automatically reload the server.
### Frontend Development
The Angular development server supports hot module replacement. Any changes to the TypeScript, HTML, or CSS files will automatically refresh the browser.
## Production Deployment
### Backend
For production, use a WSGI server like Gunicorn:
```bash
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app
```
### Frontend
Build the Angular app for production:
```bash
cd frontend
npm run build
```
The built files will be in `frontend/dist/`. Serve them with a web server like Nginx.
### CORS Configuration
For production, update the CORS settings in `backend/app.py` to only allow your frontend domain:
```python
CORS(app, resources={r"/api/*": {"origins": "https://yourdomain.com"}})
```
## Troubleshooting
### Pandoc Not Found
Ensure Pandoc is installed and in your PATH. Test with:
```bash
pandoc --version
```
### Eisvogel Template Not Found
Verify the template is in the correct location:
```bash
ls ~/.pandoc/templates/eisvogel.tex
```
### LaTeX Errors
Make sure you have a complete LaTeX distribution installed. The Eisvogel template requires several LaTeX packages.
### CORS Errors
If you see CORS errors in the browser console, ensure the Flask backend is running and Flask-CORS is properly configured.
## License
MIT License. See LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.