Page 1 of 2

[Mod] No More Guests! [no_guests]

Posted: Sat Dec 14, 2013 01:36
by kaeza
Hello folks!

Due to a new feature in Minetest, players can be disconnected by mods even before they actually join the game. This has several advantages over the traditional ban on join followed shortly by unban:
  • The player file does not actually get created, thus avoiding cluttering up the world's `players' directory.
  • The join/leave callbacks do not actually get called, thus saving some processing and/or memory (and avoids spamming the chat with join/leave messages).
  • Does not modify the ban list in any way. "Kick user"-type mods usually implement the "kick" as a ban followed shortly by an unban, but this had the problem that if the server crashes between those actions, the player will be banned permanently until manually unbanned.
Now I present you the true and only No More Guests®©™ mod!

All this mod does is simply disconnect all "Guest" accounts (players named "Guest" followed by a number, a feature that some (most?) server owners find annoying.

In addition to this, and thanks to VanessaE for the ideas, it also disallows all-numeric names, names containing enther "guest" or "admin" (case insensitive), and names containing excessive numbers.

Also, thanks to sfan5 for letting me steal^Wborrow his code to detect "junk names". This mod does not allow players with gibberish names.

If you want to support this mod, send your money here.

License:
WTFPL

Dependencies:
None

Screenshots:
High resolution screenshot here.

Downloads:

Posted: Sat Dec 14, 2013 01:55
by Evergreen
Did you just Duckroll me?! /me slaps kaeza </kidding>
Anyway, great idea. It's good not to have all those random useless player files cluttering up the world directory.

Posted: Sat Dec 14, 2013 19:05
by addi
dose it work with a latest daily server and the client a 0.4.8 too?

Posted: Sat Dec 14, 2013 19:08
by kaeza
addi wrote:dose it work if the server is a latest dayli and the client a 0.4.8 too?
This mod requires a build not older than 2013-12-13, so yes, latest daily build should work.
Also, this only needs an updated server; clients continue to work as ever.

Posted: Sat Dec 14, 2013 19:15
by addi
very good :)

Posted: Sat Dec 14, 2013 22:55
by BrandonReese
I love it. Works perfectly.

Posted: Sun Dec 15, 2013 00:46
by Jordach
BrandonReese wrote:I love it. Works perfectly.
Vanessa will love this, I simply don't know if she already uses it on her production server yet. Will need to forward her this mod.

Posted: Sun Dec 15, 2013 00:49
by kaeza
Jordach wrote:Vanessa will love this, I simply don't know if she already uses it on her production server yet. Will need to forward her this mod.
She's already using it (actually, a modified version that also disallows all-numeric names). In fact, 7 out of the 8 servers connected to Inchra are using it (ShadowNinja didn't have time to install it yet).

Posted: Sun Dec 15, 2013 03:19
by BrunoMine
Great idea!

Posted: Sun Dec 15, 2013 04:15
by Sokomine
I'm a bit unhappy with the very name of the mod. It may sound to new players as if guests as such would not welcome - whereas it's only nameless/silly named guestnames that are undesired. Perhaps "no_silly_names" or something like that might sound friendlier :-)

Posted: Sun Dec 15, 2013 05:05
by kaeza
Sokomine wrote:I'm a bit unhappy with the very name of the mod. It may sound to new players as if guests as such would not welcome - whereas it's only nameless/silly named guestnames that are undesired. Perhaps "no_silly_names" or something like that might sound friendlier :-)
Well, the name is unimportant as the mod description explains exactly what it does.

Nobody is forced to install this on their server, but in my experience, most of these guests do not bother to choose an appropriate name, and they bother less about everyone's hard work.

I've seen some guests come back, and even become regular users of my server, so this is not a problem for legitimate players.

Posted: Sun Dec 15, 2013 09:05
by LazyJ
It's been my experience that server operators and admins are more likely to pay attention to the mod's name than the young and impatient players. ;)

For me, if the mod's name became an issue, I would change the name and leave a credit-line with the author's name, the mod's original name, and perhaps an url to the place to download it, commented-out in the code.

