PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: monnie on 02 August, 2004, 13:21:30

Title: Need help with ip bot
Post by: monnie on 02 August, 2004, 13:21:30
Greetings

I've downloaded a ip bot, but it seems not to work very well, foreigneirs still getting in..
Can you please post here one only for portugueses??
I also use Brain Master by nerbos, but i don't understand how they get in
Thanks

                   monnie
Title:
Post by: [NL]Pur on 02 August, 2004, 16:24:08
QuoteI've downloaded a ip bot,

can you post a link or the script itself here,

maby we can adjust it ;)
Title: Copy of
Post by: monnie on 02 August, 2004, 18:27:37
HI...
OK, i'll copy paste to here...

sBot = "IP"

ipallowed = {      
      "217.70.64.0-217.70.79.255",      --BRAGATEL
      "213.138.224.0-213.138.255.255",   --TVMADEIRA  
      "213.190.192.0-213.190.223.255",   --TVMADEIRA
      "213.228.128.0-213.228.191.255",   --CABOVISAO
      "217.129.0.0-217.129.255.255",      --CABOVISAO
      "194.117.0.0-194.117.49.255",      --CCFCUL  
      "194.117.48.0-194.117.49.255",      --CCFCUL  
      "217.23.0.0-217.23.15.255",      --IDCENTRE
      "80.251.160.0-80.251.175.255",      --COLTEL
      "194.38.128.0-194.38.159.255",      --COMNEXO    
      "213.146.192.0-213.146.223.255",   --COMNEXO
      "195.8.0.0-195.8.31.255",      --MARCONI
      "195.245.128.0-195.245.191.255",   --ONI  
      "213.58.0.0-213.58.255.255",      --ONI  
      "80.172.0.0-80.172.255.255",      --VIANET  
      "195.22.0.0-195.22.31.255",      --VIANET  
      "80.79.0.0-80.79.15.255",      --GUIAO
      "212.48.64.0-212.48.95.255",      --HLC
      "194.79.64.0-194.79.95.255",      --NOVIS
      "195.23.0.0-195.23.255.255",      --NOVIS  
      "212.0.160.0-212.0.191.255",      --NOVIS  
      "213.205.64.0-213.205.95.255",      --NOVIS  
      "195.60.160.0-195.60.191.255",      --ISLA
      "212.54.128.0-212.54.159.255",      --ITNET
      "213.63.0.0-213.63.255.255",      --JAZZTEL
      "213.141.0.0-213.141.31.255",      --JAZZTEL  
      "193.126.0.0-193.126.255.255",       --KPNQUEST
      "212.113.128.0-212.113.159.255",   --MAXITEL
      "82.140.192.0-82.140.255.255",      --MEDIACAPITAL
      "213.129.128.0-213.129.159.255",   --NETWAY
      "81.92.192.0-81.92.223.255",      --NFSI
      "82.102.0.0-82.102.63.255",      --NFSI
      "212.13.32.0-212.13.63.255",      --NORTENET
      "80.90.192.0-80.90.223.255",      --ONIWAY
      "62.169.64.0-62.169.127.255",      --OPTIMUS  
      "83.144.128.0-83.144.191.255",      --PLURICANAL  
      "62.48.128.0-62.48.255.255",      --PTPRIME
      "193.136.0.0-193.137.255.255",      --FCCN  
      "193.236.0.0-193.236.255.255",      --FCCN  
      "194.210.0.0-194.210.255.255",      --FCCN  
      "195.138.0.0-195.138.31.255",      --SIBS
      "212.18.160.0-212.18.191.255",      --TELECEL  
      "213.30.0.0-213.30.127.255",      --TELECEL  
      "81.193.0.0-81.193.255.255",      --TELEPAC
      "82.154.0.0-82.155.255.255",      --TELEPAC
      "194.65.0.0-194.65.255.255",      --TELEPAC
      "212.55.128.0-212.55.191.255",      --TELEPAC
      "213.13.0.0-213.13.255.255",      --TELEPAC
      "212.16.128.0-212.16.159.255",      --TELEWEB
      "212.251.128.0-212.251.255.255",   --TELEWEB
      "81.84.0.0-81.84.255.255",      --TVCABO  
      "83.132.0.0-83.132.255.255",      --TVCABO
      "212.113.160.0-212.113.191.255",   --TVCABO  
      "213.22.0.0-213.22.255.255",      --TVCABO  
      "62.249.0.0-62.249.31.255",      --UUNET
      "217.112.192.0-217.112.207.255",      --WIRELESS TS
      "84.90.13.118.0-200"   ---cj
}

