Skip to main content

Extract and parse DMARC reports/forensic feedback

Project description

Package Pylint

DMARC Parser

Public helper methods

These methods are only included for your convenience. Code is "not" part of the main library/parser but acts as a great segway to implement the parser with ease.

    from dmarc import dmarc_from_folder, dmarc_from_file

    Multi-threaded:    dmarc_from_folder(folder: str, recursive: bool, debug_level: int)
    Single-threaded:   dmarc_from_file(path: str, debug_level: int):

Public class / methods

    DmarcParser(queue_name: str, queue: Queue, debug_level: int)        # Queue is for logging and optional. 
        .read_file(path: str)
        .extract_report_from_zip(data: io.BytesIO) -> dict
        .extract_report_from_gzip(data: io.BytesIO) -> dict
        .extract_report_from_xml(data: bytes) -> dict
        .extract_report_from_eml(data: bytes) -> dict

Minimal example program

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

""" Main """

import argparse
import logging

from dmarc import dmarc_from_folder

def run(debug_level=logging.INFO):
    """ Main """
    dmarc_from_folder("example/private/data/", recursive=True, debug_level=debug_level)

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-v", "--verbose", help="increase output verbosity", action="store_true")
    args = parser.parse_args()
    run_args = {}
    if args.verbose:
        run_args["debug_level"] = logging.DEBUG
    run(**run_args)

Install instructions

# Production
pip install .

# Development
## Setup
python -m venv env
.\env\Scripts\activate

## Install
pip install .

## Test
python -m pytest

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

dmarcparser-0.1.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

dmarcparser-0.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file dmarcparser-0.1.tar.gz.

File metadata

  • Download URL: dmarcparser-0.1.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for dmarcparser-0.1.tar.gz
Algorithm Hash digest
SHA256 fec75a2a06d6c113db90a93b4a4071a741f374ddb87ca9e07d5160ab0e20debd
MD5 09115177f45374fe02c4a174a71aacf2
BLAKE2b-256 f748516d833d6ee01c4e7e60506d38978edee2d6107a3e1f733928ca61744da3

See more details on using hashes here.

File details

Details for the file dmarcparser-0.1-py3-none-any.whl.

File metadata

  • Download URL: dmarcparser-0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for dmarcparser-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef4096cb7100f8a4e1f99df2e0839f9d837e61db74ac26ee61e4374f32db39c1
MD5 cdaa28374729787ea96b258dba538078
BLAKE2b-256 ef4fe96da975066a63e39fb2e9c687d878ddc7599eb7db78a051ad31367ace38

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