Page 1 of 2
1
2
LastLast
  1. #1

    Blocking an IP on a Website

    So I've got a weebly site that I'm running but I've got a really annoying troll posting in my comments, I have the trolls IP but I'm not sure if there's a way to block their ip address. Anyone know if I can do this?
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  2. #2
    Bloodsail Admiral time0ut's Avatar
    10+ Year Old Account
    Join Date
    Jan 2011
    Location
    US
    Posts
    1,089
    There are a number of ways. Can you tell us more about your architecture?

    Edit: sorry, read weebly as weekly. Researching...

  3. #3
    Quote Originally Posted by time0ut View Post
    There are a number of ways. Can you tell us more about your architecture?
    I'm using Weebly (its hosted on their servers) and I have tried playing around with various Javascripts in the settings/HTML code none of it seems to work I'm not sure if I did it right and I know weebly does not support htaccess. In terms of the actual posting I've got a blog on there and I'm trying to keep the troll out without hindering the actual users with passwords or approval only comments.
    Last edited by Derpleton; 2013-09-12 at 12:36 AM.
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  4. #4
    If you're running apache, add their IP or their IP range/subnet to the sites-available config for your website. You can also do this using an .htaccess file on pretty much all flavors of web hosting software. For more specifics just google yourself some details on how to do those that are more specific to your setup.

    I use the sites-available on my guild website to block out spam bots.

    ok, was posting this before you mentioned you can't edit .htaccess

    What do you have access to?
    "You six-piece Chicken McNobody."
    Quote Originally Posted by RICH816 View Post
    You are a legend thats why.

  5. #5
    The Lightbringer serenka's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    London.
    Posts
    3,380
    dragonmaw - EU

  6. #6
    Quote Originally Posted by serenka View Post
    I actually was playing around with this script and was unable to get it to block my ip I was testing with. I don't know if it was my bad implementation or not though.

    What do you have access to?
    HTML/CSS, file uploads and Search Engine Optomization, supposedly there is a way to get javascripts to work as well but haven't had any luck.
    Last edited by Derpleton; 2013-09-12 at 12:41 AM.
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  7. #7
    yeah if you can add javascript, you could easily add a JavaScript IP based redirect to google or something in the header for the website.

    Something like...

    <script type='text/javascript'>
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    if (yip == "troll's ip") {
    window.location = "http://www.google.com/";
    }
    </script>
    "You six-piece Chicken McNobody."
    Quote Originally Posted by RICH816 View Post
    You are a legend thats why.

  8. #8
    Bloodsail Admiral time0ut's Avatar
    10+ Year Old Account
    Join Date
    Jan 2011
    Location
    US
    Posts
    1,089
    Quote Originally Posted by serenka View Post
    Only if the spammer isn't technically savvy. It'd be trivial to put a break point in there and jump over that using a debugger.

    Unfortunately, I'm not seeing much you can do on Weebly about this as they don't appear to give you that kind of low level control. You might want to try their support though.
    Last edited by time0ut; 2013-09-12 at 12:43 AM.

  9. #9
    Quote Originally Posted by TradewindNQ View Post
    yeah if you can add javascript, you could easily add a JavaScript IP based redirect to google or something in the header for the website.

    Something like...

    <script type='text/javascript'>
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    if (yip == "troll's ip") {
    window.location = "http://www.google.com/";
    }
    </script>
    I can edit the header, thing is I've seen some weird ways of implementing the Javascript the way people seem to be doing it although it hasn't worked for me is by uploading a .js file to the HTML/CSS code section and then in the header code using scripts to load the JS libraries and call the file.

    - - - Updated - - -

    Quote Originally Posted by time0ut View Post
    Only if the spammer isn't technically savvy. It'd be trivial to put a break point in there and jump over that using a debugger.

    Unfortunately, I'm not seeing much you can do on Weebly about this as they don't appear to give you that kind of low level control. You might want to try their support though.
    Looks like I'll have to try, maybe I should also try toying with some basic Javascripts just to make sure I'm implementing correctly.
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  10. #10
    Bloodsail Admiral time0ut's Avatar
    10+ Year Old Account
    Join Date
    Jan 2011
    Location
    US
    Posts
    1,089
    Quote Originally Posted by Kcin14 View Post
    I can edit the header, thing is I've seen some weird ways of implementing the Javascript the way people seem to be doing it although it hasn't worked for me is by uploading a .js file to the HTML/CSS code section and then in the header code using scripts to load the JS libraries and call the file.

    - - - Updated - - -



    Looks like I'll have to try, maybe I should also try toying with some basic Javascripts just to make sure I'm implementing correctly.
    Try something like...

    <script type="text/javascript">
    alert('test');
    </script>

    If you did it right, you will see an alert box that says test pop up when you load the page.

    If you have control over the HTML, you can put that just about anywhere in the head or body and it should work.

  11. #11
    Quote Originally Posted by Nixx View Post
    I bet this thread is about Tradewind too.
    hahahaha

    don't ban my work ip!!
    "You six-piece Chicken McNobody."
    Quote Originally Posted by RICH816 View Post
    You are a legend thats why.

  12. #12
    Quote Originally Posted by time0ut View Post
    Try something like...

    <script type="text/javascript">
    alert('test');
    </script>

    If you did it right, you will see an alert box that says test pop up when you load the page.

    If you have control over the HTML, you can put that just about anywhere in the head or body and it should work.
    That worked but not how I thought it would, I had to embed the code to the page instead of editing the giant html code weebly provides, I'll try putting in the IP block script from earlier.

    Edit: The IP block did not work when done this way
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  13. #13
    Quote Originally Posted by Kcin14 View Post
    That worked but not how I thought it would, I had to embed the code to the page instead of editing the giant html code weebly provides, I'll try putting in the IP block script from earlier.

    Edit: The IP block did not work when done this way
    What does it report back if you use this code instead?

    <script type='text/javascript'>
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    alert(yip);
    </script>
    "You six-piece Chicken McNobody."
    Quote Originally Posted by RICH816 View Post
    You are a legend thats why.

  14. #14
    Quote Originally Posted by TradewindNQ View Post
    What does it report back if you use this code instead?

    <script type='text/javascript'>
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    alert(yip);
    </script>
    I did not get any feedback from the website whereas with the other code it opened a small window that did say Test every time I loaded the page
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  15. #15
    Well fuck

    try

    <script type="text/javascript">
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    alert(yip);
    </script>

    Maybe it's getting dicky with quotation marks.
    "You six-piece Chicken McNobody."
    Quote Originally Posted by RICH816 View Post
    You are a legend thats why.

  16. #16
    Quote Originally Posted by TradewindNQ View Post
    Well fuck

    try

    <script type="text/javascript">
    var yip2=java.net.InetAddress.getLocalHost();
    var yip=yip2.getHostAddress();
    alert(yip);
    </script>

    Maybe it's getting dicky with quotation marks.
    Nothing, After a few reloads I did re-embeded the "test" output one and it worked again
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  17. #17
    Bloodsail Admiral time0ut's Avatar
    10+ Year Old Account
    Join Date
    Jan 2011
    Location
    US
    Posts
    1,089
    If the user is sitting behind NAT (like a normal router) the browser probably won't know its public IP address. I've only ever seen that part done with a jsonp call to another service.

    Also, that java.net thing isn't valid JavaScript. That's why its not working.

    Try this:
    <script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
    <script type="text/javascript">alert(ip);</script>
    Last edited by time0ut; 2013-09-12 at 01:20 AM.

  18. #18
    Quote Originally Posted by time0ut View Post
    If the user is sitting behind NAT (like a normal router) the browser probably won't know its public IP address. I've only ever seen that part done with a jsonp call to another service.

    Also, that java.net thing isn't valid JavaScript. That's why its not working.

    Try this:
    <script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
    <script type="text/javascript">alert(ip);</script>
    Worked and displayed my IP
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

  19. #19
    Bloodsail Admiral time0ut's Avatar
    10+ Year Old Account
    Join Date
    Jan 2011
    Location
    US
    Posts
    1,089
    Quote Originally Posted by Kcin14 View Post
    Worked and displayed my IP
    Excellent. Then we simply need to combine this with Tradewind's original script like so:

    <script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
    <script type='text/javascript'>
    if (ip == "troll's ip") {
    alert('bye bye troll');
    window.location = 'http://www.google.com/';
    }
    </script>

    Try it with your IP first to make sure it works of course! If I recall correctly, the link serenka posted above gives an example of how to block multiple IP addresses. You will probably want to upgrade to something like that as many internet users have dynamic IPs that shift periodically. In other words, if your troll is persistent, you will have to ban multiple IPs as time goes on.
    Last edited by time0ut; 2013-09-12 at 01:25 AM.

  20. #20
    Quote Originally Posted by time0ut View Post
    Excellent. Then we simply need to combine this with Tradewind's original script like so:

    <script type="text/javascript" src="http://l2.io/ip.js?var=ip"></script>
    <script type='text/javascript'>
    if (ip == "troll's ip") {
    alert('bye bye troll');
    window.location = 'http://www.google.com/';
    }
    </script>
    Perfect! Worked like a charm, thanks a lot!
    Quote Originally Posted by cubby View Post
    The only lies here are the bullshit coming from you. RBG appears to be immortal.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •