Package: slack-watchman-eg
Slack Watchman for Enterprise GridAbout Slack Watchman for Enterprise GridSlack Watchman for Enterprise Grid uses the Slack Enterprise Grid DLP API to look for potentially exposed secrets and sensitive data in Slack Enterprise Grid.Note: Slack Watchman for Enterprise Grid is designed for Enterprise Grid subscribers of Slack only. If you use Slack without an Enterprise subscription, you can use the standard version ofSlack WatchmanFeaturesSlack Watchman for Enterprise Grid looks for:API Keys, Tokens & Service AccountsAWS, Azure, GCP, Google API, Slack (keys & webhooks), Twitter, Facebook, GitHubGeneric Private keysAccess Tokens, Bearer Tokens, Client Secrets, Private TokensFilesCertificate filesPotentially interesting/malicious/sensitive files (.docm, .xlsm, .zip etc.)Executable filesKeychain filesConfig files for popular services (Terraform, Jenkins, OpenVPN and more)Personal DataLeaked passwordsPassport numbers, Dates of birth, Social security numbers, National insurance numbers, Drivers licence numbers (UK), Individual Taxpayer Identification NumberCVs, salary informationFinancial dataPayPal Braintree tokens, Bank card details, IBAN numbers, CUSIP numbersBudget filesIt looks for this exposed data across all workspaces in the Enterprise, in the following locations:Public channelsPrivate channelsDraft messagesSlack connect channelsDirect messagesMulti-person direct messagesTime based searchingSlack Watchman for Enterprise Grid can search through all messages sent in your Enterprise in the previous 24 hours. Limitations in the API, and data processing bottlenecks, don't allow for any further than 24 hours to be queried.You can provide time periods to search for using the--hoursand--minutesoptions at runtime. This means you can schedule running regularly, and in general little and often is the best approach.MultiprocessingMultiprocessing is used to search the potentially huge amount of data retrieved when getting all messages sent in an Enterprise. You can specify how many cores to use at runtime, and the more cores you use, the faster processing is generally done. That being said, you are still constrained by the API.I have found the most efficient approach is to use between 8-12 cores.You can specify cores using the optional flag--coresat runtime. If this flag is not set, Slack Watchman will automatically use all available cores up to a maximum of 8.SignaturesSlack Watchman uses custom YAML signatures to detect matches in Slack. These signatures are pulled from the centralWatchman Signatures repository. Slack Watchman for Enterprise Grid automatically updates its signature base at runtime to ensure its using the latest signatures to detect secrets.RequirementsSlack API tokenTo run Slack Watchman for Enterprise Grid, you will need a Slack API access token that is authorised to use the Enterprise DLP API.To do this, you need to create aSlack Appand install it at the organisation level.The app needs to have the followingUser Token Scopesadded:discovery:read
discovery:write
team:read
users:readNote:discovery:readanddiscovery:writecan only be added to an app by Slack themselves, you will need to contact your Slack CSM. They will also provide you with instructions on how to install the app at organisation level and retrieve the access token.Providing tokenProvide the token in the environment variableSLACK_WATCHMAN_EG_TOKENInstallationYou can install the latest stable version via pip:python3 -m pip install slack-watchman-egOr build from source yourself:Download the release source files, then from the top level repository run:python3-mpipbuild
python3-mpipinstall--force-reinstalldist/*.whlDocker ImageSlack Watchman for Enterprise Grid is also available from the Docker hub as a Docker image:docker pull papermountain/slack-watchman-eg:latestYou can then run Slack Watchman for Enterprise Grid in a container, making sure you pass the required environment variables:// help
docker run --rm papermountain/slack-watchman-eg -h

// scan all
docker run --rm -e SLACK_WATCHMAN_EG_TOKENN=xoxp... papermountain/slack-watchman-eg --hours 1 --cores 8
docker run --rm --env-file .env papermountain/slack-watchman-eg --hours 1 --cores 8Usageusage: slack-watchman-eg [-h] [--hours HOURS] [--minutes MINUTES] [--output {json,terminal}] [--cores CORES] [--version] [--users] [--workspaces] [--debug] [--verbose]

Monitoring your Slack Enterprise Grid for sensitive information

options:
  -h, --help            show this help message and exit
  --hours HOURS, -hr HOURS
                        How far back to search in whole hours between 1-24. Defaults to 1 if no acceptable value given
  --minutes MINUTES, -m MINUTES
                        How far back to search in whole minutes between 1-60
  --output {json,terminal}, -o {json,terminal}
                        What logging output to use - JSON formatted output, or textual outputfor reading via terminal. Default is terminal
  --cores CORES, -c CORES
                        Number of cores to use between 1-12
  --version, -v         show program's version number and exit
  --users, -u           Return all users
  --workspaces, -w      Return all workspaces
  --debug, -d           Turn on debug level logging
  --verbose, -V         Turn on more verbose output for JSON logging. This includes more fields, but is largerOther Watchman appsYou may be interested in the other apps in the Watchman family:Slack WatchmanGitLab WatchmanGitHub WatchmanLicenseThe source code for this project is released under theGNU General Public Licence. This project is not associated with Slack Technologies or Salesforce.[2.0.0] - 2023-04-14This major version release brings multiple updates to Slack Watchman for Enterprise Grid, both in usability, functionality and behind the scenes improvements.AddedSupport for centralised signatures from the Watchman Signatures repository. This makes it much easier to keep the signature base for all Watchman applications up to date, and to add functionality to Slack Watchman with new signatures. New signatures are downloaded, and updates to existing signatures are applied, at runtime, meaning Slack Watchman for Enterprise Grid will always be using the most up to date signatures.Option for terminal optimised logging instead of JSON formatting. This is now the default when running with no output option selected, and is a lot easier for humans to read. Also, colours!Option choose between verbose or succinct logging when using JSON output. Default is succinct.Debug logging optionRemovedSupport for tombstoning posts that match signatures removedLocal signatures - Centralised signatures mean that user-created custom signatures can't be used with Slack Watchman for Enterprise Grid anymore. If you have made a signature you think would be good for sharing with the community, feel free to add it to the Watchman Signatures repository, so it can be used in all Watchman applicationsFor the reason above, the functionality to have sandbox signatures has been removed as wellFixedDraft searches were giving an error due to not being able to populate some workspace information. This has now been fixed[1.1.1] - 2022-05-16AddedSignature to find Atlassian tokens[1.1.0] - 2022-04-02AddedDocker image now available from the Docker hub, or by building from source.Support for Python 3.7New logo to play nicely with dark modeFixedMore errors when importing packages[1.0.2] - 2021-12-30FixedError when importing packagesSignatures not being included in the distribution package[1.0.1] - 2021-12-30AddedRefactor and update distribution files[1.0.0] - 2021-12-30Initial release