hi,i have this script on my ptokax,but i have a problem with my registered user,because the blockiprange,block all users with a ip included in ip range blocked,is possible make a modification (usersimune)on this script?i have a very big shitman that create many problem in my hub,and i will banned ever it when try to connect,but i don't qant to penalize anybody,ths for your help,this is my script:
-- Date: 09-06-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by Skippy
--
-- Block ip ranges. Key in table is the start of the range and the value is the end
BotName = "-??]ads[??-TELEPASS"
blockedips=
{
-- start(key) = end of range(value)
["84.222.0.0"] = "84.222.255.255"
}
function Main()
frmHub:RegBot(BotName)
end
function NewUserConnected(curUser)
if BlockedIp(curUser.sIP) == 1 then
curUser:SendPM(BotName, "MI DISPIACE PER TE MA PER COLPA DI UNA MERDINA TU NON HAI ACCESSO AD AUTOSTRADA DEL SALE!")
curUser:SendPM(BotName, "SEI STATO DISCONNESSO!")
SendPmToOps(BotName, "User "..curUser.sName.." with ip "..curUser.sIP.." ? STATO DISCONNESSO "..BotName.."!")
curUser:Ban()
end
end
------------------------------------------------------------------------------------
--// This function checks to see if users ip should be blocked from entering the hub
------------------------------------------------------------------------------------
function BlockedIp(tmpip)
local r1,g1,a1,b1,c1,d1 = strfind(tmpip, "(%d*).(%d*).(%d*).(%d*)")
for s,e in blockedips do
local r2,g2,a2,b2,c2,d2 = strfind(s, "(%d*).(%d*).(%d*).(%d*)")
local r3,g3,a3,b3,c3,d3 = strfind(e, "(%d*).(%d*).(%d*).(%d*)")
if a1 > a2 and a1 < a3 then
return 1
elseif a1==a2 and a1==a3 then
if b1 > b2 and b1 < b3 then
return 1
elseif b1==b2 and b1==b3 then
if c1 > c2 and c2 < c3 then
return 1
elseif c1==c2 and c1==c3 then
if d1 > d2 and d1 < d3 then
return 1
else
return 0
end
elseif c1==c2 then
if d1 >d2 then
return 1
else
return 0
end
elseif c1==c3 then
if d1
return 1
else
return 0
end
else
return 0
end
elseif b1==b2 then
if c1>c2 then
return 1
elseif c1==c2 then
if d1 > d2 then
return 1
else
return 0
end
else
return 0
end
elseif b1==b3 then
if c1
return 1
elseif c1==c3 then
if d1
return 1
else
return 0
end
else
return 0
end
else
return 0
end
elseif a1==a2 then
if b1>b2 then
return 1
elseif b1==b2 then
if c1>c2 then
return 1
elseif c1==c2 then
if d1>c2 then
return 1
else
return 0
end
else
return 0
end
else
return 0
end
elseif a1==a3 then
if b1
return 1
elseif b1==b3 then
if c1
return 1
elseif c1==c3 then
if d1
return 1
else
return 0
end
else
return 0
end
else
return 0
end
else
return 0
end
end
end
hi,why don't help me;because i'm a little black duck?help me please.
Use this
-- range fucker v1.1 by bastya_elvtars (the rock n' roll doctor)
-- some code from easyranger by tezlo
-- checks if ips are valid and if ranges are really ranges :D
-- thx go out to Herodes for IP validation, Typhoon for paying attention, and plop for finding the bug i couldn't
-- also thx to NightLitch, i always wanna make same scripts as him but much bettter ones :D
-- enjoy
-- Converted the script into LUA 5 by 6Marilyn6Manson6
--v1.0:released
--v1.1: fixed some shit ;)
-- prefixes:!+#
cmd1="banrange"
cmd2="showranges"
cmd3="unbanrange"
cmd4="rangehelp"
Bot="---===Ranger===---"
opsips=1 -- set 1 to check if a connecting op belongs 2 a banned IP range
function DataArrival(user,data)
if string.sub(data, 1, 1) == "<" then
data=string.sub(data,1,string.len(data)-1)
local _,_,cmd=string.find(data,"%b<>%s+[%!%+%#](%S+)")
if cmd==cmd1 and user.iProfile==0 then
checknban(user,data) return 1
elseif cmd==cmd2 and user.iProfile==0 then
user:SendPM(Bot,showipranges()) return 1
elseif cmd==cmd3 and user.iProfile==0 then
unbanrange(user,data) return 1
elseif cmd==cmd4 and user.iProfile==0 then
help(user) return 1
elseif cmd==cmd1 or cmd==cmd2 or cmd==cmd3 or cmd==cmd4 and user.iProfile~=0 then
user:SendData(Bot,"You dont have suficiebt rights to use this command.")
return 1
end
end
end
function checknban(user,data)
local _,_,ip1,ip2=string.find(data,"%b<>%s+%S+%s+(%d+%.%d+%.%d+%.%d+)%-(%d+%.%d+%.%d+%.%d+)")
if ip1 and ip2 then
if ipchk(ip1)~="shit" then
if ipchk(ip2)~="shit" then
if calculate(ip1) local ipranges=loadipranges()
if ipranges[ip1]~=ip2 then
ipranges[ip1]=ip2
save(ipranges)
user:SendData(Bot,"Range "..ip1.."-"..ip2.." banned.")
else
user:SendData(Bot,"Already banned range!")
end
ipranges=nil
collectgarbage()
io.flush()
else
user:SendData(Bot,"Invalid range! "..ip1.."-"..ip2)
end
else
user:SendData(Bot,"Invalid IP #2! Please check and retry! ;)")
end
else
user:SendData(Bot,"Invalid IP #1! Please check and retry! ;)")
end
else
user:SendData(Bot,"Bad usage! Usage: !"..cmd1.." xxx.xxx.xxx.xxx-yyy.yyy.yyy.yyy")
end
end
function calculate(ip)
local _,_,pt1,pt2,pt3,pt4=string.find(ip,"(%d+)%.(%d+)%.(%d+)%.(%d+)")
return (tonumber(pt1)*16777216+tonumber(pt2)*65536+tonumber(pt3)*256+tonumber(pt4))
end
function loadipranges()
local tbl={}
readfrom("banned_ranges.dat")
while 1 do
local line=read()
if line == nil then
readfrom()
break
else
local _,_,a,b=string.find(line,"([^|]+)|(.+)")
tbl[a]=b
end
end
readfrom()
return tbl
end
function save(tbl)
writeto("banned_ranges.dat")
for a,b in tbl do
write(a.."|"..b.."\n")
end
writeto()
end
function NewUserConnected(user)
local ipranges=loadipranges()
for a,b in ipranges do
if calculate(user.sIP)>=calculate(a) and calculate(user.sIP)<=calculate(b) then
user:SendData(Bot,"Your IP range ("..a.."-"..b..") is banned in here...")
user:Disconnect()
return 1
end
end
ipranges=nil
collectgarbage()
io.flush()
end
--
--function ipchk(ip)
-- string.gsub(ip,"(%d+)",function(ipp)
-- if tonumber(ipp)>255 then
-- return "shit"
-- end
-- end)
--end
function ipchk(ip)
local tIP = {}
_,_,tIP.a,tIP.b,tIP.c,tIP.d= string.find(ip, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
for a,b in tIP do
if tonumber(b)> 255 then
return "shit"
end
end
tIP=nil
collectgarbage()
io.flush()
end
function unbanrange(user,data)
local _,_,ip1,ip2=string.find(data,"%b<>%s+%S+%s+(%d+%.%d+%.%d+%.%d+)%-(%d+%.%d+%.%d+%.%d+)")
if ip1 and ip2 then
local ipranges=loadipranges()
if ipranges[ip1]==ip2 then
user:SendData(Bot,"Range "..ip1.."-"..ip2.." unbanned.")
ipranges[ip1]=nil
save(ipranges)
else
user:SendData(Bot,"Range was not banned...")
end
else
user:SendData(Bot,"Bad usage! Usage: !"..cmd3.." xxx.xxx.xxx.xxx-yyy.yyy.yyy.yyy")
end
end
function showipranges()
local msg="All banned IP ranges:\r\n=============================\r\n"
local ipranges=loadipranges()
for a,b in ipranges do
msg=msg..a.." - "..b.."\r\n"
end
msg=msg.."=============================\r\n"
return msg
end
function Main()
frmHub:RegBot(Bot)
if opsips==1 then
OpConnected=NewUserConnected
end
end
function help(user)
local msg="Bot usage:\r\n\r\n"..
cmd1.." \t\tAdd an IP range to banlist.\r\n"..
cmd2.."\t\tShow a list of currently banned IP ranges.\r\n"..
cmd3.." \tUnbans an IP range.\r\n"..
cmd4.."\t\t\tThis help screen ;)\r\n"
user:SendPM(Bot,msg)
end
bye bye
hi,i'm very gratefull to 6Marilyn6Manson6,in a few minuts he has solved my problem,he is a very disponible man,ths for all :D :D