IP?S rages BLOCK ??????
 

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

IP?S rages BLOCK ??????

Started by badtrip, 18 June, 2005, 04:34:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

badtrip

hello ppl,


I?m nead a script like that :

if you are in  this IP rage 123.0.0.1-123.255.255.0

you can not dowload from the ip rages :

190.0.0.1-190.255.255.0
etc....

but if you use the comand !freeIP you can download
anyway ...

help-me plz, i?m nead this script , in my country some ISP?s  are internacional to Others ISP?s in the country and i wont to block some rages of ip?s to some ISP?s users...

jiten

Found this one that may help you:
-- modded by jiten

sBot = "-=Brainu=-" 

sOpChatName = "-=OpChat=-"


--## Configuration ##-- 

-- Put in this table the Prefixes you want the users to have
 
sPrefix = { "[CV]" , "(CV)" ,}

-- Put in this table the IP-Range or IP you want to be checked for

arrIP = { 
   ["10.6.0.0"] = "10.6.0.30",
   ["84.90.0.0"] = "84.91.255.255",      --  Cabovisao,SA
   ["213.228.128.0"] = "213.228.191.255",   --  Cabovisao,SA
   ["217.129.0.0"] = "217.129.255.255",      --  Cabovisao,SA
}
--## END ##-- 

function Main()
	frmHub:RegBot(sBot) 
end 

function NewUserConnected(user) 
	if (CheckUserPrefix(user) == nil) and not (isGoodIP(user.sIP) == nil) then 
		user:SendPM(sBot, "Inclui o prefixo [CV] ou (CV) no teu nick, isto porque o Sapo Adsl conta como internacional o trafego de ti")
		user:SendPM(sBot, "Se precisares de ajuda, ou tiveres d?vidas contacta um Operador")
		SendPmToOps(sOpChatName, "O utilizador "..user.sName.." foi requisitado para usar o prefixo [CV]")
	end 
end 

OpConnected = NewUserConnected 

function ConnectToMeArrival(user,data)
	if (CheckUserPrefix(user) == nil) and not (isGoodIP(user.sIP) == nil) then 
		user:SendData(sBot, "N?o podes fazer downloads/uploads at? mudares o teu prefixo para [CV] ou (CV)")
		return 1
	end
end

RevConnectToMeArrival = ConnectToMeArrival

function CheckUserPrefix(user)
	for key,pre in sPrefix do 
		if string.find(string.lower(user.sName), string.lower(pre),1,1) then 
			return 1 
		end 
	end 
end

function isGoodIP(sIP) 
	sIP = ipToNumber(sIP) 
	local iFirst,iLast 
	for iFirst, iLast in arrIP do 
		if (sIP >= ipToNumber(iFirst) and sIP <= ipToNumber(iLast)) then 
			return 1 
		end 
	end 
	return nil 
end 

function ipToNumber(sIP) 
	iAux = "" 
	string.gsub(sIP,"(%d+)", function(w) 
		w = tonumber(w) 
		if (w < 10) then 
			iAux = iAux.."00"..w 
		elseif (w < 100) then 
			iAux = iAux.."0"..w 
		else 
			iAux = iAux..w 
		end 
	end) 
	return tonumber(iAux) 
end

Cheers


SMF spam blocked by CleanTalk