Along that same thought, server operators can change the mod's message to better suit their servers, perhaps even re-write the message in the server's locale language.

Thanks to kaeza and VanessaE for another good and quite useful mod. ;)

Posted: Mon Jan 20, 2014 13:04
by specopsbarton
Nice mod, it works very good for me - NO MORE GUESTS!

Posted: Thu Feb 27, 2014 03:53
by crazyginger72
I am releasing my fork of this mod now!!!

It not only filters "guest" names but i have added a through "profanity name" filter to the mod and renamed it to be more inviting :)

download here >>>> https://github.com/crazyginger72/blocked_usernames

Posted: Thu Feb 27, 2014 09:10
by Pitriss
["[c]+[r]+[4a]+[z]+[y]+[g]+[i1l]+[g]+[3e]+[r]+"] = "that is too close to the server owners name".. //line 51, you probably forgot [n]+

Posted: Thu Feb 27, 2014 16:35
by Krock
https://github.com/crazyginger72/blocked_usernames/blob/master/init.lua#L51 wrote:

Code: Select all

["[c]+[r]+[4a]+[z]+[y]+[g]+[i1l]+[g]+[3e]+[r]+"] = "that is too close to the server owners name"..
                               "pick a new name",
I would suggest:

Code: Select all

 ["cr[4a]zyg[i1l]ng[3e]r"] = "that is too close to the server owners name"..
                               "pick a new name",
Like the admin preg_match filter is.
EDIT: added missing 'n' :)

Posted: Thu Feb 27, 2014 19:44
by BrunoMine
The guests will be expelled?
it is possible to warn the prohibition?
Image

Posted: Thu Feb 27, 2014 20:09
by CraigyDavi
brunob.santos wrote:The guests will be expelled?
it is possible to warn the prohibition?
When a guest joins they will get a message telling them that guest accounts are not allowed on here:
Guest accounts are disallowed on this server. Please choose a proper username and try again.

Posted: Thu Feb 27, 2014 20:21
by Pitriss
Krock wrote:
https://github.com/crazyginger72/blocked_usernames/blob/master/init.lua#L51 wrote:

Code: Select all

["[c]+[r]+[4a]+[z]+[y]+[g]+[i1l]+[g]+[3e]+[r]+"] = "that is too close to the server owners name"..
                               "pick a new name",
I would suggest:

Code: Select all

 ["cr[4a]zyg[i1l]ng[3e]r"] = "that is too close to the server owners name"..
                               "pick a new name",
Like the admin preg_match filter is.
EDIT: added missing 'n' :)
Original solution matches also wit cccccraaaa4a4azzzzyginger AFAIK:)

Posted: Thu Feb 27, 2014 21:27
by crazyginger72
thanks i didnt see that typo guys :)
fixed and updated!

Re: [Mod] No More Guests! [no_guests]

Posted: Wed Dec 06, 2017 17:58
by rubenwardy
Version which doesn't stop already registered accounts, and also works with newer guest names:

Code: Select all

-- No guests mod.
-- By VanessaE, sfan5, and kaeza.

local disallowed = {
	["guest"]				=	"Guest accounts are disallowed on this server.  "..
								"Please choose a proper username and try again.",
	["[4a]dm[1il]n"]		=	"That is a clearly false, misleading, or otherwise disallowed username. "..
								"Please choose a unique username and try again.",
	["^[0-9]+$"]			=	"All-numeric usernames are disallowed on this server. "..
								"Please choose a proper username and try again.",
	["[0-9].-[0-9].-[0-9].-[0-9].-[0-9]"]	=	"Too many numbers in your username. "..
												"Please try again with less than five digits in your username.",
	["^[A-Za-z]+[0-9][0-9][0-9]+$"] = "Please choice your own username. Usernames with letters then 3 or more digits are not allowed"
}

