IP Finder

General Stuff about Armagetron, That doesn't belong anywhere else...
Post Reply

Do you object to this?

Yes
25
51%
No.
18
37%
I don't care.
6
12%
 
Total votes: 49

User avatar
AI-team
Shutout Match Winner
Posts: 1021
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: IP Finder

Post by AI-team »

I need help understanding what you mean :<
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 

Sinn
Average Program
Posts: 85
Joined: Wed Sep 27, 2006 11:49 pm
Location: SLC Utah (NY FOR LIFE THO)
Contact:

Re: IP Finder

Post by Sinn »

Well for most admins or server hosts there is no IP privacy anyway. I'm not sure about now but on our old forums we had hundres of IP's and player names to go with it.
The truth is out there.

Image

Uploaded with ImageShack.us

User avatar
AI-team
Shutout Match Winner
Posts: 1021
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: IP Finder

Post by AI-team »

Every forum has those
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 

User avatar
Jonathan
A Brave Victim
Posts: 3392
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: IP Finder

Post by Jonathan »

The thing is, this is a central database everyone can use easily. Definitely privacy-worthy. If others do it with less privacy, it isn't any better.

Regarding IP addresses, they're really binary 32-bit numbers. Address ranges are also defined by a bit mask, so that's really the best way to check a range.

Could you do it, Word? Or should I help? I could code some things.
ˌɑrməˈɡɛˌtrɑn

Word
Reverse Adjust Outside Corner Grinder
Posts: 4183
Joined: Wed Jan 07, 2009 6:13 pm

Re: IP Finder

Post by Word »

that would be nice, i don't know anything about coding :/

User avatar
Desolate
Shutout Match Winner
Posts: 999
Joined: Sat Apr 26, 2008 2:31 pm
Location: Probably golfing

Re: IP Finder

Post by Desolate »

Oh and now your sig is related to this, lol, it looks pretty cool. I like the cop cycle.

Word
Reverse Adjust Outside Corner Grinder
Posts: 4183
Joined: Wed Jan 07, 2009 6:13 pm

Re: IP Finder

Post by Word »

thanks i make a better one when i have more time ^^

Sinn
Average Program
Posts: 85
Joined: Wed Sep 27, 2006 11:49 pm
Location: SLC Utah (NY FOR LIFE THO)
Contact:

Re: IP Finder

Post by Sinn »

Well I think this will be great. Instead of having to go around and find server hosts or admins and say "hey do you have a face with this IP?" we can just use this to do it ourselves.

I believe we have all had times when there are people causing problems under alias, or maybe someone has applied to your clan and you just want to see if it's a trouble maker or someone who is already in another clan or whatever.

I'm really excited to give this thing a try!
The truth is out there.

Image

Uploaded with ImageShack.us

User avatar
Jonathan
A Brave Victim
Posts: 3392
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: IP Finder

Post by Jonathan »

Here's some concept php.

Code: Select all

<?php

header('Content-Type: text/plain');

// If you can't communicate 32-bit unsigned ints to your database, try setting this to true.
// It will subtract 2^31 from values, so you can use signed ints instead.
// The code below also adds it back when displaying a value, so it's completely transparent.
// I'm not sure if it's ever needed, but it's there, just in case.
$signed_database = false;
$signed_database_bias = -2147483648 * $signed_database;

// How specific ranges must be.
// 0 = you can check all possible addresses at once (x.x.x.x)
// 8 = 192.x.x.x
// 16 = 192.168.x.x
// 24 = 192.168.1.x
// 32 = single addresses only (192.168.1.123)
// Anything in between works correctly, as well. Example:
// 12 = 192.[160,175].x.x
$min_netbits = 18;

function parse_address($str) {
    global $signed_database_bias;
    if (!preg_match('/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/', $str, $matches))
        return false;
    // Regex data: 1.2.3.4
    $address = 0;
    for ($i=1; $i<5; ++$i) {
        $part = (float)$matches[$i];
        if ($part > 255)
            return false;
        $address = 256 * $address + $part;
    }
    $address += $signed_database_bias;
    return $address;
}

function parse_address_range($str, $min_netbits=0) {
    global $signed_database_bias;
    if (!preg_match('/^(([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?(\/([0-9]+))?$/', $str, $matches))
        return false;
    // Regex data: 2.4.6.8/10
    $address = 0;
    $netbits = 32;
    // Parts not found will be null or the empty string.
    // strlen conveniently tells if there was a match.
    for ($i=2; $i<10; $i+=2) {
        if (!strlen($matches[$i]) && $netbits == 32)
            $netbits = 4 * $i - 8;
        $part = (float)$matches[$i];
        if ($part > 255)
            return false;
        $address = 256 * $address + $part;
    }
    // $netbits is now the number of bits of the parts that were specified.
    // If a specific value was provided, override.
    if (strlen($matches[10])) {
        $netbits = (float)$matches[10];
        if ($netbits > 32)
            return false;
    }
    $used_netbits = max($netbits, $min_netbits);
    $netmask = $used_netbits ? -(1 << (32 - $used_netbits)) : 0;
    // Not sure how shifting by 32 works on 32-bit php, but the special case above will handle it.
    $range_begin = $address & $netmask; // Fill host part with zeros.
    $range_end = $address | ~$netmask; // Fill host part with ones.
    // This could be negative. Fix that.
    if ($range_begin < 0)
        $range_begin += 4294967296;
    if ($range_end < 0)
        $range_end += 4294967296;
    $range_begin += $signed_database_bias;
    $range_end += $signed_database_bias;
    return array('begin' => $range_begin, 'end' => $range_end, 'netbits' => $netbits, 'used_netbits' => $used_netbits);
    // Use netbits (or possibly end - begin) to check the range.
    // begin and end can be used to access a database like this: address >= begin and address <= end
}

