PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 31 January, 2004, 18:01:49

Title: RangeMaster by Phatty
Post by: pHaTTy on 31 January, 2004, 18:01:49
ok been learning whilst making a script, so here is RangeMaster v1, i know i have not updated it yet so please w8, i am working on loading into table etc, maybe and cleaning up to make abit faster ;)


Bot = "RangeMaster"

function Main()
end

function NewUserConnected(user)
Blocked(user)
end

function OpConnected(user,data)
Blocked(user)
end


function Blocked(user)
local s,e,range1,range2,range3,range4 = strfind(user.sIP,"(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,range1.." found to "..range2.." then to "..range3.." and finally "..range4)
local handle = openfile("RangeMaster/Range.dat","r")
line = read(handle)
while line do
if (line == nil) then
break
elseif strfind(line, "$"..range1.."$",1,1) then
--SendToAll(Bot,line.." was found with nick: "..user.sName)
local s,e,rangerS,therest = strfind(line,"(%S+)$(.*)")
--SendToAll(Bot,rangerS.." then "..therest)
local s,e,ipa1,ipb1,ipc1,ipd1,ipa2,ipb2,ipc2,ipd2 = strfind(line,"(%d+).(%d+).(%d+).(%d+)|(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,ipa1..ipb1..ipc1..ipd1..ipa2..ipb2..ipc2..ipd2)

if range1 < ipa1 then
return 0
elseif range1 > ipa2 then
return 0
elseif range1 > ipa1 and range1 < ipa2 then
SendToAll(Bot,"Banning: "..user.sName.." for bad ip: "..user.sIP)
user:Ban()
else
if range2 < ipb1 then
return 0
elseif range2 > ipb2 then
return 0
elseif range2 > ipb1 and range1 <= ipb2 then
SendToAll(Bot,"Banning: "..user.sName.." for bad ip: "..user.sIP)
user:Ban()
else
if range3 < ipc1 then
return 0
elseif range3 > ipc2 then
return 0
elseif range3 > ipc1 and range1 < ipc2 then
SendToAll(Bot,"Banning: "..user.sName.." for bad ip: "..user.sIP)
user:Ban()
else
if range4 < ipd1 then
return 0
elseif range4 > ipd2 then
return 0
elseif range4 > ipd1 and range4 < ipd2 then
SendToAll(Bot,"Banning: "..user.sName.." for bad ip: "..user.sIP)
user:Ban()
else
return 0
end
end
end
end
end
line = read(handle)
end
end



i have added some ips to files

but i will add download link once i actually finish this project,

to add an ip



example a

$127$|127.0.0.0|127.0.0.2 --will ban 127.0.0.1

emaple b

$127$128$129$|127.0.0.1|129.0.0.1 --will ban whatever is in between ;)


^^^im going to be working on this now, so if anyone has tips give me some time first see if i can figure them out, im enjoying working on this ;)

so and ip is

$range$anotherrange$|ipfrom|toip

you can add as many ranges as you wish

just look at examples and ask if you want an answer ;)


NOTE: Make a folder and file in scripts dir named RangeMaster/Range.dat

pHaTz,,
Title:
Post by: NightLitch on 31 January, 2004, 20:03:20
Nice Phatty.
Title:
Post by: pHaTTy on 31 January, 2004, 20:27:23
QuoteOriginally posted by NightLitch
Nice Phatty.

yep thx, but i think ive made a big mistake, i must have been tired when i wrote this too, i will be releasing a fixed version asap...........
Title:
Post by: pHaTTy on 31 January, 2004, 22:30:02
well fixed this, and also added many ips to range, all bad ips, so i will update the script more and then upload it to a server with a auto compile so you can compile it urserf and make faster ;)

--//RangeMaster v1 fixed by Phatty
--//Much more todo

Bot = "RangeMaster"

function Main()
end

function NewUserConnected(user)
Blocked(user)
end

function OpConnected(user,data)
Blocked(user)
end


function Blocked(user)
local s,e,range1,range2,range3,range4 = strfind(user.sIP,"(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,range1.." found to "..range2.." then to "..range3.." and finally "..range4)
local handle = openfile("RangeMaster/Range.dat","r")
line = read(handle)
while line do
if (line == nil) then
break
elseif strfind(line, "$"..range1.."$",1,1) then
--SendToAll(Bot,line.." was found with nick: "..user.sName)
local s,e,rangerS,therest = strfind(line,"(%S+)$(.*)")
--SendToAll(Bot,rangerS.." then "..therest)
local s,e,ipa1,ipb1,ipc1,ipd1,ipa2,ipb2,ipc2,ipd2 = strfind(line,"(%d+).(%d+).(%d+).(%d+)|(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,ipa1..ipb1..ipc1..ipd1..ipa2..ipb2..ipc2..ipd2)

if range1 < ipa1 or range1 > ipa2 then
return 0
else
if range2 < ipb1 or range2 > ipb2 then
return 0
else
if range3 < ipc1 or range3 > ipc2 then
return 0
else
if range4 < ipd1 or range4 > ipd2 then
return 0
else
SendToAll(Bot,user.sName.." is being banned for bad ip:"..user.sIP)
user:Ban()
end
end
end
end
return 0
end
line = read(handle)
end
end

enjoy for now until i do some more
Title:
Post by: pHaTTy on 01 February, 2004, 00:07:58
ok wasnt sorted properly dont use the last 2 lol

here is the proper working on ;)


--//RangeMaster v1.01 fixed by Phatty
--//Much more todo
--//Ip Keys Written by (uk-kingdom)John
--//Lots of time testing by Chilla, thx mate ;)

Bot = "RangeMaster"

function Main()
end

function NewUserConnected(user)
Blocked(user)
end

function OpConnected(user)
Blocked(user)
end


function Blocked(user)
local s,e,range1,range2,range3,range4 = strfind(user.sIP,"(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,range1.." found to "..range2.." then to "..range3.." and finally "..range4)
local handle = openfile("RangeMaster/Range.dat","r")
line = read(handle)
while line do
--if (line == nil) then
-- break
if strfind(line, "%$"..range1.."%$")  then
--SendToAll(Bot,line.." was found with nick: "..user.sName)
local s,e,rangerS,therest = strfind(line,"(%S+)$(.*)")
--SendToAll(Bot,rangerS.." then "..therest)
local s,e,ipa1,ipb1,ipc1,ipd1,ipa2,ipb2,ipc2,ipd2 = strfind(line,"(%d+).(%d+).(%d+).(%d+)|(%d+).(%d+).(%d+).(%d+)")
--SendToAll(Bot,ipa1..ipb1..ipc1..ipd1..ipa2..ipb2..ipc2..ipd2)

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
SendToAll(Bot,user.sName.." is being banned for bad ip:"..user.sIP)
user:Ban()
return 0
end
end
end
end
end
line = read(handle)
end
end


will be back with more
Title:
Post by: c h i l l a on 01 February, 2004, 00:31:38
sure mate no problem :)
Title:
Post by: Guibs on 01 February, 2004, 00:55:56
Hi there,,

Sounds like a very nice & cool script there,... :)

Well done, Phatty,, & keep it up,, ;)

l8tr,,
Title:
Post by: pHaTTy on 01 February, 2004, 01:01:50
QuoteOriginally posted by Guibs
Hi there,,

Sounds like a very nice & cool script there,... :)

Well done, Phatty,, & keep it up,, ;)

l8tr,,

thx mate :))
Title:
Post by: nEgativE on 01 February, 2004, 02:52:14
Keep updating .. Good work, TkS
Title:
Post by: pHaTTy on 07 February, 2004, 01:57:34
ok rewritten most, its now loaded into memory for effiecency ;)

