mastools - Tools for interacting directly with a Mastodon instance's database
Installation
If you just want to use mastools and not work on the project itself: pip install mastools.
If you want to help develop mastools and have poetry installed, clone this repo and run poetry install.
If you want to develop mastools but don't have poetry, use pip to install the dependencies mentioned in the [tool.poetry.dependencies] section of pyproject.toml.
Configuration
Make a file named ~/.mastools/config.json like:
{
"host": "localhost",
"database": "mastodon",
"user": "mastodon",
"password": "0xdeadbeef"
}
All mastools components will use this database configuration.
The tool
Starting with version 0.2.0, there's only one main mastools command which has
multiple subcommands. show-user-changes is still a functioning command for
temporary backward compatibility, but it will be removed soon.
mastools subcommands:
show-unconfirmed-users
Show users who haven't confirmed their email yet, ordered by their creation date from oldest to newest.
This is useful for detection a flood of newly created junk accounts.
$ mastools show-unconfired-users
crqcrujofa <cfvzm@example.com> was created at 2019-10-25 10:10:18.406158
lkjmadf <ljchrew@example.com> was created at 2019-10-25 13:06:04.175580
show-user-changes
Show any new, changed, or deleted accounts that mention URLs in their account info.
This is super common for spammers, who like to stuff their crummy website's info into every single field possible. Suppose you run this hourly and email yourself the results (which will usually be empty unless your instance is very busy). Now you can catch those "https://support-foo-corp/" spammers before they have a chance to post!
For example I run this from a cron job on my instance like:
10 * * * * /home/me/mastools/.venv/bin/mastools show-user-changes
to get an hourly update of changes. This gives a report like:
Changed user: tek
fields:
- 'Avatar': 'Me, at night, with tunes'
'Website': 'https://honeypot.net'
+ 'Avatar': 'Me, at night, with music'
note:
<unchanged>
New user: new_spammer
fields:
+ 'website': 'https://example.com/foo-corp-tech-support'
note:
+ 'ALL UR FRAUD^WSUPPORT NEEDS'
Deleted user: old_spammer
fields:
- 'website': 'https://example.com/bar-inc-tech-support'
note:
- 'SEND ME YOUR IP ADDRESS AND CREDIT CARD'
License
Distributed under the terms of the MIT license, mastools is free and open source software.
History
- v0.2.0 - 2019-10-27: Added
mastoolscommand andshow_unconfirmed_userssubcommand - v0.1.3 - 2019-09-25: Productionizing
- v0.1.2 - 2019-09-25: Prettier show-user-changes output
- v0.1.1 - 2019-09-24: Same code, but pushing new metadata to pypi
- v0.1.0 - 2019-09-24: First release
Metadata
Release files for mastools 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mastools-0.2.0.tar.gz | 9.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mastools-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / mastools-0.2.0.tar.gz
| Download URL | mastools-0.2.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89a208d0da0c6985c6f697c909bd93fdcd8c099df93e9b3a3347052e0f7ead28
|
|
BLAKE2b-256 checksum How to use checksums |
48ca67403d22ac2ad89066065e36403c6f84b93631b07f7644c59bb7dcc49b54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.9 Darwin/19.0.0
|
Release files / mastools-0.2.0-py3-none-any.whl
| Download URL | mastools-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc05f1bc8aab57f06dad623e07339cebc0e0b857d8ad21fef7063ac1ebe305e7
|
|
BLAKE2b-256 checksum How to use checksums |
2a97a5b5256e138634da3829685cdfe4cf5a7be94e0e53875bd48cd56b552268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.17 CPython/3.6.9 Darwin/19.0.0
|
Security for mastools 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.