Script to allow IP Range?
Moderator: Moderators
-
Oatmeal
- Posts: 1
- Joined: 2003-09-06 02:58
Script to allow IP Range?
Does anyone know of a script out there that would allow me to only allow ppl with a certain IP to gain access to my hub? (ie, I live on campus and all the computer's on it are given an IP of 141.109.*.* and I only want to allow these ppl to join)
-
GargoyleMT
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-08 02:46
- Location: .pa.us
-
whetu
- Posts: 1
- Joined: 2003-09-10 02:52
Re: Script to allow IP Range?
Oatmeal wrote:Does anyone know of a script out there that would allow me to only allow ppl with a certain IP to gain access to my hub? (ie, I live on campus and all the computer's on it are given an IP of 141.109.*.* and I only want to allow these ppl to join)
Yes, you are looking for IPBot, here's a quick copy and paste of my modified version with all but 2 of the allow ranges removed.
Code: Select all
'=====================================
' Direct Connect Hub IP Filter script
'-------------------------------------
' version: 1.0 (010629)
' author: [FF]yopo
' email: [email protected]
'=====================================
' This script will check users when
' connecting to the hub, and if the
' IP number is not in the oAllow list
' it will disconnect the client. You
' can also configure it to allow full
' A-, B- or C-subnets (see the
' examples below). It will also send
' a message to the user. The script
' is useful if you want to keep the
' hub open only for connection from a
' specific ISP, network or region.
'=====================================
Dim sBotName
Dim oAllow
Dim sRejectMessage
Sub Main()
Set oAllow = CreateObject("Scripting.Dictionary")
'Set these basic parameters
sBotName = "IPBotNZ" ' <- name of the bot
'The message to send to denied clients
sRejectMessage = "Sorry, no connections are allowed to those outside of New Zealand."
'Add new entries for each ip number or subnet you want to allow.
'Here are some examples of the syntax; the "descriptions" can be
'anything, except for an empty string. Remove the examples when
'you add your own.
oAllow("132.181.*") = "Uni"
oAllow("192.168.*") = "Home"
End Sub
Sub NewUserConnected(curUser)
Dim sIPfull
Dim sIPc, sIPb, sIPa
sIPfull = curUser.IP()
sIPc = Left(sIPfull, InStrRev(sIPfull, ".") - 1)
sIPb = Left(sIPc, InStrRev(sIPc, ".") - 1)
sIPa = Left(sIPb, InStrRev(sIPb, ".") - 1)
sIPa = sIPa & ".*"
sIPb = sIPb & ".*"
sIPc = sIPc & ".*"
If Not (curUser.bOperator Or oAllow.Exists(sIPfull) Or _
oAllow.Exists(sIPc) Or oAllow.Exists(sIPb) Or _
oAllow.Exists(sIPa)) Then
curUser.PrivateMessage CStr(sBotName), CStr(sRejectMessage)
frmHub.DoEventsForMe
curUser.Disconnect
End If
End Sub
Who is online
Users browsing this forum: Google [Bot] and 0 guests