detect only if msg is exactlly...
 

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

detect only if msg is exactlly...

Started by blackwings, 11 March, 2005, 05:52:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

Well, I'm experimeting a bit and trying to improve my anti advertise script. The problem I have is that the script only detect and take action of the message is exactlly the same as in the "CrushAdver = {}", which is bad, anyone know how to fix that???
--Advertise Crusher by blackwings
--v2.0
--functions: 
--	anti-advertise - detect and tempban 
--	safe advertise - so you can type the hubs own adress
--	Counter	       - aka adverKill, in default it bans after 3 tempbans
--	Many Signs     - can detect advertisment that use different signs then "."
--      Tempban left   - how many tempbans a user has before permban
-----------
------------------------------------------------------------------------
--++++++++++++++++++++++ START OF CONFIGURATION ++++++++++++++++++++++--
------------------------------------------------------------------------
Bot = "#Anti-Advertise"

-- (1)Shall be tempbanned/banned / (0) this profile shouldn't be effected.

-- How many times a user gets tempbanned before getting a permban
adverKill = 3
-- If the "kill" messages should be shown to everyone in main chat
ShowAllinMain = 1

--Put the first part of you safe advertise adress here
nosafeAdver={
"safe1.no-ip.com","safe2.no-ip.com","safe3.no-ip.com","http://www.no-ip.com",
}

DNS01={
"no-ip","mine","sytes","dynip","dyndns","gotdns","kicks-ass","d2g","serveftp",
"servehttp","servehalflife","servequake","servecounterstrike","xs4all","myftp",
"servebeer","zapto","tropico","lysekil","udgnet","dnsalias","dynalias","ath","homeip",
"servemp3","hopto","servegame","staticip","orgdns","myftpsite","ipactive","idlegames",
"homeunix","homelinux","flamenap","dns2go","clanpimp","bounceme","ip","uni","is-a-geek","isa-geek"
}

MSigns={".","_","-","+","?","&","*","=","!","#","|","?","?","?","?","@","$","%","^"}
DNS02={"com","net","org","nu","se","cx","us","it","co.uk","info","biz","cc","de","tv","nl","dk","lv"}
------------------------------------------------------------------------
--+++++++++++++++++++++++ END OF CONFIGURATION +++++++++++++++++++++++--
------------------------------------------------------------------------

adverCounter = 0
CrushAdver = {}

function Main() 
	for key8, value8 in MSigns do
		tSigns = strlower(value8)
		for key4, value4 in DNS01 do
			tPart01 = strlower(value4)
			for key5, value5 in DNS02 do
				tPart02 = strlower(value5)
				--
				advDetect = tSigns..tPart01..tSigns..tPart02
				--
				CrushAdver[advDetect]=1
			end
		end
	end
end

function adverSmashing(user)
	if not user.bOperator then
		adverCounter = adverCounter + 1
		tmpBanLeft = adverKill - adverCounter
		if adverCounter < adverKill then
			user:SendData(Bot, "You are tempbanned because of advertiseing.")
			user:SendData(Bot, "Number of tempban before permban = "..tmpBanLeft)
			user:TempBan()
			SendToOps(Bot, "User <"..user.sName.."> was tempbanned for advertising, wrote = "..advDetect)
				if ShowAllinMain == 1 then
					SendToAll(Bot, "User <"..user.sName.."> was tempbanned for advertising")
				end
		elseif adverCounter == adverKill then
			user:SendData(Bot, "You are PERMBANNED because of advertiseing")
			user:Ban()
			SendToOps(Bot, "User <"..user.sName.."> was PERMBANNED for advertising, wrote = "..advDetect)
				if ShowAllinMain == 1 then
					SendToAll(Bot, "User <"..user.sName.."> was PERMBANNED for advertising")
				end
			adverCounter = 0
		end
	end
	collectgarbage()
end

function DataArrival(user,data)
local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
	if CrushAdver[msg]==1 then
		return adverSmashing(user)
	end
end


SMF spam blocked by CleanTalk