function NewUserConnected(user, data)
   if (IspChecker(user.sIP) == 0) then
      user:SendData(sBot, "O Teu IP n?o ? permitido no Forever Friends.")
      user:Disconnect()
   end
end

OpConnected = NewUserConnected

function IspChecker(IP)
   local accept = 0

   local s,e,ip1,ip2,ip3,ip4 = strfind(IP, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
   local userIP = Addzero(ip1)..Addzero(ip2)..Addzero(ip3)..Addzero(ip4)
   userIP = tonumber(userIP)

   for i=1, getn(ipallowed) do
      local s,e,a1,a2,a3,a4,b1,b2,b3,b4 = strfind(ipallowed, "(%d+)%.(%d+)%.(%d+)%.(%d+)-(%d+)%.(%d+)%.(%d+)%.(%d+)")
      local aIP = Addzero(a1)..Addzero(a2)..Addzero(a3)..Addzero(a4)
      aIP = tonumber(aIP)
      local bIP = Addzero(b1)..Addzero(b2)..Addzero(b3)..Addzero(b4)
      bIP = tonumber(bIP)

      if (userIP >= aIP and userIP <= bIP) then
         accept = 1
         break
      end
   end
return accept
end

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


Now see what you can do please...

Thanks
Title: Please...
Post by: monnie on 03 August, 2004, 21:49:11
Can anyone help me out with this, please...

Thanks

                   monnie
Title:
Post by: NightLitch on 03 August, 2004, 23:11:12
here try this one, I modified yours abit removed some code and added some I use, not tested hope it works.

-- Modified by NightLitch 2004/08/03

sBot = "IP"

ipallowed = {
["217.70.64.0-217.70.79.255"] = "BRAGATEL ",
["213.138.224.0-213.138.255.255"] = "TVMADEIRA ",
["213.190.192.0-213.190.223.255"] = "TVMADEIRA ",
["213.228.128.0-213.228.191.255"] = "CABOVISAO ",
["217.129.0.0-217.129.255.255"] = "CABOVISAO ",
["194.117.0.0-194.117.49.255"] = "CCFCUL ",
["194.117.48.0-194.117.49.255"] = "CCFCUL ",
["217.23.0.0-217.23.15.255"] = "IDCENTRE ",
["80.251.160.0-80.251.175.255"] = "COLTEL ",
["194.38.128.0-194.38.159.255"] = "COMNEXO ",
["213.146.192.0-213.146.223.255"] = "COMNEXO ",
["195.8.0.0-195.8.31.255"] = "MARCONI ",
["195.245.128.0-195.245.191.255"] = "ONI ",
["213.58.0.0-213.58.255.255"] = "ONI ",
["80.172.0.0-80.172.255.255"] = "VIANET ",
["195.22.0.0-195.22.31.255"] = "VIANET ",
["80.79.0.0-80.79.15.255"] = "GUIAO ",
["212.48.64.0-212.48.95.255"] = "HLC ",
["194.79.64.0-194.79.95.255"] = "NOVIS ",
["195.23.0.0-195.23.255.255"] = "NOVIS ",
["212.0.160.0-212.0.191.255"] = "NOVIS ",
["213.205.64.0-213.205.95.255"] = "NOVIS",
["195.60.160.0-195.60.191.255"] = "ISLA ",
["212.54.128.0-212.54.159.255"] = "ITNET ",
["213.63.0.0-213.63.255.255"] = "JAZZTEL ",
["213.141.0.0-213.141.31.255"] = "JAZZTEL ",
["193.126.0.0-193.126.255.255"] = "KPNQUEST ",
["212.113.128.0-212.113.159.255"] = "MAXITEL ",
["82.140.192.0-82.140.255.255"] = "MEDIACAPITAL ",
["213.129.128.0-213.129.159.255"] = "NETWAY ",
["81.92.192.0-81.92.223.255"] = "NFSI ",
["82.102.0.0-82.102.63.255"] = "NFSI ",
["212.13.32.0-212.13.63.255"] = "NORTENET",
["80.90.192.0-80.90.223.255"] = "ONIWAY ",
["62.169.64.0-62.169.127.255"] = "OPTIMUS ",
["83.144.128.0-83.144.191.255"] = "PLURICANAL ",
["62.48.128.0-62.48.255.255"] = "PTPRIME ",
["193.136.0.0-193.137.255.255"] = "FCCN ",
["193.236.0.0-193.236.255.255"] = "FCCN ",
["194.210.0.0-194.210.255.255"] = "FCCN ",
["195.138.0.0-195.138.31.255"] = "SIBS ",
["212.18.160.0-212.18.191.255"] = "TELECEL",
["213.30.0.0-213.30.127.255"] = "TELECEL ",
["81.193.0.0-81.193.255.255"] = "TELEPAC ",
["82.154.0.0-82.155.255.255"] = "TELEPAC ",
["194.65.0.0-194.65.255.255"] = "TELEPAC ",
["212.55.128.0-212.55.191.255"] = "TELEPAC ",
["213.13.0.0-213.13.255.255"] = "TELEPAC ",
["212.16.128.0-212.16.159.255"] = "TELEWEB ",
["212.251.128.0-212.251.255.255"] = "TELEWEB ",
["81.84.0.0-81.84.255.255"] = "TVCABO ",
["83.132.0.0-83.132.255.255"] = "TVCABO ",
["212.113.160.0-212.113.191.255"] = "TVCABO ",
["213.22.0.0-213.22.255.255"] = "TVCABO",
["62.249.0.0-62.249.31.255"] = "UUNET",
["217.112.192.0-217.112.207.255"] = "WIRELESS TS",
}

function NewUserConnected(user, data)
is_ip_ok, _ = GetRange(user.sIP,ipallowed)
if (is_ip_ok == 0) then
user:SendData(sBot, "O Teu IP n?o ? permitido no Forever Friends.")
user:Disconnect()
end
end

OpConnected = NewUserConnected

function GetRange(ip,table)
local _,_,a,b,c,d = strfind(ip, "(%d*).(%d*).(%d*).(%d*)")
if ( tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d) ) then
local uip = ComputeIP(ip)
if uip then
local c = ""
for r,i in table do
local _,_,range1,range2 = strfind(r, "(.*)-(.*)")
range1 = ComputeIP(range1)
range2 = ComputeIP(range2)
if uip>=range1 and uip<=range2 then
c = "1"
return 1,r
end
end
end
end
end

