Advertise Crusher 1.0 (LUA 5)
 

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

Advertise Crusher 1.0 (LUA 5)

Started by blackwings, 28 February, 2005, 04:12:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

Converted my anti-advertise bot to LUA 5. Enjoy this until the elite programmers comes with their scripts :)
Please report any bugs that you may find :)
--Advertise Crusher by blackwings
--v1.0 LUA 5
--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
-----------
--changed: Converted the script to LUA 5.
-----------
------------------------------------------------------------------------
--++++++++++++++++++++++ START OF CONFIGURATION ++++++++++++++++++++++--
------------------------------------------------------------------------
Bot = "#anti-advetise"

-- 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","safe2","safe3","safe4",
}

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"}
------------------------------------------------------------------------
--+++++++++++++++++++++++ END OF CONFIGURATION +++++++++++++++++++++++--
------------------------------------------------------------------------

adverCounter = 0

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()
			SendPmToOps(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()
			SendPmToOps(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
end


function ChatArrival(user,data)
	for d=1,table.getn(MSigns) do
			tSigns = (string.lower(MSigns[d]))
		for e=1,table.getn(DNS01) do
				tPart01 = (string.lower(DNS01[e]))
			for f=1,table.getn(DNS02) do
					tPart02 = (string.lower(DNS02[f]))
				for g=1,table.getn(nosafeAdver) do
					safe01 = (string.lower(nosafeAdver[g]))
					--
					advDetect = tSigns..tPart01..tSigns..tPart02
					safeAdv = safe01..advDetect
					--
					if(string.find(data, advDetect,1,1))  then
						if(string.find(data, safeAdv,1,1))  then
							return nil
						end
						return adverSmashing(user)
					end
					if(string.sub(data, 1, 4) == "$To:") then
						if(string.find(data, advDetect,1,1) ) then
							if(string.find(data, safeAdv,1,1))  then
								return nil
							end
							return adverSmashing(user)
						end
					end
				end
			end
		end				
	end
end


??????Hawk??????

hi m8  


$To:   Has its own arrival    ;)

blackwings

#2
EDIT: Updated the script above with Opti's suggestion


Optimus

ToArrival = ChatArrival maybe that works also. less code

bastya_elvtars

I still don't get why ther are loops inside loops. Gonna look.
Everything could have been anything else and it would have just as much meaning.

plop

complex story comming up.
move all code from chat/to arrivals 2 a standalone function.
when it finds something bad you should return 1.
by sending data 2 this function and checking for the return 1 you can minimize chat/to arrival 2 the bare minimum.
also don't forget 2 strip the data on to arrival a bit so it matches chat arrival.
for more hints, check my/bast's wordreplacer.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

bastya_elvtars

have I coded a wordreplacer? you keep surprising me! :D
Everything could have been anything else and it would have just as much meaning.

blackwings

#7
QuoteOriginally posted by plop
complex story comming up.
move all code from chat/to arrivals 2 a standalone function.
when it finds something bad you should return 1.
by sending data 2 this function and checking for the return 1 you can minimize chat/to arrival 2 the bare minimum.
also don't forget 2 strip the data on to arrival a bit so it matches chat arrival.
for more hints, check my/bast's wordreplacer.

plop
ok, I will try, not sure if I will succed :P

(edited the script in my first post with opti's suggestion)


SMF spam blocked by CleanTalk