FINALLY!!! :))
Here is the new and reborn IPGuard? Stand-alone from my good old Mean-Machine?
Changelog:
- Changed > Rewritten for Lua v5.
- Changed > Rewritten the filters to be accurate. (It actually blocked some IP's that shouldn't be blocked before).
- Changed > Moved the "Guarding.P2P" file to a subfolder called "IPGuard?".
- Added > It's now possible to change the botname.
- Added > It's now possible to set if reports should be sent to the Ops.
- Added > a settings file in the subfolder "IPGuard?"
You can get it at the link below ;)
Snowman
i am getting this message
Syntax IPGuard?.lua:7: bad argument #1 to `lines' (No such file or directory
)
Syntax IPGuard?.lua:48: bad argument #1 to `lines' (No such file or directory
)
just to let you know cuase it is not working
Hehe thats due to the ? fucking things up, due to Windows filesystem character encoding problems. Now why did you compile the bot? You will have to re-release it with correct settings, or decompiled. :P
Remove it IPGuard isn't a registered name anyway =)
i will wait for snowman to look at it..
Hi to all of you.
The ? is NOT the problem.
Note that the Guarding.P2P AND the settings.dat MUST reside in the subfolder IPGuard? or it WILL fail with the error you have seen.
It works great here :)
Snowman
QuoteOriginally posted by Snowman
The ? is NOT the problem.
Such characters are still dangerous to use in folder names, especially when users have no opportunity to change it if they have problems.
here's another version.. tested quickly and worked...
--// a peerguardian script ..
--// by Typhoon?/Ratcom_Typhoon?
--// 09-05-2004
--// idea and code from NXS-4 by NightLitch
-- rewrote to Lua 5 30042005
---- setup
tSetting = {
GuardianCheck = 1,
notifyOps = 1,
BotName = frmHub:GetHubBotName(),
GuardianFile = "peerguard/Guarding.P2P",}
---- setup end
Guard = {}
function Main()
LoadTable(Guard,tSetting.GuardianFile)
end
function NewUserConnected(curUser)
if tSetting.GuardianCheck==1 then
local check,comp = BlockGuard(curUser.sIP)
if check == "fail" then
if comp ~= nil then com = comp else com = "Unknown" end
if tSetting.notifyOps==1 then
curUser:SendData(tSetting.BotName, "Your Ip is not allowed in here,bye bye")
curUser:Disconnect()
SendPmToOps(tSetting.BotName,"*** "..curUser.sName.." - ( "..curUser.sIP.." ) from Company \" "..com.." \" tried to login! ***")
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 pairs(Guard) do
local _,_,r1,r2 = string.find(range, "(.*)-(.*)")
r1 = ComputeIP(r1)
r2 = ComputeIP(r2)
if uip>=r1 and uip<=r2 then
return "fail",comp
end
end
end
end
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 f = io.open(file)
if f then
for line in f:lines() do
local s,e,ind,val = string.find( line, "(.*):(.*)")
table[val]=ind
end
f:flush()
f:close()
end
end
just make a folder called "peerguard" and place the Guarding.p2p file inside it
feel free to extend improve old convert from lua 4 could be improved much more i guess
Typhoon?
As almost everyone uses Windows XP with Unicode support these days then this AND a lot of other special characters can be used freely.
But if someone still have problems with it then please drop a note...
Snowman
QuoteOriginally posted by Snowman
As almost everyone uses Windows XP with Unicode support these days then this AND a lot of other special characters can be used freely.
Better not discuss this 'feature' here, but search me on MSN and I will tell you about this second-to-none Unicode support. My idea was just part of the 'play safe policy'.
please change this to not use the "'tm" marking, i cannot use it on my win2000
v3.0.65 released.
- Changed > Removed the Trademark logo due to Win2K incompability.
Snowman
can you release it as not compiled maybe?
i want to be able to change its nick etc
sander815:
It IS possible to edit the name... Read the readme...
Snowman