Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/forwardemail/python-arf
Node.js wrapper around the Python package arf, which is a processor for Abuse Reporting Format (ARF) messages.
https://github.com/forwardemail/python-arf
abuse arf bulk email format formatting javascript json message messages node parse parser parsing python read report reporting
Last synced: 4 days ago
JSON representation
Node.js wrapper around the Python package arf, which is a processor for Abuse Reporting Format (ARF) messages.
- Host: GitHub
- URL: https://github.com/forwardemail/python-arf
- Owner: forwardemail
- License: mit
- Created: 2020-06-22T07:48:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-20T19:27:27.000Z (over 1 year ago)
- Last Synced: 2024-10-29T04:42:24.882Z (17 days ago)
- Topics: abuse, arf, bulk, email, format, formatting, javascript, json, message, messages, node, parse, parser, parsing, python, read, report, reporting
- Language: JavaScript
- Homepage: https://forwardemail.net
- Size: 258 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-arf
[![build status](https://img.shields.io/travis/com/forwardemail/python-arf.svg)](https://travis-ci.com/forwardemail/python-arf)
[![code coverage](https://img.shields.io/codecov/c/github/forwardemail/python-arf.svg)](https://codecov.io/gh/forwardemail/python-arf)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/forwardemail/python-arf.svg)](LICENSE)
[![npm downloads](https://img.shields.io/npm/dt/python-arf.svg)](https://npm.im/python-arf)> Node.js wrapper around the Python package arf, which is a processor for Abuse Reporting Format (ARF) messages.
## Table of Contents
* [Requirements](#requirements)
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)## Requirements
1. Ensure that you have a Python version of >= 3.5 installed (we do not support older versions of Python anymore across the entire organization):
```sh
python3 --version
```2. Install the package [arf](https://github.com/danielsen/arf):
```sh
pip3 install arf-mime
```## Install
[npm][]:
```sh
npm install python-arf
```[yarn][]:
```sh
yarn add python-arf
```## Usage
Note that the `source` is an ARF message and can be a file path (String), String, or Buffer.
```js
const arf = require('python-arf');// then/catch usage
arf(source)
.then(console.log)
.catch(console.error);// async/await usage
(async () => {
try {
const result = await arf(source);
console.log(result);
} catch (err) {
console.error(err);
}
})();
```Note that `result` is an Object that looks like this:
```js
{
MessageHeaders: {
Received: [
'from example.com (example.com [10.0.1.11]) by example.net with ESMTP id O63d4137594e46; Thu, 08 Mar 2005 16:00:00 -0400',
'from mailserver.example.net (mailserver.example.net [192.0.2.1]) by example.com with ESMTP id M63d4137594e46; Thu, 08 Mar 2005 14:00:00 -0400'
],
From: '',
Date: 'Thu, 8 Mar 2005 17:40:36 EDT',
Subject: 'FW: Earn money',
To: '',
MimeVersion: '1.0',
ContentType: 'multipart/report; report-type=feedback-report; boundary="part1_13d.2e68ed54_boundary"'
},
OriginalMessageHeaders: {
From: '',
Received: 'from mailserver.example.net (mailserver.example.net [192.0.2.1]) by example.com with ESMTP id M63d4137594e46; Thu, 08 Mar 2005 14:00:00 -0400',
To: '',
Subject: 'Earn money',
MimeVersion: '1.0',
ContentType: 'text/plain',
MessageId: '[email protected]',
Date: 'Thu, 02 Sep 2004 12:31:03 -0500'
},
FeedbackReport: {
FeedbackType: 'abuse',
UserAgent: 'SomeGenerator/1.0',
Version: '1',
OriginalMailFrom: '',
OriginalRcptTo: '',
ArrivalDate: 'Thu, 8 Mar 2005 14:00:00 EDT',
ReportingMta: 'dns; mail.example.com',
SourceIp: '192.0.2.1',
AuthenticationResults: 'mail.example.com; spf=fail [email protected]',
ReportedDomain: 'example.net',
ReportedUri: [ 'http://example.net/earn_money.html', 'mailto:[email protected]' ],
RemovalRecipient: '[email protected]'
},
OriginalMessagePayload: 'From: \n' +
'Received: from mailserver.example.net (mailserver.example.net\n' +
'\t[192.0.2.1]) by example.com with ESMTP id M63d4137594e46;\n' +
'\tThu, 08 Mar 2005 14:00:00 -0400\n' +
'To: \n' +
'Subject: Earn money\n' +
'MIME-Version: 1.0\n' +
'Content-type: text/plain\n' +
'Message-ID: [email protected]\n' +
'Date: Thu, 02 Sep 2004 12:31:03 -0500\n' +
'\n' +
'Spam Spam Spam\n' +
'Spam Spam Spam\n' +
'Spam Spam Spam\n' +
'Spam Spam Spam'
}
```Therefore if you wanted to access the original message payload in the ARF report (which is what we needed to do in [Forward Email](https://forwardemail.net), then you'd retrieve it via `result.OriginalMessagePayload`.
## Contributors
| Name | Website |
| -------------- | -------------------------- |
| **Nick Baugh** | |## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/