tool:geoip
<title>GeoIP 지오IP</title>
GeoIP
GeoIP 검사시, 숫자로 변경 하는 방식
- from 링크
CSV 파일 포맷:
"begin_ip","end_ip","begin_num","end_num","country","name" "61.88.0.0","61.91.255.255","1029177344","1029439487","AU","Australia" "61.92.0.0","61.93.255.255","1029439488","1029570559","HK","Hong Kong" "61.94.0.0","61.94.7.255","1029570560","1029572607","ID","Indonesia"
Beginning IP Number, Ending IP Number의 계산 방법:
ipnum = 16777216*w + 65536*x + 256*y + z where IP Address = w.x.y.z
숫자에서 IP로 변경하는 방식:
w = int ( ipnum / 16777216 ) % 256; x = int ( ipnum / 65536 ) % 256; y = int ( ipnum / 256 ) % 256; z = int ( ipnum ) % 256; Where % is the mod operator.
Here is sample Perl code to convert the IP number to a IP address:
sub numToStr { my ($ipnum) = @_; my $z = $ipnum % 256; $ipnum >>= 8; my $y = $ipnum % 256; $ipnum >>= 8; my $x = $ipnum % 256; $ipnum >>= 8; my $w = $ipnum % 256; return "$w.$x.$y.$z"; }
SQL Query
SELECT ip_country FROM geoip WHERE 404232216 BETWEEN begin_ip_num AND end_ip_num LIMIT 1
MySQL Query
SELECT ip_country FROM geoip WHERE 404232216 >= begin_ip_num AND 404232216 <= end_ip_num LIMIT 1
tool/geoip.txt · 마지막으로 수정됨: 2024/04/23 22:43 저자 127.0.0.1