[ejabberd] mass removal of bot users

Evgeniy Khramtsov xramtsov at gmail.com
Sat Sep 28 07:52:13 MSK 2013


On 28.09.2013 11:10, Randy Bush wrote:
> i made the mistake of running an open registration ejabberd for many
> years.  there seem to now be xmpp bots, and the server has literally
> thousands of bogus users and O(100) real ones.  if really bored, one can
> sit on the web interface and shoot them as they show up on the online
> users page.  they log in as fast as one can delete the account.
>
> i have shut down the open registration.  to clean up, i would ideally
> like a tool to first
>    export a list of all registered users
> and then i can sort it, as 99% of the bogus users have names that will
> sort out easily as they are generated.  and then
>    a hack to accept a list of names to delete
>

Hi, Randy :)

If you have a file:
$ cat /tmp/badusers
user1 at localhost
user2 at localhost
user3 at localhost
...

You can connect to ejabberd using remsh (`ejabberdctl debug`) and type 
the following:

lists:foreach(fun({U, S, _}) -> ejabberd_auth:remove_user(U, S) end, 
[jlib:jid_tolower(jlib:string_to_jid(S)) || S <- 
string:tokens(binary_to_list(element(2, 
file:read_file("/tmp/badusers"))), "\n")]).

-- 
Regards,
Evgeniy Khramtsov, ProcessOne.
xmpp:xram at jabber.ru.



More information about the ejabberd mailing list