DOWNLOAD (http://members.lycos.co.uk/garfvader/RB.rar)


--//RangeBlaster v2.00 by Phatty
--//Ip Keys Written by (uk-kingdom)John
--//Memory based, will be tweaking soon, to make faster ;)

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function NewUserConnected(user)
if Blocked(user) == 1 then
user:SendPM(Bot, "This hub is private, you will now be disconnected!")
user:SendPM(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Ban()
end
end

OpConnected = NewUserConnected

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,range,ipr1,ipr2 = strfind(line,"$(%S+)$|(%S+)|(%S+)") --range may be used later on in development
Ranges[ipr1] = ipr2
line = read(handle)
end
end

function Blocked(user)
local s,e,range1,range2,range3,range4 = strfind(user.sIP,"(%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 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
return 1
end
end
end
end
end
end


127.0.0.1 to 128.0.0.0 is not supported because 0 end is below the 127 end 0, i will add this in later ;)

so each end must be higher per value.....
Title:
Post by: NotRabidWombat on 07 February, 2004, 06:27:05
Convert the text IP into an actual IP. So you read in A.B.C.D but then you create:
iIP = D + C * 256 + B * 65536 + C * 16777216;

This will give you number between 4294967295 and 0 which you can do very simple conditions on.

Did something like this a while back. The next step is to sort your range table so it can intelligently skip several ranges the number can not be in (so sort of binary search would work). After I made the script we all decided it would MUCH faster to use a nice firewall to block IPs faster than any script ever could.

-NotRabidWombat
Title:
Post by: pHaTTy on 07 February, 2004, 11:31:46
little update for speed, this bot im setting on 1 range per ban

so 127 - 128 willnot be supported but ive never seena  range like that anyways ;)

--//RangeBlaster v2.01 by Phatty
--//Ip Keys Written by (uk-kingdom)John
--//Memory based, will be tweaking soon, to make faster ;)

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function NewUserConnected(user)
if Blocked(user.sIP) == 1 then
user:SendPM(Bot, "This hub is private, you will now be disconnected!")
user:SendPM(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Ban()
end
end

OpConnected = NewUserConnected

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,range,ipr1,ipr2 = strfind(line,"$(%S+)$|(%S+)|(%S+)") --range may be used later on in development
Ranges[ipr1] = ipr2
line = read(handle)
end
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
return 1
end
end
end
end
end
end
end
Title:
Post by: pHaTTy on 07 February, 2004, 11:39:29
even faster now done in datarival meaning less bandwidth no checks for user ;)

--//RangeBlaster v2.02 by Phatty
--//Ip Keys Written by (uk-kingdom)John
--//Memory based, will be tweaking soon, to make faster ;)
--//Much faster now done in dataarival so less bandiwdth used for bad user ;)

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,range,ipr1,ipr2 = strfind(line,"$(%S+)$|(%S+)|(%S+)") --range may be used later on in development
Ranges[ipr1] = ipr2
line = read(handle)
end
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
return 1
end
end
end
end
end
end
end

function DataArrival(user,data)
if strsub(data, 1, 8) == "$Version" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Ban()
end
end
end

bbl
Title:
Post by: pHaTTy on 07 February, 2004, 11:51:59
optionally you can make it little faster by validatenick but it means u dont actually reiceve the nick so its unknown, i prefere version so u see nick but upto you


--//RangeBlaster v2.02 by Phatty
--//Ip Keys Written by (uk-kingdom)John
--//Memory based, will be tweaking soon, to make faster ;)
--//Much faster now done in dataarival so less bandiwdth used for bad user ;)

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,range,ipr1,ipr2 = strfind(line,"$(%S+)$|(%S+)|(%S+)") --range may be used later on in development
Ranges[ipr1] = ipr2
line = read(handle)
end
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
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
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Ban()
end
end
end
Title:
Post by: NightLitch on 07 February, 2004, 12:04:00
Well your script is getting better & better AND intresting.

Keep up the work, and I hope I can "borrow" a line or two if I
intend rewriting my ip-script someday.

Have a nice day. / NL
Title:
Post by: pHaTTy on 07 February, 2004, 12:17:32
QuoteOriginally posted by NightLitch
Well your script is getting better & better AND intresting.

Keep up the work, and I hope I can "borrow" a line or two if I
intend rewriting my ip-script someday.

Have a nice day. / NL

thanks bro,

here 2.03 ;)

--//RangeBlaster v2.03 by Phatty
--//Ip Keys Written by (uk-kingdom)John
--//Memory based, will be tweaking soon, to make faster ;)
--//Thanks to RabidWombat for an idea :)

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,range,ipr1,ipr2 = strfind(line,"$(%S+)$|(%S+)|(%S+)") --range may be used later on in development
Ranges[ipr1] = ipr2
line = read(handle)
end
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*)")
ranger1 = ipa1..ipb1..ipc1..ipd1
ranger2 = ipa2..ipb2..ipc2..ipd2
ranged1 = range1..range2..range3..range4
if range1 == ipa1 then
if ranged1 < ranger1 or ranged1 > ranger2 then
else
return 1
end
end
end
end

