PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: Aether on 09 November, 2008, 14:50:39

Title: IP Filter
Post by: Aether on 09 November, 2008, 14:50:39
Hi, i am looking for a script that can do the following

1. block/allow IP's by preset CIDR masks in the script
2. tell the user what ISP he is using (found by configuration)
3. a custom blocked message to send to users that the script blocks
4. allow (a. local addresses, b. ops) to skip filter

user that connects would see something like

Quote*** Connecting to host.name.com...
*** Connected
*** Stored password sent...
<TestHub> This hub is running PtokaX DC Hub 0.4.1.1 (UpTime: 123 days, 123 hours, 123 minutes / Users: 0)
<TestHub> Your IP is: 123.123.123.123 (ISP: InsertISPnameHere)
<TestHub> Welcome

Blocked users would get something like

Quote*** Connecting to host.name.com...
*** Connected
*** Stored password sent...
<TestHub> This hub is running PtokaX DC Hub 0.4.1.1 (UpTime: 123 days, 123 hours, 123 minutes / Users: 0)
<TestHub> Your IP is: 124.123.123.123 (ISP: Unknown)
<TestHub> Sorry but your ip is not in the list of recognised IP's, this hub only allows IP's from Icelandic ISP's
<TestHub> If you belive you recived this message in error please post a message on http://forums.name.com showing this message

i am no lua programmer and i have NO idea of what the syntax is but i was thinking about setting the ip's somehow like this

allowedips
{
isp1 = "the name that the user sees in one line (spaces allowed?)"
{
87.237.36.0/23
87.237.38.0/23
88.149.0.0/17
88.151.48.0/21
}
isp2 = "some stupid isp"
{
93.95.224.0/21
93.95.72.0/21
130.208.0.0/16
157.157.0.0/16
157.157.139.0/24
192.147.34.0/24
}
}


if this is something impossible, tell me... :(
if not, i would be insanely thankful if someone could take the time to make it :D
if it already exists (has to take CIDR) then i could most likely use that :)

i can live without the showing isp part :P
Title: Re: IP Filter
Post by: Aether on 09 November, 2008, 15:02:18
Quote from: Mutor on 09 November, 2008, 15:01:00
RangeFilter 1.0g LUA 5.11 [Strict] [API 2] does much of what you request.
Alas it has no regard for CIDR. I'm not aware of any script that does.
do you have an url to that script ?
Title: Re: IP Filter
Post by: bastya_elvtars on 09 November, 2008, 16:36:48
RangeFucker is aware of CIDR just has not been updated. If you would be so kind as to drop me a message in my forum, I would look into updating it and adding ISP functionality.