DownloadDMARCAttachmentsFromGmail


NameDownloadDMARCAttachmentsFromGmail JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/MozaicWorks/DownloadDMARCAttachmentsFromGmail
SummaryDownloads DMARC attachments from Gmail
upload_time2023-04-25 10:25:33
maintainer
docs_urlNone
authorMozaic Works
requires_python>=3.10
license
keywords dmarc gmail
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Download DMARC Attachments From Gmail

## Description

A tool to download DMARC from Gmail email attachments. Consider it under development, so use with care. Feedback and PRs are welcome!

## Installation

```bash
pip3 install DownloadDMARCAttachmentsFromGmail
DownloadDMARCFilesFromGmail --help
```

## How To Use

First, you need to give the tool access to your Gmail account through the API. Here's how to do it for a workspace account:

* Access [https://console.cloud.google.com/](https://console.cloud.google.com/)
* Create a new project, for example named "DownloadDMARCAttachments"
* Select the newly created project
* Enable the Gmail API
  * Navigate to the [API Console](https://console.developers.google.com/)
  * Select on **ENABLE APIS AND SERVICES**
  * Search for **gmail**
  * Select **Gmail API**
  * Select **Enable**
* Configure the **OAuth consent**
  * Select **OAuth consent screen** from the left navigation pane
  * Go throught the wizard to create an App
  * Use in scopes 'https://www.googleapis.com/auth/gmail.modify'
* Configure the **Credentials**
  * Select **Credentials** from the left navigation pane
  * Select **CREATE CREDENTIALS** and select **OAuth Client ID**
  * For **Application type** select **Desktop app**
  * For **Name** fill in "DownloadDMARCAttachments"
  * Select **Create**
  * Download the JSON file
* Create a `~/.config/dmarc` folder, copy the client json file into it, and rename it to `client_id.json`

Second, you need to ensure that all the DMARC messages in your Gmail inbox have a label. By default, the label is "DMARC".

Third, create a label under which the messages will be posted after a successful download of the attachment. By default, the tool uses "PROCESSED_DMARC".

You are now ready to run it. Just pass in the label name and the processed label name, if different from the defaults. The tool will download the attachments for messages found under the DMARC label into an `out` folder and replace the DMARC label with the processed label. This allows you to double check the results, and do whatever you want with the processed messages.

## Renewing OAuth Client ID

When renewing the OAuth Client ID, download the OAuth client JSON file again.

Move the file to `./secrets/client_id.json`.

Delete the file `./secrets/token.pickle`.

## Known Issues

We're still figuring out the different ways the attachment id is found in Gmail messages, so processing fails for some messages.

## Limitations

Due to limitations in the Gmail API, the tool processes max. 500 messages at once. If you have more than 500 DMARC messages, just run it again until you process all the files.

## Generating a report

If you're looking for a simple tool to generate a report from the downloaded attachments, check out the companion tool [DMARC Reporting](https://github.com/MozaicWorks/DMARCReporting).

## Development setup

* Make sure you have python 3.10
* Install [pipenv](https://pipenv.pypa.io/en/latest/#install-pipenv-today)

With default arguments, i.e. `--labelName DMARC --processedLabelName PROCESSED_DMARC`

```bash
make install-dev
make run
```

To pass arguments:

```bash
make run args="--labelName dmarc --processedLabelName processed-dmarc"
```

## Development Notes

This tool was started by [Alex Bolboaca](https://twitter.com/alexboly) to automate the DMARC processing flow that he uses.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MozaicWorks/DownloadDMARCAttachmentsFromGmail",
    "name": "DownloadDMARCAttachmentsFromGmail",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "DMARC Gmail",
    "author": "Mozaic Works",
    "author_email": "alex.bolboaca@mozaicworks.com",
    "download_url": "https://files.pythonhosted.org/packages/0a/37/fc2e7151c977f8f7d3aeb50e2f45099423eb60bb91dda8815efcfc0a738a/DownloadDMARCAttachmentsFromGmail-0.2.0.tar.gz",
    "platform": null,
    "description": "# Download DMARC Attachments From Gmail\n\n## Description\n\nA tool to download DMARC from Gmail email attachments. Consider it under development, so use with care. Feedback and PRs are welcome!\n\n## Installation\n\n```bash\npip3 install DownloadDMARCAttachmentsFromGmail\nDownloadDMARCFilesFromGmail --help\n```\n\n## How To Use\n\nFirst, you need to give the tool access to your Gmail account through the API. Here's how to do it for a workspace account:\n\n* Access [https://console.cloud.google.com/](https://console.cloud.google.com/)\n* Create a new project, for example named \"DownloadDMARCAttachments\"\n* Select the newly created project\n* Enable the Gmail API\n  * Navigate to the [API Console](https://console.developers.google.com/)\n  * Select on **ENABLE APIS AND SERVICES**\n  * Search for **gmail**\n  * Select **Gmail API**\n  * Select **Enable**\n* Configure the **OAuth consent**\n  * Select **OAuth consent screen** from the left navigation pane\n  * Go throught the wizard to create an App\n  * Use in scopes 'https://www.googleapis.com/auth/gmail.modify'\n* Configure the **Credentials**\n  * Select **Credentials** from the left navigation pane\n  * Select **CREATE CREDENTIALS** and select **OAuth Client ID**\n  * For **Application type** select **Desktop app**\n  * For **Name** fill in \"DownloadDMARCAttachments\"\n  * Select **Create**\n  * Download the JSON file\n* Create a `~/.config/dmarc` folder, copy the client json file into it, and rename it to `client_id.json`\n\nSecond, you need to ensure that all the DMARC messages in your Gmail inbox have a label. By default, the label is \"DMARC\".\n\nThird, create a label under which the messages will be posted after a successful download of the attachment. By default, the tool uses \"PROCESSED_DMARC\".\n\nYou are now ready to run it. Just pass in the label name and the processed label name, if different from the defaults. The tool will download the attachments for messages found under the DMARC label into an `out` folder and replace the DMARC label with the processed label. This allows you to double check the results, and do whatever you want with the processed messages.\n\n## Renewing OAuth Client ID\n\nWhen renewing the OAuth Client ID, download the OAuth client JSON file again.\n\nMove the file to `./secrets/client_id.json`.\n\nDelete the file `./secrets/token.pickle`.\n\n## Known Issues\n\nWe're still figuring out the different ways the attachment id is found in Gmail messages, so processing fails for some messages.\n\n## Limitations\n\nDue to limitations in the Gmail API, the tool processes max. 500 messages at once. If you have more than 500 DMARC messages, just run it again until you process all the files.\n\n## Generating a report\n\nIf you're looking for a simple tool to generate a report from the downloaded attachments, check out the companion tool [DMARC Reporting](https://github.com/MozaicWorks/DMARCReporting).\n\n## Development setup\n\n* Make sure you have python 3.10\n* Install [pipenv](https://pipenv.pypa.io/en/latest/#install-pipenv-today)\n\nWith default arguments, i.e. `--labelName DMARC --processedLabelName PROCESSED_DMARC`\n\n```bash\nmake install-dev\nmake run\n```\n\nTo pass arguments:\n\n```bash\nmake run args=\"--labelName dmarc --processedLabelName processed-dmarc\"\n```\n\n## Development Notes\n\nThis tool was started by [Alex Bolboaca](https://twitter.com/alexboly) to automate the DMARC processing flow that he uses.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Downloads DMARC attachments from Gmail",
    "version": "0.2.0",
    "split_keywords": [
        "dmarc",
        "gmail"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "02732b5645a5e6b2c11d8538e5c7835c01d71a69af7b8aceada067484acfb83f",
                "md5": "2207d134c7d5ad3d376ff8753a6a56cb",
                "sha256": "06340aa37251ef0671eab28ab4807dc09b1945ae779887ea693ade14d45da69e"
            },
            "downloads": -1,
            "filename": "DownloadDMARCAttachmentsFromGmail-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2207d134c7d5ad3d376ff8753a6a56cb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8357,
            "upload_time": "2023-04-25T10:25:31",
            "upload_time_iso_8601": "2023-04-25T10:25:31.504017Z",
            "url": "https://files.pythonhosted.org/packages/02/73/2b5645a5e6b2c11d8538e5c7835c01d71a69af7b8aceada067484acfb83f/DownloadDMARCAttachmentsFromGmail-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a37fc2e7151c977f8f7d3aeb50e2f45099423eb60bb91dda8815efcfc0a738a",
                "md5": "c72669e17bf1b6f16a335aba74fa5f59",
                "sha256": "35441529c318652e9a4ddc4e05b33f8fbf3f68fb53dc1a6d12bd68e40c257434"
            },
            "downloads": -1,
            "filename": "DownloadDMARCAttachmentsFromGmail-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c72669e17bf1b6f16a335aba74fa5f59",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11212,
            "upload_time": "2023-04-25T10:25:33",
            "upload_time_iso_8601": "2023-04-25T10:25:33.365674Z",
            "url": "https://files.pythonhosted.org/packages/0a/37/fc2e7151c977f8f7d3aeb50e2f45099423eb60bb91dda8815efcfc0a738a/DownloadDMARCAttachmentsFromGmail-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-25 10:25:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "MozaicWorks",
    "github_project": "DownloadDMARCAttachmentsFromGmail",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "downloaddmarcattachmentsfromgmail"
}
        
Elapsed time: 1.14820s