function DataArrival(user,data)
if strsub(data, 1, 13) == "$ValidateNick" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Ban()
end
end
end

nice idea got off rabids way thx ;)
Title:
Post by: pHaTTy on 07 February, 2004, 12:23:57
only thing i woudnt use last method i wud still use one of the older because if an ip such as

217.23.23.23

and

217.3.333.23  just as example

then pfff
Title:
Post by: NightLitch on 07 February, 2004, 13:25:39
QuoteOriginally posted by Phatty

only thing i woudnt use last method i wud still use one of the older because if an ip such as

217.23.23.23

and

217.3.333.23 just as example

then pfff

Well bro :-) 333 is not an valid number in ranges anyway, max 255 :-), mean not to be a pain in the ass now.. :-D

you could limit the numbers maybe all over 255 is not a valid number and under 0 or 023 example is not valid. Just some ideas.

/NL
Title:
Post by: NightLitch on 07 February, 2004, 13:26:54
Quoting myself:  under 0

hehe

there can't be under 0 I mean 034 hehe...

Must be really dizzy... :-p
Title:
Post by: pHaTTy on 07 February, 2004, 13:55:26
loooool

81.-0.1-234 :P ghehehe ;)
Title:
Post by: NightLitch on 07 February, 2004, 14:16:59
hahaha lool

I think that will indeed WORK really good.

I mean -0.1-234 that is so my range. :-D
Title:
Post by: pHaTTy on 07 February, 2004, 14:30:52
nah didnt like other way inaccurate so

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

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local handle = openfile("RangeBlaster/Ranges.dat","r")
line = read(handle)
while line do
local s,e,ipr1,ipr2 = strfind(line,"(%S+)|(%S+)")
Ranges[ipr1] = ipr2
line = read(handle)
end
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
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Disconnect()
end
end
end

Title:
Post by: pHaTTy on 07 February, 2004, 16:26:00
i will upload a package with 1224 ip ranges very soon, i have more to add

so far with those ranges bot using 146/293

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

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
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
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Disconnect()
end
end
end

pHaTz,,
Title:
Post by: NotRabidWombat on 07 February, 2004, 16:54:52
The problem with:
ranger1 = ipa1..ipb1..ipc1..ipd1

Is you are still using strings. And a string of an IP address is much different than the number it is supposed to be as you found with:
217.23.23.23
and
217.3.333.23

Try making the IPs in integers like so.
iIP = D + C * 256 + B * 65536 + C * 16777216;

You may have to call tonumber(...) on a some of the strings.

-NotRabidWombat
Title:
Post by: pHaTTy on 07 February, 2004, 16:58:46
hmm im not so god with all that sort of things, but hey, i have time to learn thx, ill look into it :))
Title:
Post by: [NL]trucker on 07 February, 2004, 17:13:41
thnx phatty

btw  is it logging the kicked users ?
if not could you make it so it logs the ip and username in a txt file?
Title:
Post by: pHaTTy on 07 February, 2004, 18:14:50
i dont see the point of using resources for doing that

my intention is to save hdd life by using memory so writing to a text file when it disconnects someone it pretty pointless and resource using, so i think i give that a miss...........

but maybe i will write a seperate version for you
Title:
Post by: NightLitch on 07 February, 2004, 19:06:06
Why not doing it like me with on/off switches ???

But everyone of us have their own way creating. :-)

This script does take a good shape.

Just brake the computing some more and then I'm gonna mod & use it for my own. And of course I will post that version then.

Keep up the really good work.

/NL
Title:
Post by: pHaTTy on 11 February, 2004, 00:53:09
i gonna be adding more but heres v2.07 ;)


--//RangeBlaster v2.07 by Phatty
--//IP Keys written by John, and Phatty

Bot = "RangeBlaster"

Ranges = {}

