Skip to main content

SNDS LIB

Build Status codecov Python 3 Updates Total alerts Language grade: Python

Process and verify data from Microsoft's Smart Network Data Service (SNDS) API easily.

SNDSLIB is a wrapper around SNDS Automated Data Access API to facilitate fast data process and analysis.


Table of content


What is SNDS?

Smart Network Data Service (SNDS) is a platform to monitor data from IPs that send emails to Microsoft's servers.

If you send a substantial volume of email messages from your IPs, your can get valuable information about IP reputation, possible blocks, spam complaints and spamtraps hits.

First, you need to sign up for SNDS, request access for your IPs, then enable the Automates Data Access to recieve your API key.


Installation

SNDSLIB has no external dependencies. It runs just with python 3.6 or higher.

pip install sndslib

Simple example of library usage:

    >>> from sndslib import sndslib

    # Connects with snds to get usage data
    >>> r = sndslib.get_data('mykey')

    # Sndslib can give a summary of the state of all IPs
    >>> sndslib.summarize(r)
    {'red': 272, 'green': 710, 'yellow': 852, 'traps': 1298, 'ips': 1834, 'date': '12/31/2019'}

    # even get whole information about a specific IP
    >>> sndslib.search_ip_status('1.1.1.1', r)
    {'activity_end': '12/31/2019 7:00 PM',
    'activity_start': '12/31/2019 10:00 AM',
    'comments': '',
    'complaint_rate': '< 0.1%',
    'data_commands': '1894',
    'filter_result': 'GREEN',
    'ip_address': '1.1.1.1',
    'message_recipients': '1894',
    'rcpt_commands': '1895',
    'sample_helo': '',
    'sample_mailfrom': '',
    'trap_message_end': '',
    'trap_message_start': '',
    'traphits': '0'}

    # Connects with snds to get blocked ranges
    >>> r = sndslib.get_ip_status('mykey')

    # Sndslib can parse the information and extract all blocked IPs
    >>> blocked_ips = sndslib.list_blocked_ips(r)
    >>> print(blocked_ips)
    ['1.1.1.1', '1.1.1.2']

    # Even get all rdns for these IPs
    >>> sndslib.list_blocked_ips_rdns(blocked_ips)
    [{'ip': '1.1.1.1', 'rdns': 'foo.bar.exemple.com'},
     {'ip': '1.1.1.2', 'rdns': 'foo2.bar.exemple.com'}]

CLI

This library contains a CLI to facilitate fast operations in the terminal. Here are some examples of their usage:

Summary of all IPs status

snds -k 'your-key-here' -s

Example output:

Date: 12/31/2020
IPs:       1915
Green:      250
Yellow:    1175
Red:        490
Trap Hits:  990
Blocked:    193

Individual report of a IP

snds -k 'your-key-here' -ip '1.1.1.1'

Example output:

Activity: 1/31/2020 11:59 AM until 1/31/2020 11:59 PM
IP:         1.1.1.1
Messages:    183057
Filter:       GREEN
Complaint:   < 0.1%
Trap Hits:        3

List all IPs blocked

snds -k 'your-key-here' -l

Example output:

1.1.1.1
1.1.1.2
1.1.1.3
...

List all IPs blocked with rDNS

snds -k 'your-key-here' -r

Example output:

1.1.1.1;example.domain1.com
1.1.1.2;example.domain2.com
1.1.1.3;example.domain3.com
...

Incorporate SNDSLIB CLI

You can easily incorporate the sndslib CLI into your own command line tool by using the CLI adapter class:

    from sndslib import cli

    # ... parse key, date and ip arguments

    # Create a instance of the Cli
    command = cli.Cli(key, date)

    # to implement -s flag use
    command.summary()

    # to implement -ips flag use
    command.ip_data(ip)

    # to implement -l flag use
    command.list_blocked_ips()

    # to implement -r flag use
    command.list_blocked_ips_rdns()

More about SNDS

You can get more information about SNDS features in the Microsoft's official pages for SNDS and SNDS Automated Data Access.

Release files for sndslib 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sndslib 0.1.4
File Size Uploaded
sndslib-0.1.4.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sndslib 0.1.4
File Interpreter ABI Platform
sndslib-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / sndslib-0.1.4.tar.gz

Download URL sndslib-0.1.4.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
46c7a2f68f379be8d97274836492454211ed1b780f7f9d916e8735b22aabde1c
BLAKE2b-256 checksum
How to use checksums
2db09808bbbe99c1334d5dab4332a66c3c196f488851aad672817549c4afdc4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.7 Windows/10

Release files / sndslib-0.1.4-py3-none-any.whl

Download URL sndslib-0.1.4-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7243cd5e99651a0eca756500a0282373e0934a6f91ddd398df061540fda050e
BLAKE2b-256 checksum
How to use checksums
656dee8ef999748daf020a700c39232b6a75e1e91a769a40a595d538b86db45e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.7 Windows/10

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page