Mod this IP-blocker to...
 

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

Mod this IP-blocker to...

Started by blackwings, 15 January, 2005, 20:20:39

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

Can anyone do this =

Change so that it doesn't do the block on users at connect, but instead have a command that will show all users in the hub that has a IP within the IP-Ranges in the .dat file.


--//RangeBlaster v2.05 by Phatty
--//20k Ip Keys Written by (uk-kingdom)John
--//The rest of keys by Phatty
--//Memory based, will be tweaking soon, to make faster ;)

Bot = "IPBlocker" 

Ranges = {}

report = "IPBlocker-Report"		-- Name for PM report
reportnick = "Mike"			-- Nick to report too

function Main() 
	LoadIps()
end 

function LoadIps()
	local tmp = 0
	local handle = openfile("RangeBlaster/Ranges.dat","r")
	line = read(handle)
	while line do
		tmp = tmp + 1
		local s,e,ipr1,ipr2 = strfind(line,"(%S+)|(%S+)")
		if ipr2 == nil then
			-- SendToAll(Bot,"Error on line "..line)
		end
		Ranges[ipr1] = ipr2
	line = read(handle)
	end
	-- SendToAll(Bot,"Successfully loaded "..tmp)
end

function Blocked(userip) 
	local s,e,range1,range2,range3,range4 = strfind(userip,"(%d+).(%d+).(%d+).(%d+)")
	for i,p in Ranges do 
		local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(i, "(%d*).(%d*).(%d*).(%d*)") 
		local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(p, "(%d*).(%d*).(%d*).(%d*)")
		if range1 == ipa1 then
			if range1 < ipa1 or range1 > ipa2 then
			else
				if range2 < ipb1 or range2 > ipb2 then
				else
					if range3 < ipc1 or range3 > ipc2 then
					else
						if range4 < ipd1 or range4 > ipd2 then
						else
							collectgarbage()
							flush()
							return 1
						end
					end
				end
			end
		end	
	end	
end

function DataArrival(user,data)
	if strsub(data, 1, 13) == "$ValidateNick" then
		if Blocked(user.sIP) == 1 then 
			SendPmToNick (reportnick,report, user.sName.." - "..user.sIP.." has been blocked by "..Bot.."!") 
			user:Disconnect() 
		end
	end
end


SMF spam blocked by CleanTalk