function Main()
frmHub:RegBot(Bot)
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
local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(ipr1, "(%d*).(%d*).(%d*).(%d*)")
local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(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 = 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+)")
checker = CheckNumber(range1)..CheckNumber(range2)..CheckNumber(range3)..CheckNumber(range4)

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

for i,p in Ranges do
local s,e,xstart = strfind(i, "(%d*)")
local s,e,xend = strfind(p, "(%d*)")

if checker > xstart and checker < xend then
collectgarbage()
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 DataArrival(user,data)
if strsub(data, 1, 13) == "$ValidateNick" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "This hub is private, you will now be disconnected!")
user:SendData(Bot, "Disconnecting...")
SendPmToOps(Bot, user.sName.." - "..user.sIP.." has been blasted by "..Bot.."!")
user:Disconnect()
end
end
end


later,,
Title:
Post by: NightLitch on 11 February, 2004, 01:01:18
Nice going Phatty.
Title:
Post by: pHaTTy on 11 February, 2004, 01:26:33
QuoteOriginally posted by NightLitch
Nice going Phatty.

thanks,, i still have some more plans ahead if i get time :)
Title:
Post by: acethecase on 16 February, 2004, 14:52:39
QuoteOriginally posted by (uk-kingdom)pH?tt?
i will upload a package with 1224 ip ranges very soon, i


Hi m8 , is the package done yett.. :D
Title:
Post by: pHaTTy on 16 February, 2004, 14:55:24
QuoteOriginally posted by acethecase
QuoteOriginally posted by (uk-kingdom)pH?tt?
i will upload a package with 1224 ip ranges very soon, i


Hi m8 , is the package done yett.. :D

oops not had time ill upload asap ;)
Title:
Post by: acethecase on 17 February, 2004, 20:07:36
hehe np I thought I missed it 8)
Nice job btw..
is it going to be posible to download update list on
frobidden IP?s  from p2p guardian homep.
it would be nice to have  394966323 IPs from 3406 diffren media profiles.
Title:
Post by: pHaTTy on 17 February, 2004, 20:10:59
QuoteOriginally posted by acethecase
hehe np I thought I missed it 8)

hmmm well if u dwnload the new gekko package it is included in there just take the Ranges.dat and use that ;)
Title:
Post by: acethecase on 17 February, 2004, 20:13:45
hehe fast replay---
oki m8 Ill do so :)
Title:
Post by: pHaTTy on 17 February, 2004, 22:18:56
QuoteOriginally posted by acethecase
hehe fast replay---
oki m8 Ill do so :)

eheh did u get it sorted?
Title:
Post by: acethecase on 22 February, 2004, 13:41:21
lol Im a bit late hehe but yepp m8 I got it,
 I hade it tested and its working tnx for ur help m8ty ---
keep up the good work
Title:
Post by: pHaTTy on 22 February, 2004, 13:52:19
QuoteOriginally posted by acethecase
lol Im a bit late hehe but yepp m8 I got it,
 I hade it tested and its working tnx for ur help m8ty ---
keep up the good work

np ;)
Title:
Post by: nEgativE on 21 March, 2004, 21:42:54
Hi Phatty, having something strange here.. i'm getting the OP MSG from the kicked user without the username :\ returning did i messed something ?


--//RangeBlaster v2.07 by Phatty
--//IP Keys written by John, and Phatty

Bot = "[operserv]"

Ranges = {}

