Help set in 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

Help set in LUA 5

Started by ?(???[AD]???)?Angel, 15 March, 2005, 08:54:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

?(???[AD]???)?Angel

Kann das mal bitte einer in LUA % umwandeln?

--// a peerguardian script ..
--// by Typhoon?/Ratcom_Typhoon?
--// 09-05-2004
--// idea and code from NXS-4 by NightLitch

---- setup

GuardianCheck = 1
notifyOps = 1

---- setup end

BotName = "GetHubBotName"

GuardianFile = "peerfolder/guarding.p2p"

Guard = {}

function Main()
       LoadTable(Guard,GuardianFile)  
end


function NewUserConnected(curUser)
   if GuardianCheck==1 then
      local check,comp = BlockGuard(curUser.sIP)
      if notifyOps==1 then
         curUser:Disconnect(BotName, "You are beeing disconnected!")
         SendPmToOps(BotName,"User "..curUser.sName.." - ( "..curUser.sIP.." ) from Company ( "..comp.." ) tried to login and was disconnected by "..BotName.."!")
         curUser:Ban()
      end
   end
end



function BlockGuard(ip)
   local _,_,a,b,c,d = strfind(ip, "(%d*).(%d*).(%d*).(%d*)")
   if ( tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d) ) then
      local uip = ComputeIP(ip)
      if uip then
         for range,comp in Guard do
            local _,_,r1,r2 = strfind(range, "(.*)-(.*)")
            r1 = ComputeIP(r1)
            r2 = ComputeIP(r2)
            if uip>=r1 and uip<=r2 then
               return 1,comp
            end
         end
      end
   end
end

function ComputeIP(curIP)
   local _,_,a,b,c,d = strfind(curIP, "(%d+).(%d+).(%d+).(%d+)")
   return a*16777216 + b*65536 + c*256 + d
end

function LoadTable(table,file)
   local handle = openfile(file, "r")
   if (handle) then
          local line = read(handle)
          while line do
         s,e,ind,val = strfind( line, "(.*):(.*)")
         table[val]=ind
         line = read(handle)
          end
        closefile(handle)
   end
end

NightLitch

#1
--// a peerguardian script ..
--// by Typhoon?/Ratcom_Typhoon?
--// 09-05-2004
--// idea and code from NXS-4 by NightLitch
--// Rewritten to Lua 5 by NightLitch 2005-03-15

---- setup

BotName = "GetHubBotName"
GuardianFile = "peerfolder/guarding.p2p"

GuardianCheck = 1
notifyOps = 1

---- setup end

Guard = {}

function Main()
	LoadTable(Guard,GuardianFile)
end

function NewUserConnected(curUser)
	if GuardianCheck==1 then
		local check,comp = BlockGuard(curUser.sIP)
		if check == 1 then
			curUser:Disconnect(BotName, "You are beeing disconnected!")
			curUser:Ban()
			if notifyOps==1 then
				SendPmToOps(BotName,"User "..curUser.sName.." - ( "..curUser.sIP.." ) from Company ( "..comp.." ) tried to login and was disconnected by "..BotName.."!")
			end
		end
	end
end







function BlockGuard(ip)
	local _,_,a,b,c,d = string.find(ip, "(%d*).(%d*).(%d*).(%d*)")
	if ( tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d) ) then
		local uip = ComputeIP(ip)
		if uip then
			for range,comp in Guard do
				local _,_,r1,r2 = string.find(range, "(.*)-(.*)")
				r1 = ComputeIP(r1)
				r2 = ComputeIP(r2)
				if uip>=r1 and uip<=r2 then
					return 1,comp
				end
			end
		end
	end
	return 0,""
end



function ComputeIP(curIP)
	local _,_,a,b,c,d = string.find(curIP, "(%d+).(%d+).(%d+).(%d+)")
	return a*16777216 + b*65536 + c*256 + d
end

function LoadTable(table,file)
	local handle = io.open(file, "r")
	if (handle) then
		for line in handle:lines() do
			local s,e,ind,val = string.find(line, "(.*):(.*)")
			table[val] = ind
		end
		handle:close()
	end
end

** CODE UPDATED **

Cheers / NightLitch
//NL

?(???[AD]???)?Angel

PeerGuardian.lua

syntax error ?=?

for yu  new lua5

?(???[AD]???)?Angel

heheheheheh

code:--------------------------------------------------------------------------------



ich bin zu doof.

juhu

tanks

werry good

SMF spam blocked by CleanTalk