generating Geoipcountrywhois.csv

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
mythdl
Posts: 12
Joined: 2003-09-07 03:11

generating Geoipcountrywhois.csv

Post by mythdl » 2005-02-02 22:08

How is this file generated (it is different from the one on the maxmind site, i understand you do not use their API at all). From what i can see you have removed everything except the 32-bit 'end' value for each range and the country code and ordered it by this 'end' value. Is this correct?
Original maxmind format: (the 'end' value i refer to is the one just before the country code)

Code: Select all

"2.6.190.56","2.6.190.63","33996344","33996351","GB","United Kingdom"
"3.0.0.0","4.18.32.71","50331648","68296775","US","United States"
"4.18.32.72","4.18.32.79","68296776","68296783","MX","Mexico"
"4.18.32.80","4.18.65.255","68296784","68305407","US","United States"

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-02-03 13:46

It seems that way. The country code was contributed by someone else, see:

Code: Select all

 -- 0.402 2004-06-27 --
* User country shown in ip field (thanks pofis)

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2005-02-03 15:51

perl is your friend ;)

Code: Select all

[0:wza:g]$ cat in
"2.6.190.56","2.6.190.63","33996344","33996351","GB","United Kingdom"
"3.0.0.0","4.18.32.71","50331648","68296775","US","United States"
[0:wza:g]$ cat in |perl -e 'for(<>){/^([^,]*,){3}"(\d+)","(..).*$/;print "$2,$3\n";}'
33996351,GB
68296775,US
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

mythdl
Posts: 12
Joined: 2003-09-07 03:11

Post by mythdl » 2005-02-03 22:11

If it really is a list of the 'end' values, then why does the DC++ code usesstd::map::lower_bound to look up the code, shouldn't it use upper_bound? If this is a bug it would not be very noticable because most countries ranges are close together and because the geoip database has inaccuracies

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2005-02-04 08:30

no
Returns an iterator pointing to the first element whose key is not less than k. Returns a.end() if no such element exists.
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2005-02-05 02:07

Sedulus: "man cut" ;))

Otherwise:

Code: Select all

$ python -c "for line in open('GeoIPCountryWhois.csv'): print '%(3)s,%(4)s' % dict(map(None,map(str,range(6)),line.strip().replace('\"','').split(',')))"
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Locked