IP net block ban script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gary

    #1

    IP net block ban script?

    I wish to add this to a few sites to make access irksome (rather than
    impossible of course) for users from certain IP address blocks. There are
    plenty of ready-made scripts for specific IP addresses, but I can't find any
    for doing this for a *range* of IP addresses. BTW, I can only use client
    side scripting.

    Any source of such a script appreciated.

    TIA
    Gary



  • Brian Genisio

    #2
    Re: IP net block ban script?

    Gary wrote:
    [color=blue]
    > I wish to add this to a few sites to make access irksome (rather than
    > impossible of course) for users from certain IP address blocks. There are
    > plenty of ready-made scripts for specific IP addresses, but I can't find any
    > for doing this for a *range* of IP addresses. BTW, I can only use client
    > side scripting.
    >
    > Any source of such a script appreciated.
    >
    > TIA
    > Gary
    >
    >
    >[/color]

    First, if any such beast exists for one IP, it can easily be modified
    for a range. No need to write something from scratch. What are some
    examples that you have found?

    Second, any/all client-side methods will fail... because it assumes that
    the user has already downloaded the page, in order to execute the
    javascript, therefore they have the code, and you cannot block them. If
    you figure something out, they can turn off javascript, or easily hack
    something.

    For instance, I can download all of your code, make a slight
    modification like replace if(trusted) with if(true)... or trusted =
    true... and I am on my way.

    It is not worth the effort... unless you do it server-side, which you
    say you cannot do.

    Brian

    Comment

    • Gary

      #3
      Re: IP net block ban script?


      "Brian Genisio" <BrianGenisio@y ahoo.com> wrote in message
      news:4032139b$1 @10.10.0.241...[color=blue]
      > Gary wrote:[/color]
      [color=blue]
      > First, if any such beast exists for one IP, it can easily be modified
      > for a range.[/color]

      It's not so easy (at least for me), given the dotted-decimal-notation of an
      IP address. Single IP addresses are a doddle, but within a range? I'll have
      to get busy with some octet routines....
      [color=blue]
      > Second, any/all client-side methods will fail... because it assumes that
      > the user has already downloaded the page, in order to execute the
      > javascript, therefore they have the code, and you cannot block them. If
      > you figure something out, they can turn off javascript, or easily hack
      > something.[/color]

      As I said, it's intended to be irritating, *not* a serious attempt at
      thwarting access. The group of users I wish to block *I know* are
      particularly clueless technically, so for them it will not be that easy ;-)

      Regards
      Gary



      Comment

      • Brian Genisio

        #4
        Re: IP net block ban script?

        Gary wrote:[color=blue]
        > "Brian Genisio" <BrianGenisio@y ahoo.com> wrote in message
        > news:4032139b$1 @10.10.0.241...
        >[color=green]
        >>Gary wrote:[/color]
        >
        >[color=green]
        >>First, if any such beast exists for one IP, it can easily be modified
        >>for a range.[/color]
        >
        >
        > It's not so easy (at least for me), given the dotted-decimal-notation of an
        > IP address. Single IP addresses are a doddle, but within a range? I'll have
        > to get busy with some octet routines....
        >
        >[/color]

        Ok, it would be useful to see the code you want to modify, but take a
        look at this *un-tested* code... it will check an IP for a range. If
        you want more testing capability, you might want to use a more
        sophisticated masking method, using bit-wise operators, and netmasks.
        Without really knowing what you want to do, here is an example.

        BTW, how are you getting the IP in the first place?
        Brian

        ////////////////////////////////////////////////////////////////
        myIp = "192.168.169.22 0";

        // Put the octets in an array
        myOctets = myIp.split(".") ;

        // Block 192.168.100.* to 192.168.200.*
        if((myOctets[0] == 192) && (myOctets[1] == 168) &&
        ((myOctets[2] >= 100) && (myOctets[2] <= 200)))
        {
        // Block code
        }





        Comment

        Working...