Antispam
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Antispam

Started by Thor, 16 April, 2006, 18:52:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thor

This script see the main and the private chat also after an user connected for - now - 15 sec, and if it find in the message links (http,www, dchub) then - optionally - it kick the user, and send a report to the OP-s. It can effective against spammers and advertisers - in Hungary there are many bot, which connect to all hubs of a hublist, and just send a link to the main after connection, and go away... It has a little "bug": on many simultaneusly connection it doesn't work...
--|-----------------------------------------
--|
--| Antispammer and advertiser script
--|
--| The newly connected unregistered users 
--| 
--| can't write url-s nor the mainchat,
--|
--| nor the pivate chat for the setted time
--|
--| written by Hungarista 2006.04.14
--|
--| thanks the help of Bastya_elvtars
--|
--| and as always to Szmeby
--|
--|-----------------------------------------

tBadWords={
[1] = "http",
[2] = "www",
[3] = "dchub",
--[4] = "anything", and so on...
}

function NewUserConnected(curUser)
newuser = curUser.sName
SetTimer(15000)
StartTimer()
end

kick = true

ChatArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if GetTimer() == 1 then
			if curUser.sName == newuser then 
				for i,v in tBadWords do
				_,_,msg = string.find(data,"%b<>%s(.*)")
				msg = string.lower(msg)
				msg = string.gsub(msg,"[^a-z0-9]", "")
					if string.find(msg,v) then
					timer = GetTimerInterval()/1000
						if not kick then
						curUser:SendData(frmHub:GetHubBotName(),"Please... Don't advertise and don't spam ;) Thanks. You can't write links to the mainchat for "..timer.." second after connecting, please wait if it is important.")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in the main: ["..(os.date("%H:%M:%S")).."] "..string.sub(data,1,-2).."")
						elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in the main: "..string.sub(data,1,-2).."")
						SendToAll(frmHub:GetHubBotName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
						end
					return 1
					end
				end
			end
		end
	elseif curUser.bOperator then
		_,_,comd,arg = string.find(data,"%b<>%s(%S+)%s(%S+)|")
		if comd == "!skick" then
			if arg == "on" then
				if kick == true then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Enabled")
				else
				kick = true
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Enabled")
				end
			elseif arg == "off" then 
				if kick == false then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Disabled")
				else
				kick = false
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Disabled")
				end
			end
		return 1
		end
	end
end
ToArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if GetTimer() == 1 then
			if curUser.sName == newuser then
			_,_, tomsg = string.find(data, "^%$To:%s%S+%sFrom:%s%S+%s%$%b<>%s(.*)")
			_,_, nickto, nickfrom, msg = string.find(data, "^%$To:%s(%S+)%sFrom:%s(%S+)%s%$%b<>%s(.+)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
				for i,v in tBadWords do
					if string.find(msg,v) then
					timer = GetTimerInterval()/1000
					curUser:SendPM(nickto,"I didn't get this message... You can't write links to the private chat for "..timer.." second after connecting, please wait if it is important.")
						if not kick then
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in private chat: "..tomsg.."")
						elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in private chat: "..tomsg.."")
						SendToAll(frmHub:GetHubBotName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
						end
					return 1
					end
				end
			end
		end
	end
end

function OnTimer()
StopTimer()
end

The value of kick can be modified from the script also with command !skick on or off. If reload the script, the value will be true. If kick disabled, it will just report the messages.

//EDIT
Little typing-mistake has been corrected

-SkA-

Hello, can you convert it in lua 5.1?
???:::??x??em?-N????:::??? ?wN??

BrianzaLand Blog" style="border:0

Thor

I did it (it was just a word and two bracket :D ) See here: http://forum.ptokax.org/index.php?topic=5957.0 But u have big hub if i think well, so maybe it won't work... :-\

-SkA-

 :(

Hmmm.... why not?
???:::??x??em?-N????:::??? ?wN??

BrianzaLand Blog" style="border:0

Thor

Because on many same-time connection on NewUserConnected the value of newuser will not be the curUser.sName... Maybe i have to modify it: store new connected users in a table... But it use more CPU ::)

-SkA-

Ok, I'll wait for news ;) because with lucifer 6.6.6 I don't know why but anti-adv in mainchat doesn't works -.-
???:::??x??em?-N????:::??? ?wN??

BrianzaLand Blog" style="border:0

Thor

#6
So, here is it:
--|-----------------------------------------
--|
--| Antispammer and advertiser script
--|
--| The newly connected unregistered users 
--| 
--| can't write url-s nor the mainchat,
--|
--| nor the pivate chat for the setted time
--|
--| written by Szmeby and Hungarista 2006.04.17
--|
--|-----------------------------------------

tBadWords={
[1] = "http",
[2] = "www",
[3] = "dchub",
--[4] = "anything", and so on...
}
kick = false

idotartam = 15

botname = frmHub:GetHubBotName()
opchat = frmHub:GetOpChatName()
users = {}

function Main()
SetTimer(1000)
StartTimer()
end

function NewUserConnected(curUser)
	if not curUser.bRegistered then
	users[curUser.sName]=os.time()
	end
end

function OnTimer()
	for k,v in pairs(users) do
		if os.difftime(os.time(), v) > idotartam then users[k] = nil end
	end
end

kick = true

ChatArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if users[curUser.sName] then
			for i,v in pairs(tBadWords) do
			_,_,msg = string.find(data,"%b<>%s(.*)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
				if string.find(msg,v) then
				timer = GetTimerInterval()/1000
					if not kick then
					curUser:SendData(frmHub:GetHubBotName(),"Please... Don't advertise and don't spam ;) Thanks. You can't write links to the mainchat for "..timer.." second after connecting, please wait if it is important.")
					SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in the main: ["..(os.date("%H:%M:%S")).."] "..string.sub(data,1,-2).."")
					elseif kick then
					curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
					curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
					SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in the main: "..string.sub(data,1,-2).."")
					SendToAll(frmHub:GetHubBotName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
					end
				return 1
				end
			end
		end
	elseif curUser.bOperator then
		_,_,comd,arg = string.find(data,"%b<>%s(%S+)%s(%S+)|")
		if comd == "!skick" then
			if arg == "on" then
				if kick == true then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Enabled")
				else
				kick = true
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Enabled")
				end
			elseif arg == "off" then 
				if kick == false then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Disabled")
				else
				kick = false
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Disabled")
				end
			end
		return 1
		end
	end
end
ToArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if users[curUser.sName] then
			_,_, tomsg = string.find(data, "^%$To:%s%S+%sFrom:%s%S+%s%$%b<>%s(.*)")
			_,_, nickto, nickfrom, msg = string.find(data, "^%$To:%s(%S+)%sFrom:%s(%S+)%s%$%b<>%s(.+)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
			for i,v in pairs(tBadWords) do
				if string.find(msg,v) then
					timer = GetTimerInterval()/1000
					curUser:SendPM(nickto,"I didn't get this message... You can't write links to the private chat for "..timer.." second after connecting, please wait if it is important.")
					if not kick then
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in private chat: "..tomsg.."")
					elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in private chat: "..tomsg.."")
						SendToAll(frmHub:GetOpChatName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
					end
					return 1
				end
			end
		end
	end
end

It works with LUA 5.0 and with LUA 5.1 also. This is the best way to use, but it use more CPU, -Ska- please try it, and say me how it works, thanks ;) It's not an antiadver script, it see bad link just for 15 sec!

rachel

sorry to dig this topic up again, but i was wondering if you could put the option in this script can be made to kick profile 3 aswell  ;D

Herodes

Welcome rachel,..

Please post what you are looking for since there are many many antiadvert scripts on the forum.
There may be something that fulfills your needs already.
Try searching for starters. (Inside Finished scripts or Request for scripts sections)

Thor

--|-----------------------------------------
--|
--| Antispammer and advertiser script
--|
--| The newly connected unregistered users 
--| 
--| can't write url-s nor the mainchat,
--|
--| nor the pivate chat for the setted time
--|
--| written by Szmeby and Hungarista 2006.04.17
--|
--|-----------------------------------------

tCheckedUsers={
[-1] = 1, -- Unregistered users
[0] = 0, -- Master users
[1] = 0, -- Operator users
[2] = 0, -- VIP users 
[3] = 1, -- Registered users
[4] = 0, -- Moderator users
[5] = 0, -- NetFounder users
}

tBadWords={
[1] = "http",
[2] = "www",
[3] = "dchub",
--[4] = "anything", and so on...
}
kick = false

idotartam = 15

botname = frmHub:GetHubBotName()
opchat = frmHub:GetOpChatName()
users = {}

function Main()
SetTimer(1000)
StartTimer()
end

function NewUserConnected(curUser)
	if tCheckedUsers[curUser.iProfile] == 1 then
		users[curUser.sName]=os.time()
	end
end

function OnTimer()
	for k,v in pairs(users) do
		if os.difftime(os.time(), v) > idotartam then users[k] = nil end
	end
end

kick = true

ChatArrival = function(curUser,data)
		if users[curUser.sName] then
			for i,v in pairs(tBadWords) do
			_,_,msg = string.find(data,"%b<>%s(.*)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
				if string.find(msg,v) then
				timer = GetTimerInterval()/1000
					if not kick then
					curUser:SendData(frmHub:GetHubBotName(),"Please... Don't advertise and don't spam ;) Thanks. You can't write links to the mainchat for "..timer.." second after connecting, please wait if it is important.")
					SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in the main: ["..(os.date("%H:%M:%S")).."] "..string.sub(data,1,-2).."")
					elseif kick then
					curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
					curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
					SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in the main: "..string.sub(data,1,-2).."")
					SendToAll(frmHub:GetHubBotName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
					end
				return 1
				end
			end
		end
	elseif curUser.bOperator then
		_,_,comd,arg = string.find(data,"%b<>%s(%S+)%s(%S+)|")
		if comd == "!skick" then
			if arg == "on" then
				if kick == true then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Enabled")
				else
				kick = true
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Enabled")
				end
			elseif arg == "off" then 
				if kick == false then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Disabled")
				else
				kick = false
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Disabled")
				end
			end
		return 1
		end
	end
end
ToArrival = function(curUser,data)
		if users[curUser.sName] then
			_,_, tomsg = string.find(data, "^%$To:%s%S+%sFrom:%s%S+%s%$%b<>%s(.*)")
			_,_, nickto, nickfrom, msg = string.find(data, "^%$To:%s(%S+)%sFrom:%s(%S+)%s%$%b<>%s(.+)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
			for i,v in pairs(tBadWords) do
				if string.find(msg,v) then
					timer = GetTimerInterval()/1000
					curUser:SendPM(nickto,"I didn't get this message... You can't write links to the private chat for "..timer.." second after connecting, please wait if it is important.")
					if not kick then
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in private chat: "..tomsg.."")
					elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in private chat: "..tomsg.."")
						SendToAll(frmHub:GetOpChatName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
					end
					return 1
				end
			end
		end
	end
end

I don't understand. This script not a forbidden script, it is against spammers, and spammers never registered I think, but you know.

rachel

Thankyou very much for your time Hungarista, i had to change a little something but is all working ok now   :)

SMF spam blocked by CleanTalk