3 Commits

Author SHA1 Message Date
fab
5af4766663
Update owasp2haproxy.py
A small step.. (still hands on)
2025-01-07 18:25:11 +01:00
fab
2c1401c1cf
Update owasp2haproxy.py
- Error Handling:
    - Added error handling for file operations, JSON parsing, and invalid rule structures.
    - Logs warnings for invalid rules instead of crashing.

- Path Handling:
    - Used pathlib.Path for better path manipulation and readability.
Made paths configurable via environment variables.

- Logging:
    - Replaced print() with Python's logging module for more flexible and structured logging.

- Input Validation:
    - Added checks for missing keys in the input JSON file.

- Rule Formatting:
    - Ensured proper formatting of HAProxy ACL rules.

- Output Directory Permissions:
    - Ensured the output directory is created with parents=True to handle nested directories.

- Code Structure:
    - Encapsulated the main logic in a main() function for better organization.
    - Added docstrings to functions for clarity.
2025-01-03 13:14:27 +01:00
fab
ad5e6cd789
Create owasp2haproxy.py 2024-12-21 01:55:56 +01:00