Metadata-Version: 2.4
Name: hades-slack
Version: 0.2.0
Summary: transparent slack message anonymizer
License-Expression: GPL-3.0
Project-URL: Homepage, https://github.com/ImShyMike/hades
Project-URL: Repository, https://github.com/ImShyMike/hades
Project-URL: Issues, https://github.com/ImShyMike/hades/issues
Keywords: slack,privacy,encryption,anonymizer,messages
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: argon2-cffi>=25.1.0
Requires-Dist: cryptography>=46.0.3
Requires-Dist: httpx>=0.28.1
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: slack-sdk>=3.39.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: typer>=0.21.1
Dynamic: license-file

# hades

transparent slack message anonymizer

| Before                        |                        After |
|:-----------------------------:|:----------------------------:|
|![before](./assets/before.png) | ![after](./assets/after.png) |

---

> [!CAUTION]
> This will project can apply PERMANENET CHANGES to your slack messages. Make sure to read the documentation before using it and consider testing it on a test workspace first.

## Installation

Requires Python 3.12+

```bash
uv tool install hades-slack
```

## Usage

### Create Slack apps

Slack has a funny thing called ratelimiting so we need multiple apps so this doesn't take 5 and a half years to complete.

This is automated and needs an "App Configuration Token" from Slack. How do you get one?

- Go to [https://api.slack.com/apps](https://api.slack.com/apps)
- Scroll down to "Your App Configuration Tokens"
- Click "Generate Token"
- Copy the "Access Token" that is generated

```bash
hades create-apps APP_CONFIG_TOKEN_HERE
```

This will create 5 slack apps and save their credentials. (The amount can be changed with the `--count` flag.)

### Authenticating the Slack apps

What we actually need are user tokens for each app. To get those, run:

```bash
hades install-apps
```

This will open a browser window for each app and ask you to authorize it. After authorizing all apps, the user tokens will be saved to `apps.json`.

### Downloading your messages

Before any operation, you will need to make a full download of your messages. This is done with:

```bash
hades download YOUR_USER_ID_HERE --apps apps.json
```

This will use the apps you created to download all your messages and save them to `slack_messages.db`.

Use `--resume` to continue a previously interrupted download.

Use `--purge` to delete any existing messages in the database before downloading.

### Seeing your message stats

Now that you have your messages downloaded, you can see some stats about them with:

```bash
hades stats
```

### Encrypting your messages

To encrypt your messages, run:

```bash
hades encrypt YOUR_PASSWORD_HERE ENCRYPT_OLDER_THAN --apps apps.json --execute
```

`ENCRYPT_OLDER_THAN` is the amount of days old a message has to be to be encrypted. For example, `30` will encrypt all messages older than 30 days and `0` will encrypt all messages.

Removing the `--execute` flag will do a dry run and show you how many messages would be encrypted without actually encrypting them on Slack.

#### Encryption modes

Use `--mode` to control what replaces your message text:

- `text` (default): Replace with custom text via `--text` (default: `[anonymized with hades]`)
- `random`: Replace with random hex string
- `invisible`: Make the message invisible
- `redact`: Replaces non space characters with asterisks (`*`)

#### Channel type filtering

Use `--channel-type` / `-c` to filter which types of channels to encrypt. Can be repeated for multiple types.

- `public` (default): Public channels
- `private`: Private channels
- `dm`: Direct messages
- `gdm`: Group direct messages

For example, to encrypt messages in DMs and private channels older than 30 days, run:

```bash
hades encrypt YOUR_PASSWORD_HERE 30 --apps apps.json -c dm -c private --execute
```

### Decrypting your messages

To decrypt your messages you will need to have a fresh download of your messages (run the `download` command again) and then run:

```bash
hades decrypt YOUR_PASSWORD_HERE DECRYPT_YOUNGER_THAN --apps apps.json --execute
```

`DECRYPT_YOUNGER_THAN` is the amount of days old a message has to be to be decrypted. For example, `30` will decrypt all messages younger than 30 days and `0` will decrypt all messages.

Removing the `--execute` flag will do a dry run and show you how many messages would be decrypted without actually decrypting them on Slack.
