blockiprange,help me
 

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

blockiprange,help me

Started by master631, 01 March, 2005, 12:33:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

master631

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


master631

hi,why don't help me;because i'm a little black duck?help me please.

6Marilyn6Manson6

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)=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

master631

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

SMF spam blocked by CleanTalk