antispam with ipgag
 

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 with ipgag

Started by lynyrd, 01 March, 2004, 21:53:56

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lynyrd

hi,
i think this is a nice script so i post it here
but who did this good script?

code:
_____________________________________________
--made by ?
MaxPM = 2 -- more than 2 pms within 0,8 seconds cause a gag
MaxMain = 2 -- more than 2 mainchat msgs within 0,8 seconds cause a gag
timeslice = 1*800 -- 0,8 seconds

gagged = {}
MainCount = {}
PMCount = {}
yournick = "your nick here!!"
botname = "antispam"

function FloodDetected (user,data)


local name,ip = user.sName,user.sIP
tinsert(gagged, ip)
tinsert(gagged, name)
SendToAll("Hub-Security", "*** "..botname.." has IP-gagged: "..name)

end

function Main()
SetTimer(timeslice)
StartTimer()
end

function OnTimer()
PMCount = {}
MainCount = {}
end

function DataArrival(user, data)
if strfind(data, "!") and user.sName == yournick then
else
for i,v in gagged do
   if user.sIP == gagged then
return 1
end
end
end
if data == nil then data = 0 end
if strfind(data, "!") and user.sName == yournick then
else
for i,v in gagged do
   if user.sName == gagged then
return 1
end
end
end

if strfind(data,"$To:") then
if PMCount[user.sIP] ~= nil then
PMCount[user.sIP] = PMCount[user.sIP] +1
if PMCount[user.sIP] > MaxPM then
FloodDetected (user, data)
PMCount[user.sIP] = -100
return 1
end
else
PMCount[user.sIP] = 1
end
elseif strfind(data,user.sName,1,plain) == 2 then
if MainCount[user.sIP] ~= nil then
MainCount[user.sIP] = MainCount[user.sIP] +1
if MainCount[user.sIP] > MaxMain then
FloodDetected (user, data)
MainCount[user.sIP] = -100
return 1
end
else
MainCount[user.sIP] = 1
end
end
end
_____________________________________________

NightLitch

I can tell you.. DirtyFinger made it....

real name of the bot and hole script:

--=====================================
--            SpamBan
---------------------------------------
-- version: 1.2 (06.2.2003)
--  author: DirtyFinger
--   email: [EMAIL]DirtyFinger@gmx.net[/EMAIL]
--    ICQ : 145873101
--  HomePage: [URL]http://mitglied.lycos.de/dirtyfinger01/[/URL]
--   (Yes, i know i still suck as Web Designer)
--=====================================
--	This script automatically bans pm-spammers and mainchat-spammers.
--
--	This does not protect from spam, but at least the spammer can't come back (at least not with the same ip)
--	For the script to work you might have to change the PtokaX flood-protection values (chat limit in the 'Rules and bots' section)
--	The script bans by default after 30 pms are being sent within 10 seconds.
--   But if the hub disconnects BEFORE the script triggers, no banning is possible and the spammer can come back.
--	So choose some quite generous settings, e.g. the first line of the above spam contains about 400 characters.
--	For the script to trigger you have to allow the users to send 8000 characters per second so the script can trigger.
--
--	Don't worry, real flooders send much much more so you'll be fine.
--
--   Version Changes :
--		1.2  : bans mainchat flooder too. I didn't implement it in previous versions because i thought ptokax dealt with it.
--		1.1  : removed the mainchat flooding of ban notifications
--		1.0  : first version

sBotName = "Spamban"

PMCount = {}
MainCount = {}
MaxPM = 20 -- more than 20 pms within 10 seconds cause a ban
MaxMain = 20 -- more than 20 mainchat msgs within 10 seconds cause a ban
timeslice = 10*1000 -- 10 seconds


function Main()
	frmHub:RegBot(sBotName)
	SendToAll(sBotName.." "..date(" launched at %B %d %Y %X "))
	SetTimer(timeslice)
	StartTimer()
	
end

--// This function is fired when a new data arrives
function DataArrival(curUser, sData) 
	if strfind(sData,"$To:") then		
		if PMCount[curUser.sIP] ~= nil then
			PMCount[curUser.sIP] = PMCount[curUser.sIP] +1
			--SendToAll("----",PMCount[curUser.sIP])
			if PMCount[curUser.sIP] > MaxPM then
				FloodDetected (curUser, sData)
				PMCount[curUser.sIP] = -100
			end
		else
			PMCount[curUser.sIP] = 1
		end
	elseif strfind(sData,curUser.sName,1,plain) == 2 then 
		if MainCount[curUser.sIP] ~= nil then
			MainCount[curUser.sIP] = MainCount[curUser.sIP] +1
			--SendToAll("----",PMCount[curUser.sIP])
			if MainCount[curUser.sIP] > MaxMain then
				FloodDetected (curUser, sData)
				MainCount[curUser.sIP] = -100
			end
		else
			MainCount[curUser.sIP] = 1
		end
	end

end

function OnTimer()
	--for k,v in PMCount do
	--	SendToAll("---------",k.."\t"..v)
	--end
	PMCount = {}	
	MainCount = {}
end

function FloodDetected (curUser,sData)
	local message = "     -= Spam Warning =-" 
	local name,ip = curUser.sName,curUser.sIP
	SendToAll ("# "..sBotName.."-Alert #--> "..name .. " has been banned for spamming.")
	message = message .."\r\n\t\t"
		.. "Violation detected by: " .. name .."\r\n\t\t"
		.. "IP: " .. ip .. "\t\r\n\t\t"
		.. "Last packet : \t" .. sData
	
	SendPmToOps (sBotName,message)
	curUser:Ban()
	curUser:Disconnect()
end

/NL
//NL

lynyrd

thanks a lot NL=)
and to dirtyfinger for a good script..but he probably already knows ;)

SMF spam blocked by CleanTalk