Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Get my IP, Ninja! - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Get my IP, Ninja!

2

Comments

  • I created my own. One line of php:

    echo $_SERVER['REMOTE_ADDR'];

  • @Abdussamad said:
    I created my own. One line of php:

    echo $_SERVER['REMOTE_ADDR'];

    Sure supports both ipv4 and ipv6 at the same time doesn't it.... Ohh wait it doesn't.

    Why not go fuck off.

    Thanked by 1k0nsl
  • @Mun said:

    Yes, it does.

    REMOTE_ADDR is set by the web server. Therefore if your web server is listening on IPv6 it will display the IPv6 IP address of the client if the client has IPv6. If your web server doesn't listen on IPv6 it will not display the clients IPv6.

  • @FVPS NO SHIT!

    Reread what I wrote idiot. I said:

    Mun said: both ipv4 and ipv6 at the same time

    It only does what ever IP is actively pulling and not both IPv4 and IPv6 if you are doing dual stacks.

    i.e. the code he posted will only do this:

  • @Mun said:

    You seem very furious. Or atleast your mood is a bit atrocious. No need to be so vulgar.

    The problem with dual stack is the dazzling idea of having IPv6 as the preferred protocol over IPv4 with brilliant fallback to IPv4 within a second.

    If you open up your exquisite mind you can make it work they way you want. Althought I'm terrified that it's a bit more work than that one line of PHP but it's not so colossal.

  • @FVPS said:
    If you open up your exquisite mind you can make it work they way you want. Althought I'm terrified that it's a bit more work than that one line of PHP but it's not so colossal.

    The point was someone was making an argument that they replaced @mpkossen's page with one line of code. When you can't. He over simplified an issue, and just was being obnoxious. "Look how high and mighty I am."

    Thanked by 2Mark_R mpkossen
  • LeeLee Veteran

    FVPS said: If you open up your exquisite mind you can make it work they way you want.

    Yep, but to be fair, you were wrong. Let's not try and talk our way out of it.

    Thanked by 1mpkossen
  • FVPSFVPS Member
    edited February 2016

    @Mun said:
    The point was someone was making an argument that they replaced mpkossen's page with one line of code. When you can't. He over simplified an issue, and just was being obnoxious. "Look how high and mighty I am."

    That's true. That one line won't be enough. for that.

    @Lee I am wrong? Oh. Well, setup a web server yourself. Make a vhost with both IPv4/IPv6, one for IPv4 only and another one for IPv6 only. Use the oneliner and see which IP addresses you get. I'm pretty sure it is as I said.

    Otherwise. Yes, I am wrong because that one line of code will of course not show both IP addresses because of the IPv6 preference in dual stack. But I already said that in a reply to Mun's comment.

    The problem with dual stack is the dazzling idea of having IPv6 as the preferred protocol over IPv4 with brilliant fallback to IPv4 within a second.

  • exception0x876exception0x876 Member, Host Rep, LIR
    edited February 2016

    very nice tool! basically what it does is pulling $_SERVER['REMOTE_ADDR'] (PHP example) and in case it is IPv6 querying IPv4 subdomain via javascript for IPv4 address..

    Thanked by 3FVPS 5n1p mpkossen
  • FVPSFVPS Member
    edited February 2016

    @exception0x876 said:
    very nice tool! basically what it does is pulling $_SERVER['REMOTE_ADDR'] (PHP example) and in case it is IPv6 querying IPv4 subdomain via javascript for IPv4 address..

    Yes, exactly. Something like this is what I had in mind. It's possible and not so colossal. I wanted to write something until I realized I don't have IPv6 and my ISP is dropping ICMP so that I cannot setup a IPv6 tunnel. Dayum...

  • ZappieZappie Member, Host Rep, LIR

    mpkossen said: Today I'm proud to present to you: Get my IP, Ninja!

    >

    I like the name choice! good work.

    Thanked by 1mpkossen
  • I found this sometime ago on vpsboard:

    <?php
    if (! isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $client_ip = $_SERVER['REMOTE_ADDR'];
    }
    else {
    $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    echo "$client_ip"
    ?>
    
    Thanked by 2mpkossen thagoat
  • FVPS said: Otherwise. Yes, I am wrong because that one line of code will of course not show both IP addresses because of the IPv6 preference in dual stack.

    That's not the reason. It has absolutely nothing to do with IPv6 preference, if such a thing even exists.

    The protocol used to make the connection establishes which IP is being used by PHP. It's never two at the same time. As a result of that, it's not possible to list both the IPv4 and IPv6 address using PHP's REMOTE_ADDRESS at the same time in a single request.

    @GM2015 said:
    I found this sometime ago on vpsboard:

    > <?php
    > if (! isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    > $client_ip = $_SERVER['REMOTE_ADDR'];
    > }
    > else {
    > $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    > }
    > echo "$client_ip"
    > ?>
    > 

    It gets the HTTP_X_FORWARDED_FOR in case it's there and displays it below the REMOTE_ADDRESS information.

  • GM2015GM2015 Member
    edited February 2016

    Yes. I use it in case I want to know my IP from terminal with curl. -4 and -6 flags are great for ipv4 and ipv6.

    I just pasted it there if someone wants to "self-host" it.

    ifconfig.co is also great with curl -4 ifconfig.co and curl -6 ifconfig.co

    ifconfig.co can be self-hosted https://github.com/martinp/ifconfigd

    mpkossen said: It gets the HTTP_X_FORWARDED_FOR in case it's there and displays it below the REMOTE_ADDRESS information.

  • FVPSFVPS Member
    edited February 2016

    mpkossen said: That's not the reason. It has absolutely nothing to do with IPv6 preference, if such a thing even exists.

    The protocol used to make the connection establishes which IP is being used by PHP. It's never two at the same time. As a result of that, it's not possible to list both the IPv4 and IPv6 address using PHP's REMOTE_ADDRESS at the same time in a single request.

    REMOTE_ADDR is a web server environment information and is therefore set by the web server. PHP is reading REMOTE_ADDR from the web server but it's not setting it.

    $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here.

    Source: http://php.net/manual/en/reserved.variables.server.php

    Correct, it is never two addresses at the same time. I already said that I made a mistake there to Mun. But the problem is not PHP or the environment variable. The problem is the stack that is used.

    If your server is setup with dual stack and the client has dual stack: both server and client will communicate over IPv6 because IPv6 is preferred over IPv4.

    IPv6 stack is preferred by default, since on a dual-stack machine IPv6 socket can talk to both IPv4 and IPv6 peers.

    Source: https://docs.oracle.com/javase/1.5.0/docs/guide/net/ipv6_guide/
    More: http://tools.ietf.org/html/rfc6724 , https://tools.ietf.org/html/rfc3484

    This can be changed with a few tricks and you can make IPv4 to be the preferred protocol but by default it's IPv6 that is preferred.

    You did the right thing in your script. You've setup a IPv6 only stack vHost that gets called via AJAX to get the IPv6 addresses of the client after the default IPv4 vHost was called.

  • So can both addresses then be shown if you iframe an ipv4 only page?

    FVPS said: You did the right thing in your script. You've setup a IPv6 only stack vHost that gets called via AJAX to get the IPv6 addresses of the client after the default IPv4 vHost was called.

  • @GM2015 said:
    So can both addresses then be shown if you iframe an ipv4 only page?

    iframe would work but it's a squalid solution in my opinion. mpkossen used a Ajax approach that is much more spotless and exquisite.

    http://pastebin.com/435k98eD

  • 0/10 no HTTPS.

    Thanked by 1ATHK
  • I use this one since it is easy to remember and literally just returns the IP http://my.ip.fi/

    Thanked by 1Four20
  • godonggodong Member
    edited February 2016

    @mpkossen Nice work ... I did my own version of this here: http://ip.ms ... Fun little project :) And no piwik tracking as well... @trvz can I get 10/10 for HTTPS ... using keycdn's letsencrypt cert.

    Thanked by 1Four20
  • roykemroykem Member
    edited February 2016

    @mpkossen nice share! I'm opened it using chrome with data saver enabled, your page returned google proxy IP address instead my provider IP.

    This said just to let you know the result in my mobile chrome browser.

  • @roykem said:
    mpkossen nice share! I'm opened it using chrome with data saver enabled, your page returned google proxy IP address instead my provider IP.

    This said just to let you know the result in my mobile chrome browser.

    That is how it should work if you are using a proxy.

    Thanked by 1mpkossen
  • i always use https://ipleak.net/ it can show my ip, dns , webrtc etc .. the interface also clean ( only small banner ads at top right )

  • @Mun seems to have flown off the handle over my little post. Actually I use icanhazip most of the time and I saw people were discussing that sort of thing in the comments before mine so I thought I'd make my own. It's got nothing to do with @mpkossen's script. I never even visited his site.

  • For such a simple and lightweight website, why bother with Bootstrap and a load of JavaScript?

  • @hostnoob said:
    For such a simple and lightweight website, why bother with Bootstrap and a load of JavaScript?

    Here was my attempt: http://jonathan.chun.io/chunip/

  • @trvz said:
    0/10 no HTTPS.

    This is the one type of site where HTTPS would not matter at all given that it shows information that is always sent unencrypted anyway. Then again, it is probably going to happen in the future.

    @hostnoob said:
    For such a simple and lightweight website, why bother with Bootstrap and a load of JavaScript?

    Easy styling plus the JS was needed anyway for it to work.

Sign In or Register to comment.