Help with Guarding script
 

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 with Guarding script

Started by zinden, 21 November, 2004, 18:53:28

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zinden


--------------------------------------------------------------------
BotName = frmHub:GetHubBotName()
----------------------------------------------------------------------------------------------
GuardianFile = "Guard/Guarding.P2P"
Guard = {}
Guardian = 1
----------------------------------------------------------------------------------------------
--//Code
----------------------------------------------------------------------------------------------
function Main()
LoadGuard(Guard,GuardianFile)
frmHub:RegBot(BotName)
end
----------------------------------------------------------------------------------------------
function NewUserConnected(User)
if GuardianCheck==1 then
local check,comp = BlockGuard(User.sIP)
if check==1 then
SendPmToOps(nBotName,"*** "..User.sName.." - ( "..User.sIP.." ) from Company ( "..comp.." ) tried to login! ***")
check = 0
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 LoadGuard(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



About that script, im added a Guard/Guarding.p2p
in that folder, but getting this error:

Syntax error: table index is nil
stack traceback:
   1:  function `LoadGuard' at line 53 [file `H:\FPS Ptokax\scripts\guard.lua']
   2:  function `Main' at line 11 [file `H:\FPS Ptokax\scripts\guard.lua']


Anyone knows how to solve that problem?
Xion++ - Where it all begins
http://www.zinden.net

bastya_elvtars

Well, m8, use peerguardian lite or blockpost for outpost, don't use this script for antip2p, it just blocks ppl connecting 2 ur hub.
Everything could have been anything else and it would have just as much meaning.

MovieMaster

I have almost the same problem with my homemade anti media force bot. Syntax error: table index is nil
stack traceback:
1: function `LoadGuard' at line is the problem my bot have. I`ll continue to try to solve it and let you know if I get it solved.

SMF spam blocked by CleanTalk