IP Range 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

IP Range Script

Started by nEgativE, 14 March, 2005, 11:44:04

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nEgativE

Hi there, could someone help with this script ?
I think it's well converted, but it doesn't work for me..

Tks in advance

-- Made By Nightlitch

Bot = "Cop" 

Ranges = {} 

function Main() 

	LoadIps()
end 

function LoadIps()
	local tmp = 0
	local handle = io.open("Data/CLP.Ranges.dat","r")
	line = handle:read()
	while line do
		tmp = tmp + 1
		local s,e,ipr1,ipr2 = string.find(line,"(%S+)|(%S+)")
		if ipr2 == nil then
			SendToAll(Bot,"Error on line "..line)
		end
		local s,e,ipa1,ipb1,ipc1,ipd1 = string.find(ipr1, "(%d*).(%d*).(%d*).(%d*)") 
		local s,e,ipa2,ipb2,ipc2,ipd2 = string.find(ipr2, "(%d*).(%d*).(%d*).(%d*)")
		si1 = CheckNumber(ipa1)..CheckNumber(ipb1)..CheckNumber(ipc1)..CheckNumber(ipd1)
		si2 = CheckNumber(ipa2)..CheckNumber(ipb2)..CheckNumber(ipc2)..CheckNumber(ipd2)
		Ranges[si1] = si2
	line = handle:read()
	end

end

function Blocked(userip) 
	local s,e,range1,range2,range3,range4 = string.find(userip,"(%d+).(%d+).(%d+).(%d+)")
	checker = CheckNumber(range1)..CheckNumber(range2)..CheckNumber(range3)..CheckNumber(range4)

	--SendToAll(Bot,"IP-Test..."..checker)

	for i,p in Ranges do 
		local s,e,xstart = string.find(i, "(%d*)") 
		local s,e,xend = string.find(p, "(%d*)")
	
		if checker > xstart and checker < xend then
			collectgarbage()
			io.flush()
			return 1
		else
		end
	end	
end

function CheckNumber(number)
	numbera = tonumber(number)
	if numbera < 10 then
		numbera = "00"..number
	elseif numbera < 100 then
		numbera = "0"..number
	else
		numbera = number
	end
	return numbera
end

function ChatArrival(User, Data)
	if string.sub(data, 1, 8) == "$Version" then
		if Blocked(user.sIP) == 1 then 
			user:SendData(Bot, "DC:CLP - IP Range Banido no Hub.") 
			user:SendData(Bot,""..user.sName..", d?vidas.. contacte-nos em: servidor.dc@gmail.com")
			user:TimeBan(300)
			user:Disconnect() 
		end
	end
end

Madman

not tested...

change the ChatArrival to this
function VersionArrival(User, Data)
	if Blocked(user.sIP) == 1 then 
		user:SendData(Bot, "DC:CLP - IP Range Banido no Hub.") 
		user:SendData(Bot,""..user.sName..", d?vidas.. contacte-nos em: [EMAIL]servidor.dc@gmail.com[/EMAIL]")
		user:TimeBan(300)
		user:Disconnect() 
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

nEgativE


Jelf

#3
Try this one, I previously posted/converted HERE
You would need a Guarding.P2P file to block IP's obviously.

nEgativE

QuoteOriginally posted by Jelf
Try this one, I previously posted/converted HERE
Its based on the same script.
You would need a Ranges.DAT file to block IP's obviously

Hi Jelf, i'll try that one :)
What is the format of Ranges.dat file ? i tried a few but i get this syntax: Guardian.lua:68: table index is nil

Jelf

Whooops, I meant Guarding.P2P file placed in a folder named Guard.

The script with Ranges.Dat I did convert but it used the same resources so I deleted it and stuck with this one.

The format for Guarding.P2P file is peerguardian which is alot easier to find than the Ranges.dat one.

Hope this helps

nEgativE

Sorry, i did not understoud.. i meant how is the file edited, the IPs.. like

127.0.0.0|127.0.0.255
or
127.0.0.0-127.0.0.255

i had tried a few.. but with no sucess :(

Jelf

Ok like this

RIAA.NL AP2P:212.241.48.0-212.241.48.127

I get the list using Blocklist manager

SMF spam blocked by CleanTalk