function ComputeIP(curIP)
local _,_,a,b,c,d = strfind(curIP,"(%d+).(%d+).(%d+).(%d+)")
return a*16777216 + b*65536 + c*256 + d
end

/NightLitch
Title: I'll check it out
Post by: monnie on 04 August, 2004, 12:25:32
NightLitch, thanks

I'll check it out and then say something!!
Greetings

By the way
Can you say to me where can i find for example, all scripts separated?!?
I mean, in Brain Master by nerbos, the scripts are all in one, i like them most separately, is there possible to find??

                       monnie
Title:
Post by: NightLitch on 04 August, 2004, 13:18:27
QuoteOriginally posted by monnie
NightLitch, thanks

I'll check it out and then say something!!
Greetings

By the way
Can you say to me where can i find for example, all scripts separated?!?
I mean, in Brain Master by nerbos, the scripts are all in one, i like them most separately, is there possible to find??

                       monnie

Well you need to dig in the Finished Script Archive to find some stand-alones, but not all can be found I guess...

Brain Master and others are One-In-All Bots and often all functions is created by the author/creator.

/NL
Title: reply to ip bot
Post by: monnie on 05 August, 2004, 16:50:02
Hi nightlitch

Thanks for your tip with my standalone doubts...
As of the ip bot, it seems to work fine, but it sends a msg to almost everyone saying that the ip is not allowed,
i have to change the bot cmd from disconect to warn cos otherwise nearly users can log in

See what you can do please...
Sorry for being such a zero in this man

Thanks

                      monnie
Title:
Post by: NightLitch on 05 August, 2004, 17:44:55
Well to the look in the script it looks real OK for me, sure u don't miss a range or something ??

Users that is not inside those IP-Ranges is not allowed into the hub right ?? And the Bot does take care of that... Should not be much of a problem...

*Anyone else disagree with my conclussion of my code, have I missed something Am to blind to see ??? *

/NL
Title: still IP answer
Post by: monnie on 06 August, 2004, 23:55:59
Greetings

NightLitch, in fact i think i must have been mistaken, i'll check it out than...
But with the other you gave me i did not have any problems...
I'll keep in touch
Thanks for your time man

One thing, how can whe insert a photo below our nick, here in the forum at the left side??

  See ya

                        monnie
Title:
Post by: Herodes on 07 August, 2004, 01:46:33
QuoteOriginally posted by monnie
One thing, how can whe insert a photo below our nick, here in the forum at the left side??

That pic in forum-talk is usualy called an "Avatar" ... Click on the top of any page on the button that says "Profile" and read throught the available options in there ...
Title: thanks....
Post by: monnie on 07 August, 2004, 03:17:24
Greetings

Thanks for the tip Herodes

                        monnie