Skip to main content

Une bibliothèque pour générer des logs

Project description

LogCrafter

pip version Build Status

LogCrafter is a Python library designed to generate both normal and suspicious log files. It is built to simulate real-world environments by creating diverse log files, which can be particularly useful for training AI in intrusion detection systems.

Features

  • Generation of authentication logs (auth.log)
  • Generation of syslog logs (syslog.log)
  • Generation of failed authentication logs (failed_auth.log)
  • Generation of logs for privilege escalation, SQL injection, phishing, and DDoS attacks
  • Configuration via a YAML file to specify the type of log, output file, and number of logs to generate

Installation

You can install LogCrafter directly from PyPI (coming soon) or by cloning this repository.

pip install logcrafter

Usage

Configuration

Create a YAML configuration file, such as logs_config.yml, to specify the types of logs you want to generate:

logs:
  - type: "auth"
    output_file: "./logs/auth.log"
    log_count: 1000

  - type: "failed_auth"
    output_file: "./logs/failed_auth.log"
    log_count: 100

Generating Logs

Use the LogCrafter CLI to generate logs based on your configuration file:

python -m app.main config/logs_config.yml

Example Log Configuration

Below is an example of a more comprehensive YAML configuration file to showcase the different types of logs that LogCrafter can generate:

logs:
  - type: "auth"
    output_file: "./logs/auth.log"
    log_count: 1000

  - type: "syslog"
    output_file: "./logs/syslog.log"
    log_count: 1000

  - type: "failed_auth"
    output_file: "./logs/failed_auth.log"
    log_count: 500

  - type: "privilege_escalation"
    output_file: "./logs/privilege_escalation.log"
    log_count: 200

  - type: "sql_injection"
    output_file: "./logs/sql_injection.log"
    log_count: 300

  - type: "phishing"
    output_file: "./logs/phishing.log"
    log_count: 150

  - type: "ddos"
    output_file: "./logs/ddos.log"
    log_count: 400

Running Tests

To ensure that everything is working correctly, run the included unit tests:

python3 -m unittest discover -s tests -p 'test_*.py'

Contributing

Contributions are welcome! If you'd like to contribute to LogCrafter, please follow these steps:

  • Fork the repository.
  • Create a new branch (git checkout -b feature-branch-name).
  • Make your changes and commit them (git commit -m 'Add new feature'). Push to the branch (git push origin feature-branch-name).
  • Open a pull request.

Troubleshooting

  • No logs generated: Ensure your YAML configuration file is correctly formatted and that paths are correct.
  • Missing dependencies: Install required dependencies using pip install -r requirements.txt.
  • Permission issues: Run the script with appropriate permissions if writing to system directories.

License

LogCrafter is open-source software licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

log_crafter-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

log_crafter-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file log_crafter-1.0.0.tar.gz.

File metadata

  • Download URL: log_crafter-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for log_crafter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d8ff45e5a3bf50b4399558b5346a0e3f9e55846cec6389d2e83dbfecf05f8081
MD5 c49e80994c79c7095b3aa0dbd65c4652
BLAKE2b-256 6c9dcc3fc6ac2b79868473a2f27c6e4a2a228f01ab12b649b576579901b32f59

See more details on using hashes here.

File details

Details for the file log_crafter-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: log_crafter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for log_crafter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee76a31087a7f9b348b06bcfae54b7df31abac3f383b3e32357a225f32f1ef2a
MD5 36926eca10da621f3c000397db7ce244
BLAKE2b-256 34e53d119bea725e0f4c45896349c1b4da492050ed01952a29df8e0259859119

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page