Name | secpat2gf JSON |
Version |
1.1.0
JSON |
| download |
home_page | |
Summary | convert secret patterns to gf compatible |
upload_time | 2023-02-11 18:15:16 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.6 |
license | MIT License Copyright (c) 2023 Dwi Siswanto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
feed
reader
tutorial
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# secpat2gf
convert secret patterns to gf compatible.
## Install
#### from PyPI
```console
$ pip3 install secpat2gf
```
#### from Source
```console
$ git clone https://github.com/dwisiswant0/secpat2gf
$ cd secpat2gf/
$ pip3 install -r requirements.txt
$ python3 -m build
$ pip3 install dist/secpat2gf-*.whl --force-reinstall
```
## Usage
```console
$ secpat2gf --help
usage: secpat2gf [-h] -r RULE_FILE [-e ENGINE] [-f FLAGS] [-s]
options:
-h, --help show this help message and exit
-r RULE_FILE, --rule-file RULE_FILE
path to rule file/URL
-e ENGINE, --engine ENGINE
set custom engine (default: grep)
-f FLAGS, --flags FLAGS
grep flags (default: -aHnoPr)
-s, --save save to /home/dw1/.gf instead of stdout
```
### Example
Converting YAML-based rule URL to gf compatible
```console
$ secpat2gf -r https://github.com/mazen160/secrets-patterns-db/raw/master/datasets/generic.yml
[02/10/2023 08:56:55 AM] Slack Token pattern
{
"flags": "-aHnPr",
"pattern": "(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"
}
[02/10/2023 08:56:55 AM] test pattern
{
"flags": "-aHnPr",
"pattern": "test"
}
[02/10/2023 08:56:55 AM] generic password pattern
{
"flags": "-aHnPr",
"pattern": "password.+"
}
[02/10/2023 08:56:55 AM] Generic secret pattern
{
"flags": "-aHnPr",
"pattern": "secret.+"
}
...
```
Converting YAML-based rule file to gf & save the results
```console
$ secpat2gf --save -r generic.yaml
[02/10/2023 10:30:56 AM] directory '$HOME/.gf' created successfully
[02/10/2023 10:30:57 AM] Saving Slack Token pattern to $HOME/.gf/slack-token_secrets.json
[02/10/2023 10:30:57 AM] Saving test pattern to $HOME/.gf/test_secrets.json
[02/10/2023 10:30:57 AM] Saving generic password pattern to $HOME/.gf/generic-password_secrets.json
[02/10/2023 10:30:57 AM] Saving Generic secret pattern to $HOME/.gf/generic-secret_secrets.json
[02/10/2023 10:30:57 AM] Saving Generic token pattern to $HOME/.gf/generic-token_secrets.json
...
```
Then we can see that the pattern can be successfully compiled to gf:
```console
$ gf -list
admin-password_secrets
aws-client-id_secrets
aws-mws-id_secrets
aws-secret-key_secrets
basic-auth-credentials_secrets
basic-token_secrets
bearer-token_secrets
$ gf -dump admin-password_secrets # dump pattern
grep -aHnPr "(admin).+(secret|token|key).+" .
```
### Weaponizing
See [workaround](https://github.com/dwisiswant0/gf-secrets#workaround-recycle) from [gf-secrets](https://github.com/dwisiswant0/gf-secrets) to weaponize those patterns.
## Resources
- [secrets-patterns-db](https://github.com/mazen160/secrets-patterns-db) - Secrets Patterns DB: The largest open-source Database for detecting secrets, API keys, passwords, tokens, and more.
- [gf](https://github.com/tomnomnom/gf) - A wrapper around grep, to help you grep for things.
- [gfx](https://github.com/dwisiswant0/gfx) - Improved version of gf by @tomnomnom.
- [gf-secrets](https://github.com/dwisiswant0/gf-secrets) - Secret and/or credential patterns used for gf.
## License
`secpat2gf` is distributed under MIT. See `LICENSE` file.
Raw data
{
"_id": null,
"home_page": "",
"name": "secpat2gf",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "feed,reader,tutorial",
"author": "",
"author_email": "Dwi Siswanto <me@dw1.io>",
"download_url": "https://files.pythonhosted.org/packages/d8/b8/a325b9c5bd83b2e1bbc9d490aaafcac8889295bac08b945716d36bbe5092/secpat2gf-1.1.0.tar.gz",
"platform": null,
"description": "# secpat2gf\n\nconvert secret patterns to gf compatible.\n\n## Install\n\n#### from PyPI\n\n```console\n$ pip3 install secpat2gf\n```\n\n#### from Source\n\n```console\n$ git clone https://github.com/dwisiswant0/secpat2gf\n$ cd secpat2gf/\n$ pip3 install -r requirements.txt\n$ python3 -m build\n$ pip3 install dist/secpat2gf-*.whl --force-reinstall\n```\n\n## Usage\n\n```console\n$ secpat2gf --help\nusage: secpat2gf [-h] -r RULE_FILE [-e ENGINE] [-f FLAGS] [-s]\n\noptions:\n -h, --help show this help message and exit\n -r RULE_FILE, --rule-file RULE_FILE\n path to rule file/URL\n -e ENGINE, --engine ENGINE\n set custom engine (default: grep)\n -f FLAGS, --flags FLAGS\n grep flags (default: -aHnoPr)\n -s, --save save to /home/dw1/.gf instead of stdout\n```\n\n### Example\n\nConverting YAML-based rule URL to gf compatible\n\n```console\n$ secpat2gf -r https://github.com/mazen160/secrets-patterns-db/raw/master/datasets/generic.yml\n[02/10/2023 08:56:55 AM] Slack Token pattern\n{\n \"flags\": \"-aHnPr\",\n \"pattern\": \"(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})\"\n}\n[02/10/2023 08:56:55 AM] test pattern\n{\n \"flags\": \"-aHnPr\",\n \"pattern\": \"test\"\n}\n[02/10/2023 08:56:55 AM] generic password pattern\n{\n \"flags\": \"-aHnPr\",\n \"pattern\": \"password.+\"\n}\n[02/10/2023 08:56:55 AM] Generic secret pattern\n{\n \"flags\": \"-aHnPr\",\n \"pattern\": \"secret.+\"\n}\n...\n```\n\nConverting YAML-based rule file to gf & save the results\n\n```console\n$ secpat2gf --save -r generic.yaml\n[02/10/2023 10:30:56 AM] directory '$HOME/.gf' created successfully\n[02/10/2023 10:30:57 AM] Saving Slack Token pattern to $HOME/.gf/slack-token_secrets.json\n[02/10/2023 10:30:57 AM] Saving test pattern to $HOME/.gf/test_secrets.json\n[02/10/2023 10:30:57 AM] Saving generic password pattern to $HOME/.gf/generic-password_secrets.json\n[02/10/2023 10:30:57 AM] Saving Generic secret pattern to $HOME/.gf/generic-secret_secrets.json\n[02/10/2023 10:30:57 AM] Saving Generic token pattern to $HOME/.gf/generic-token_secrets.json\n...\n```\n\nThen we can see that the pattern can be successfully compiled to gf:\n\n```console\n$ gf -list\nadmin-password_secrets\naws-client-id_secrets\naws-mws-id_secrets\naws-secret-key_secrets\nbasic-auth-credentials_secrets\nbasic-token_secrets\nbearer-token_secrets\n$ gf -dump admin-password_secrets # dump pattern\ngrep -aHnPr \"(admin).+(secret|token|key).+\" .\n```\n\n### Weaponizing\n\nSee [workaround](https://github.com/dwisiswant0/gf-secrets#workaround-recycle) from [gf-secrets](https://github.com/dwisiswant0/gf-secrets) to weaponize those patterns.\n\n## Resources\n\n- [secrets-patterns-db](https://github.com/mazen160/secrets-patterns-db) - Secrets Patterns DB: The largest open-source Database for detecting secrets, API keys, passwords, tokens, and more.\n- [gf](https://github.com/tomnomnom/gf) - A wrapper around grep, to help you grep for things.\n- [gfx](https://github.com/dwisiswant0/gfx) - Improved version of gf by @tomnomnom.\n- [gf-secrets](https://github.com/dwisiswant0/gf-secrets) - Secret and/or credential patterns used for gf.\n\n## License\n\n`secpat2gf` is distributed under MIT. See `LICENSE` file.",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Dwi Siswanto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "convert secret patterns to gf compatible",
"version": "1.1.0",
"split_keywords": [
"feed",
"reader",
"tutorial"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a662d20f0b960a1cedf5bd979c5e6b9eb014c7c317c26fe36bf44ce4662460df",
"md5": "c94db7d4350db34689ee2909423cab98",
"sha256": "6a54fbe7779e2c0658fec8f19034253ded1bc4aefd04e4c1315c9a8b5809ed71"
},
"downloads": -1,
"filename": "secpat2gf-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c94db7d4350db34689ee2909423cab98",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5765,
"upload_time": "2023-02-11T18:15:13",
"upload_time_iso_8601": "2023-02-11T18:15:13.878821Z",
"url": "https://files.pythonhosted.org/packages/a6/62/d20f0b960a1cedf5bd979c5e6b9eb014c7c317c26fe36bf44ce4662460df/secpat2gf-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8b8a325b9c5bd83b2e1bbc9d490aaafcac8889295bac08b945716d36bbe5092",
"md5": "2478630e9fe127a2487799f5216525a6",
"sha256": "e02952747bc7147dc19a5b49fb0f07abec8e9ea8e737bb8d9e4cecddf3b28e28"
},
"downloads": -1,
"filename": "secpat2gf-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2478630e9fe127a2487799f5216525a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4055,
"upload_time": "2023-02-11T18:15:16",
"upload_time_iso_8601": "2023-02-11T18:15:16.509130Z",
"url": "https://files.pythonhosted.org/packages/d8/b8/a325b9c5bd83b2e1bbc9d490aaafcac8889295bac08b945716d36bbe5092/secpat2gf-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 18:15:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "secpat2gf"
}