parse MySQL SHOW GRANTS.
Project description
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
- Documentation: https://github.com/hirose31/mysql-grantparser-python/blob/master/README.md
- Changelog: https://github.com/hirose31/mysql-grantparser-python/blob/master/CHANGELOG.md
- Repository: https://github.com/hirose31/mysql-grantparser-python
- Test status: https://travis-ci.org/hirose31/mysql-grantparser-python
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
Built Distribution
File details
Details for the file mysql-grantparser-1.0.3.tar.gz
.
File metadata
- Download URL: mysql-grantparser-1.0.3.tar.gz
- Upload date:
- Size: 5.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04d1f708a432a35edca0d2812a9e1fab554d2dfc6553f955c0e193e3e528c594 |
|
MD5 | ce923869c0595b68892130355d4d21d4 |
|
BLAKE2b-256 | 20de2e563ca5f19aae4938f98d534e8336f44f1b90afe374fea2c453341ca956 |
File details
Details for the file mysql_grantparser-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: mysql_grantparser-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6cc35cbced766cc24815f5af1c45cd51ba039c9a451af42cb974a0a3f6d0754 |
|
MD5 | 9e82235c41d98f3d4c6623cf956a9512 |
|
BLAKE2b-256 | 6107c7a70efed7177d4e51014304c6fe26f5d4f756af7161d031920969f637f0 |