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.0.tar.gz
.
File metadata
- Download URL: mysql-grantparser-1.0.0.tar.gz
- Upload date:
- Size: 4.9 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 | b699d17393a18b3d7508a6dfbca132c4d4ecb7025136b80862d46f95ed4f99cd |
|
MD5 | bd2330dc4fd2a00763a3a121a856caf3 |
|
BLAKE2b-256 | a919ee22ac5f6ac0844a9df55e33ea6df28e9f9ed19137bfb5a5745cb630220c |
File details
Details for the file mysql_grantparser-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: mysql_grantparser-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.9 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 | b76ac9024a42bdec12bdf2c066829f015aa4278b7043e3b47cb9335b8298036c |
|
MD5 | f00602624ac41a7c60b4dc7af77bb3bb |
|
BLAKE2b-256 | 4d5e4d156fe8ecaac7183366cbcbadde81eea75a30a7856e230b177ea33e27f7 |