IP Finder
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: IP Finder
I need help understanding what you mean
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
-
- Average Program
- Posts: 85
- Joined: Wed Sep 27, 2006 11:49 pm
- Location: SLC Utah (NY FOR LIFE THO)
- Contact:
Re: IP Finder
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.
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: IP Finder
Every forum has those
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
Re: IP Finder
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.
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
Re: IP Finder
that would be nice, i don't know anything about coding
- Desolate
- Shutout Match Winner
- Posts: 1021
- Joined: Sat Apr 26, 2008 2:31 pm
- Location: Probably golfing
Re: IP Finder
Oh and now your sig is related to this, lol, it looks pretty cool. I like the cop cycle.
Re: IP Finder
thanks i make a better one when i have more time ^^
-
- Average Program
- Posts: 85
- Joined: Wed Sep 27, 2006 11:49 pm
- Location: SLC Utah (NY FOR LIFE THO)
- Contact:
Re: IP Finder
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!
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!
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
Re: IP Finder
Here's some concept php.
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.
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.
?>
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
Re: IP Finder
thank you
Re: IP Finder
would it be possible if you just type the name of a player and it shows you under what names he played?
-
- Average Program
- Posts: 85
- Joined: Wed Sep 27, 2006 11:49 pm
- Location: SLC Utah (NY FOR LIFE THO)
- Contact:
Re: IP Finder
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
Re: IP Finder
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.Slov wrote:would it be possible if you just type the name of a player and it shows you under what names he played?
Re: IP Finder
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 ...
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 ...
Re: IP Finder
Titanoboa wrote: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.Slov wrote:would it be possible if you just type the name of a player and it shows you under what names he played?
i dont actually like this idea i was just asking if that will be possible in future ... gotta agree with g5G5 wrote: The IP address lookup should be private or for admins only ...