// Use this to show an address to the user.
function address_to_dotted_decimal($address) {
    global $signed_database_bias;
    $address -= $signed_database_bias;
    $str = '';
    for ($i=0; $i<4; ++$i) {
        if ($i)
            $str .= '.';
        $str .= $address >> (24 - 8 * $i) & 255;
    }
    return $str;
}

$address = parse_address($_GET['address']);
if ($address === false)
    echo "No valid address found\n";
else {
    echo "Address: $address\n";
    echo "Dotted decimal again: ".address_to_dotted_decimal($address)."\n";
}

// Basic usage for the user would be to enter the address followed by /20 or whatever range they'd like to check.
// If you don't specify anything after the address, /32 is assumed for a full address, so only that exact address will match.
// If you don't specify a full address, like 192.168.1, a smaller value is used automatically, /24 in this case.
$range = parse_address_range($_GET['range'], $min_netbits);
if ($range === false)
    echo "No valid range found\n";
else {
    if ($range['netbits'] != $range['used_netbits']) {
        echo "Range is too large. You specified $range[netbits] bits, whereas it should've been at least ";
        echo "$range[used_netbits]. It has been increased automatically to keep the range within limits.\n";
        // Alternately, just fail instead of reducing the range, but I think people would rather see what they *can* get immediately.
    }
    echo "Range: [$range[begin], $range[end]]\n";
    // You might want to show the following to the user. It'll make it obvious which range was used.
    echo "Dotted decimal range: [".address_to_dotted_decimal($range['begin']).", ".address_to_dotted_decimal($range['end'])."]\n";
}

// Things to try:
// - On the list of matches, display the smallest subnet containing both the queried and found addresses. A good indicator of actual closeness.
// - Let the user specify just a plain address, and search a predefined range. Combine with the above. Probably easier to use for most.

?>
In this form the user should normally specify the address followed by a slash and the number of network bits they'd like to check, like 192.168.1.123/20 (the code can enforce a lower limit, $min_netbits). Things like 192.168.1 will also produce sane results. If you know your networking you can specify anything in slash notation and get what you expect.

As I said in the final comment, it could be a good idea to only take an address and use a predefined range. That way the user doesn't need to worry about any details like picking a good range. Besides, you don't always know the right range anyway, so it's good to check a large range, and then judge matches based on the displayed closeness. I might make an example later.
ˌɑrməˈɡɛˌtrɑn

Word
Reverse Adjust Outside Corner Grinder
Posts: 4183
Joined: Wed Jan 07, 2009 6:13 pm

Re: IP Finder

Post by Word »

:o thank you

User avatar
Slov
Shutout Match Winner
Posts: 934
Joined: Sun May 10, 2009 12:32 pm

Re: IP Finder

Post by Slov »

would it be possible if you just type the name of a player and it shows you under what names he played?
.pG (only like, the best clan ever)

my mixtape fire tho

Sinn
Average Program
Posts: 85
Joined: Wed Sep 27, 2006 11:49 pm
Location: SLC Utah (NY FOR LIFE THO)
Contact:

Re: IP Finder

Post by Sinn »

ok that post just lost me. If your gonna start talkin in that language i'm outa here lol. I don't understand a thing :o
The truth is out there.

Image

Uploaded with ImageShack.us

User avatar
Titanoboa
Reverse Outside Corner Grinder
Posts: 1791
Joined: Sun Feb 22, 2009 8:07 pm

Re: IP Finder

Post by Titanoboa »

Slov wrote:would it be possible if you just type the name of a player and it shows you under what names he played?
If a player is troubling you on your servers or your forums, you'll have his IP. If he's troubling you anywhere else, take it to the admins of that place.

User avatar
G5
Average Program
Posts: 62
Joined: Mon May 01, 2006 2:24 pm
Location: Stuttgart, Germany

Re: IP Finder

Post by G5 »

Is anyone really interested in the IP address? I think no. What people do wanna know is what aliases a certain player used. So in my opinion the interface should take a player name and respond with the other names that were used on this corresponding IP address (or a small range like 16 bits).
But even then it may be incorrect. Look at my IP address range: There are variations of G5 and Nurf (you all know that was me), but also electro and John (both not me).
The IP address lookup should be private or for admins only ...

User avatar
Slov
Shutout Match Winner
Posts: 934
Joined: Sun May 10, 2009 12:32 pm

Re: IP Finder

Post by Slov »

Titanoboa wrote:
Slov wrote:would it be possible if you just type the name of a player and it shows you under what names he played?
If a player is troubling you on your servers or your forums, you'll have his IP. If he's troubling you anywhere else, take it to the admins of that place.
G5 wrote: The IP address lookup should be private or for admins only ...
i dont actually like this idea i was just asking if that will be possible in future ... gotta agree with g5 :rat:
.pG (only like, the best clan ever)

my mixtape fire tho

Post Reply