function Main()
--frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local tmp = 0
local handle = openfile("txt/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
local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(ipr1, "(%d*).(%d*).(%d*).(%d*)")
local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(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 = read(handle)
end

end

function Blocked(userip)
local s,e,range1,range2,range3,range4 = strfind(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 = strfind(i, "(%d*)")
local s,e,xend = strfind(p, "(%d*)")

if checker > xstart and checker < xend then
collectgarbage()
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 DataArrival(user,data)
if strsub(data, 1, 13) == "$ValidateNick" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:SendData(Bot, "D?vidas, informe ? [EMAIL]lusobrasil@netcabo.pt[/EMAIL] ? [URL]www.lusobrasil.site.vu[/URL] ?")
SendToOps(Bot, "? OP MSG ? Usu?rio: "..user.sName..", com o IP: ["..user.sIP.."], foi desconectado do Hub por: "..Bot.." - Motivo: IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:TempBan()
user:Disconnect()
end
end
end



TkS in advance
Title:
Post by: pHaTTy on 21 March, 2004, 21:46:45
sorry my mistake yup

--//RangeBlaster v2.07 by Phatty
--//IP Keys written by John, and Phatty

Bot = "[operserv]"

Ranges = {}

function Main()
--frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local tmp = 0
local handle = openfile("txt/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
local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(ipr1, "(%d*).(%d*).(%d*).(%d*)")
local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(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 = read(handle)
end

end

function Blocked(userip)
local s,e,range1,range2,range3,range4 = strfind(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 = strfind(i, "(%d*)")
local s,e,xend = strfind(p, "(%d*)")

if checker > xstart and checker < xend then
collectgarbage()
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 DataArrival(user,data)
if strsub(data, 1, 13) == "$ValidateNick" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:SendData(Bot, "D?vidas, informe ? [EMAIL]lusobrasil@netcabo.pt[/EMAIL] ? [URL]www.lusobrasil.site.vu[/URL] ?")
SendToOps(Bot, "? OP MSG ? Usu?rio: "..data..", com o IP: ["..user.sIP.."], foi desconectado do Hub por: "..Bot.." - Motivo: IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:TempBan()
user:Disconnect()
end
end
end



validatenick ;)


later,,
Title:
Post by: nEgativE on 26 March, 2004, 08:13:58
Hi Phatty, i still get this on SendToOps MSG

? OP MSG ? User: $ValidateNick [PT]user1
, with IP: [xxx.xxx.xxx.xxx], was disconnected from Hub by: [BOT]

And stay on Ptokax TempBan as
Hehe..
Title:
Post by: pHaTTy on 15 April, 2004, 04:54:37
well if

function DataArrival(user,data)
if strsub(data, 1, 14) == "$ValidateNick " then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:SendData(Bot, "D?vidas, informe ? [EMAIL]lusobrasil@netcabo.pt[/EMAIL] ? [URL]www.lusobrasil.site.vu[/URL] ?")
SendToOps(Bot, "? OP MSG ? Usu?rio: "..data..", com o IP: ["..user.sIP.."], foi desconectado do Hub por: "..Bot.." - Motivo: IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:TempBan()
user:Disconnect()
end
end
end


dont work then try

function DataArrival(user,data)
if strsub(data, 1, 8) == "$Version" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:SendData(Bot, "D?vidas, informe ? [EMAIL]lusobrasil@netcabo.pt[/EMAIL] ? [URL]www.lusobrasil.site.vu[/URL] ?")
SendToOps(Bot, "? OP MSG ? Usu?rio: "..user.sName..", com o IP: ["..user.sIP.."], foi desconectado do Hub por: "..Bot.." - Motivo: IP - Range tempor?riamente banido no LusoBrasil Hub.")
user:TempBan()
user:Disconnect()
end
end
end

later
Title:
Post by: nEgativE on 17 April, 2004, 13:08:33
Oh Yeah !! running 100% now :)


--//RangeBlaster v2.07 by Phatty
--//IP Keys written by John, and Phatty

Bot = "RangeBlaster"

Ranges = {}

function Main()
--frmHub:RegBot(Bot)
LoadIps()
end

function LoadIps()
local tmp = 0
local handle = openfile("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
local s,e,ipa1,ipb1,ipc1,ipd1 = strfind(ipr1, "(%d*).(%d*).(%d*).(%d*)")
local s,e,ipa2,ipb2,ipc2,ipd2 = strfind(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 = read(handle)
end

end

function Blocked(userip)
local s,e,range1,range2,range3,range4 = strfind(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 = strfind(i, "(%d*)")
local s,e,xend = strfind(p, "(%d*)")

if checker > xstart and checker < xend then
collectgarbage()
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 DataArrival(user,data)
if strsub(data, 1, 8) == "$Version" then
if Blocked(user.sIP) == 1 then
user:SendData(Bot, "You have been banned")
SendToOps(Bot, "User: "..user.sName..", with IP: ["..user.sIP.."] was disconnected from Hub by "..bot..".")
user:TempBan()
user:Disconnect()
end
end
end