diff --git a/README.md b/README.md index 806930c..40d9a81 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +1. [7digital.rb](#7digitalrb) +2. [mock\_server.rb](#mock_serverrb) +3. [read\_logs.rb](#read_logsrb) +4. [cross\_toolchain.rb](#cross_toolchainrb) +5. [rename.rb](#renamerb) +6. [tea-cleaner](#tea-cleaner) + ## 7digital.rb 7digital sells digital music but they can't handle files with non-English names. @@ -64,3 +71,37 @@ Call the `rename.rb` without arguments to see the usage information and an example. ## tea-cleaner + +`tea-cleaner` tries to detect spam accounts on a gitea instance and can remove +them automatically. + +### Run instructions + +See `tea-cleaner.toml.dist` for a description of the available configuration. +Copy this file to `config/tea-cleaner.toml` and change at least `token` and +`server` values. After that if you just run `tea-cleaner` it will give a list +of user accounts which look suspicious to it. Rerunning the command with the +`--live-run` flag will purge the listed accounts and all their activities, +assuming the given token has amdinistrative access to the Gitea instance. + +Run `tea-cleanr --help` to see all available command line options. + +### Applied rules + +Critical: + +- The account is elder than a month and the user hasn't logged in since then. +- User information contains banned words (can be adjusted in the configuration file). +- User's homepage contains percent encoded symbols. + +Possible: + +- User filled fields for personal information: description and website. +- The mail address domain is unusual (can be adjusted in the configuration file). + +The accounts that violate one of the critical rules are marked for removal +right away. Other checks trigger an additional lookup for the last user +activities. If everything user did was creating an empty repository, these +accounts are marked for removal as well. + +The rules are based on my invastigation of spam accounts on this instance. diff --git a/tea-cleaner/Main.hs b/tea-cleaner/Main.hs index e9fead1..5433394 100644 --- a/tea-cleaner/Main.hs +++ b/tea-cleaner/Main.hs @@ -1,3 +1,7 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + module Main ( main ) where diff --git a/tea-cleaner/TeaCleaner/Client.hs b/tea-cleaner/TeaCleaner/Client.hs index 5afd6a5..fae3e6a 100644 --- a/tea-cleaner/TeaCleaner/Client.hs +++ b/tea-cleaner/TeaCleaner/Client.hs @@ -1,3 +1,7 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + module TeaCleaner.Client ( Activity(..) , User(..) diff --git a/tea-cleaner/TeaCleaner/Configuration.hs b/tea-cleaner/TeaCleaner/Configuration.hs index 1d2db32..dad1450 100644 --- a/tea-cleaner/TeaCleaner/Configuration.hs +++ b/tea-cleaner/TeaCleaner/Configuration.hs @@ -1,3 +1,7 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + module TeaCleaner.Configuration ( ProgramOptions(..) , Settings(..) diff --git a/tea-cleaner/TeaCleaner/Filter.hs b/tea-cleaner/TeaCleaner/Filter.hs index 658606d..434825a 100644 --- a/tea-cleaner/TeaCleaner/Filter.hs +++ b/tea-cleaner/TeaCleaner/Filter.hs @@ -1,3 +1,7 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + module TeaCleaner.Filter ( FilterResult(..) , UserFilter(..) diff --git a/tea-cleaner/TeaCleaner/Options.hs b/tea-cleaner/TeaCleaner/Options.hs index 7353f8f..7965a97 100644 --- a/tea-cleaner/TeaCleaner/Options.hs +++ b/tea-cleaner/TeaCleaner/Options.hs @@ -1,3 +1,7 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + module TeaCleaner.Options ( jsonOptions ) where