problem with Signs in my script - Page 2
 

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

problem with Signs in my script

Started by blackwings, 19 February, 2005, 12:01:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

#25
ok, I changed the double declaration of the value for the MSigns array to only one now.

could you explain this a little bit more =
if(strsub(data, 1, 4) == "$To:") then -- so this check is done several times until adving is really found
How do you get/handle the values in a array like this =
dnsarray={{no,ip,com},{myftp,org},{kicks,ass,org}}
About the comments in the code why there isn't a "end"(with other words, why the "for" isn't seperated) like this =
function DataArrival(user,data)
	for d=1,getn(MSigns) do
		tPartSigns = (strlower(MSigns[d]))
	end
	for e=1,getn(DNS01) do
		tPart01 = (strlower(DNS01[e]))
	end		
	for f=1,getn(DNS02) do
		tPart02 = (strlower(DNS02[f]))
	end
		advDetect = tPartSigns..tPart01..tPartSigns..tPart02
			if( strfind(data, advDetect,1,1))  then
				return adverSmashing(user)
			end
			if(strsub(data, 1, 4) == "$To:") then
				if( strfind(data, advDetect,1,1) ) then
					return adverSmashing(user)
				end
			end
			collectgarbage()
end
Well, it's because it doesn't work, the "array checks"  must be inside of each other. Why? I don't  know, but thats how it is =
function DataArrival(user,data)
	for d=1,getn(MSigns) do
			tPartSigns = (strlower(MSigns[d]))
		for e=1,getn(DNS01) do
				tPart01 = (strlower(DNS01[e]))
			for f=1,getn(DNS02) do
				tPart02 = (strlower(DNS02[f]))
				advDetect = tPartSigns..tPart01..tPartSigns..tPart02
					if( strfind(data, advDetect,1,1))  then
						return adverSmashing(user)
					end
					if(strsub(data, 1, 4) == "$To:") then
						if( strfind(data, advDetect,1,1) ) then
							return adverSmashing(user)
						end
					end
			end
		end				
	end
	collectgarbage()
end


bastya_elvtars

Now that the wiki is alive, please visit the following site in order to read plop's tutorial:

http://ptokaxwiki.no-ip.com/wikka.php?wakka=LuaOnTables
Everything could have been anything else and it would have just as much meaning.

blackwings

QuoteOriginally posted by bastya_elvtars
Now that the wiki is alive, please visit the following site in order to read plop's tutorial:

http://ptokaxwiki.no-ip.com/wikka.php?wakka=LuaOnTables
Maybe I'm blind, but I couldn't see any example on how to use this kind of array =
dnsarray={{no,ip,com},{myftp,org},{kicks,ass,org}}


bastya_elvtars

If
dnsarray={{no,ip,com},{myftp,org},{kicks,ass,org}}
then you can recall "ass" by:

dnsarray[3][2]
Everything could have been anything else and it would have just as much meaning.

blackwings

#29
QuoteOriginally posted by bastya_elvtars
If
dnsarray={{no,ip,com},{myftp,org},{kicks,ass,org}}
then you can recall "ass" by:
dnsarray[3][2]
hmm, ok, but is that really hashing? (both you and Opti said hashing was better and faster).
First when you gave a suggestion about that array, I thought you meant this =
DNSarray={{no,ip,com},{myftp,org},{kicks,ass,org}}
MSigns={".","-","?","+"}

tDNSarray={}
tMSigns={}

function Main() 
	for c=1,getn(DNSarray) do
		tDNSarray[DNSarray[c]]=1
	end
	for d=1,getn(MSigns) do
			tMSigns[MSigns[d]]=1
	end
end

function DataArrival(user,data)
	for h=1,getn(MSigns) do
		vPartSigns = (strlower(MSigns[h]))
		for i=1,getn(tDNSarray) do
			tDNSarray[i][1] = gsub(tDNSarray[i][1], "<" , "")
				vPart01 = tDNSarray[i][1]
				vPart02 = tDNSarray[i][2]
				advDetect = vPartSigns..vPart01..vPartSigns..vPart02
			if( strfind(data, advDetect,1,1))  then
				return adverSmashing(user)
			end
			if(strsub(data, 1, 4) == "$To:") and (strfind(data, advDetect,1,1)) then
				return adverSmashing(user)
			end
		end
		collectgarbage()
	end
end
But I guess I was totally wrong there :P


bastya_elvtars

Now I am confused too. :D I will find a solution but i need some rest 1st.
Everything could have been anything else and it would have just as much meaning.

Optimus

tGood = {
   ["dcgui.berlios.de"] ="DCGUI"
}
tBad = {
   ["revconnect.sf.net"] ="get out"
}


tTags = {
   [1] = "$MyINFO $ALL [OP]test [URL]http://dcgui.berlios.de[/URL]",
   [2] = "$MyINFO $ALL [OP]test [URL]http://revconnect.sf.net[/URL]",
   [3] = "$MyINFO $ALL [OP]test [URL]http://site.com.here[/URL]"
}

for a,nMyInfo in tTags do
   s,e,url = strfind(nMyInfo, "([^%.%/]+%.[^%.]+%.%S+)") 
   if url then
      print(url)
      if tGood[url] then
         print(tGood[url])
      elseif tBad[url] then
         print(tBad[url])
      else
         print("no advertising")
      end
   end
end

Here you have a simple demostration how hashing worksss

EDIT: the loop is only there to demostrate how things work. That part can be deleted eventualy

Gr. Optimus

blackwings

#32
QuoteOriginally posted by Optimus
Here you have a simple demostration how hashing worksss

EDIT: the loop is only there to demostrate how things work. That part can be deleted eventualy

Gr. Optimus
hmm, pretty confusing example. Seem to be example from a lua, so it's not 100% ptokax adapted.
Plus the method you show there isn't dynamic(atleast that is what it looks like for me :P ), which mean it isn't fitted
to be used in a anti-advertise script.


SMF spam blocked by CleanTalk