-- Original implementation (in Python) by sfan5
local function judge(msg)
	local numspeakable = 0
	local numnotspeakable = 0
	local cn = 0
	local lastc = '____'
	for c in msg:gmatch(".") do
		c = c:lower()
		if c:find("[aeiou0-9_-]") then
			if cn > 2 and not c:find("[0-9]") then
				numnotspeakable = numnotspeakable + 1
			elseif not c:find("[0-9]") then
				numspeakable = numspeakable + 1
			end
			cn = 0
		else
			if (cn == 1) and (lastc == c) and (lastc ~= 's') then
				numnotspeakable = numnotspeakable + 1
				cn = 0
			end
			if cn > 2 then
				numnotspeakable = numnotspeakable + 1
				cn = 0
			end
			if lastc:find("[aeiou]") then
				numspeakable = numspeakable + 1
				cn = 0
			end
			if not ((lastc:find("[aipfom]") and c == "r") or (lastc == "c" and c == "h")) then
				cn = cn + 1
			end
		end
		lastc = c
	end
	if cn > 0 then
		numnotspeakable = numnotspeakable + 1
	end
	return (numspeakable >= numnotspeakable)
end

minetest.register_on_prejoinplayer(function(name, ip)
	if not minetest.player_exists(name) then
		local lname = name:lower()
		for re, reason in pairs(disallowed) do
			if lname:find(re) then
				return reason
			end
		end

		if #name < 2 then
			return "Too short of a username. "..
					"Please pick a name with at least two letters and try again."
		end

		if not judge(name) and #name > 5 then
			return "Your username just plain looks like gibberish. "..
					"Please pick something readable and try again."
		end
	end
end)

Re: [Mod] No More Guests! [no_guests]

Posted: Wed Feb 14, 2018 22:35
by scottwolff
I'm beginning to think that the hackers that try to get into my server don't like this mod either. I do. If I remember correctly, it bans names like 123456 or abcdefg?

Re: [Mod] No More Guests! [no_guests]

Posted: Wed Mar 21, 2018 01:30
by Festus1965
First Thank you for this solution !

I started to think about, basically because of this "Xxxxx999" gamer,

Code: Select all

["^[A-Za-z]+[0-9][0-9][0-9]+$"] = "Please choice your own username. Usernames with letters then 3 or more digits are not allowed"
as this ones are also most responsible for
Warnings at Server like
* moved to fast, or
* tried to interact without interact ...
So I got rid of them most.

Now much less work to xban the less users getting in, "pressing" this Warnings sometimes some pages long. My poor Server ..., the rest I can still xban myself, but thinking also about a solution for those who try to cheat - and filling the server actions too fast.

Re: [Mod] No More Guests! [no_guests]

Posted: Tue Jul 17, 2018 19:40
by Festus1965
so after the new ? App "3D Exploration" is flooding my server with Name12 Logins here again questions, as that coding I never got:

edited:
I think I got it:

Code: Select all

["^[A-Za-z]+[0-9][0-9][0-9]+$"]
seamd only to block Name123, but not Name123abc
so I also added

Code: Select all

["^[A-Za-z]+[0-9][0-9][0-9]+$[A-Za-z]"]
and now I see Name123abc is also blocked, as a lot of them just added some letters
= most of I think Multicraft-Users are gone, and a lot of useless traffic saved

so I also added the shelter to 2 diggit users, as I think that are the "3D Exploration" or so names Gamers

Code: Select all

["^[A-Za-z]+[0-9][0-9]+$"]
["^[A-Za-z]+[0-9][0-9]+$[A-Za-z]"]
now still some only Capital letter names pass throught (I dont like that screaming view)... working on it ...

Code: Select all

["^[A-Z]+$[A-Z]"]
maybe ,,, testing



How to implementate exeptions:
* names with 2 digit end are stopped, but 2 of them I want to let pass

also the exeptions could work, as a Friend gave me a solution enlage the onjoin ..., later about it.

Re:

Posted: Wed Jul 18, 2018 14:23
by davidthecreator
CraigyDavi wrote: When a guest joins they will get a message telling them that guest accounts are not allowed on here:
Guest accounts are disallowed on this server. Please choose a proper username and try again.

Oof !