Skip to main content

parse MySQL SHOW GRANTS.

Project description

Build Status

NAME

mysql_grantparser - parse MySQL SHOW GRANTS

SYNOPSIS

import mysql_grantparser

grants = mysql_grantparser.Exporter(
    host='127.0.0.1',
    port=3306,
    user='root',
    password='pa55w0rd',
).export()

DESCRIPTION

mysql_grantparser is SHOW GRANTS parser for MySQL, inspired by Ruby's Gratan.

This module returns privileges for all users as following dict.

{
    'USER@HOST': {
        'user': USER,
        'host': HOST,
        'objects': {
            'DB_NAME.TABLE_NAME': {
                'privs': [ PRIV_TYPE, PRIV_TYPE, ... ],
                'with': 'GRANT OPTION',
            },
            ...
        },
        'options': {
            'identified': '...',
            'required': '...',
        },
    },
    ...
}

For example, this GRANT statement

GRANT SELECT, INSERT, UPDATE, DELETE ON orcl.* TO 'scott'@'%' IDENTIFIED BY 'tiger' WITH GRANT OPTION;

is represented as following.

{
    'scott@%': {
        'user': 'scott',
        'host': '%',
        'objects': {
            '*.*': {
                privs: [
                    'USAGE'
                ],
            },
            'orcl.*': {
                'privs': [
                    'SELECT',
                    'INSERT',
                    'UPDATE',
                    'DELETE',
                ],
                'with': 'GRANT OPTION',
            }
        },
        'options': {
            'identified': "PASSWORD XXX",
        },
    },
}

SEE ALSO

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

mysql-grantparser-1.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

mysql_grantparser-1.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mysql-grantparser-1.0.1.tar.gz.

File metadata

  • Download URL: mysql-grantparser-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0

File hashes

Hashes for mysql-grantparser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c5df3921c190b21380f86670257c0d41ca6bb193c136dbadc1786bdd3d18394e
MD5 3f2839c8d26123bc29fc549f7fddccd1
BLAKE2b-256 184d8174fadb152f67971856d3df54f840816cd8ecc3c97b960396cbfe94b5e8

See more details on using hashes here.

File details

Details for the file mysql_grantparser-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mysql_grantparser-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0

File hashes

Hashes for mysql_grantparser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ce7435d2ea87116147ac1a33d241027996e5334470eecd012b667f9695e0875
MD5 d8a6368a1e65b9163d993334dd2505a9
BLAKE2b-256 af5732f645818f51177b0951ad757c436c9b57b2bf6d32808b9f71d2d2a0a278

See more details on using hashes here.

Supported by

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