Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
268a39fb
Kaydet (Commit)
268a39fb
authored
Haz 15, 1995
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
converted to python
üst
f1945466
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
124 deletions
+123
-124
world
Tools/world/world
+123
-124
No files found.
Tools/world/world
Dosyayı görüntüle @
268a39fb
#! /depot/
gnu/plat/bin/perl
#! /depot/
sundry/plat/bin/python
#
# Note: you may have to edit the top line in this file.
#
...
...
@@ -14,133 +14,132 @@
# the speed in which political boundaries are changing these days, no
# doubt there are some incorrect mappings.
$prog
=
$0
;
$ARGV
[
0
]
||
die
"No addresses provided.\nUsage: $prog addr1 [addr2 ...]\n"
;
import
sys
prog
=
sys
.
argv
[
0
]
del
sys
.
argv
[
0
]
if
not
sys
.
argv
:
print
"No addresses provided.
\n
Usage:"
,
prog
,
"addr1 [addr2 ...]
\n
"
# The mappings
%
nameorg
=
(
"arpa"
,
"Arpanet"
,
'com'
,
'commercial'
,
'edu'
,
'educational'
,
'gov'
,
'government'
,
'mil'
,
'military'
,
'net'
,
'networking'
,
'org'
,
'non-commercial'
,
'int'
,
'international'
);
nameorg
=
{
"arpa"
:
"Arpanet"
,
"com"
:
"commercial"
,
"edu"
:
"educational"
,
"gov"
:
"government"
,
"mil"
:
"military"
,
"net"
:
"networking"
,
"org"
:
"non-commercial"
,
"int"
:
"international"
}
%
country
=
(
"ag"
,
"Antigua and Barbuda"
,
"al"
,
"Albania"
,
"aq"
,
"Antarctica"
,
"ar"
,
"Argentina"
,
"at"
,
"Austria"
,
"au"
,
"Australia"
,
"bb"
,
"Barbados"
,
"be"
,
"Belgium"
,
"bg"
,
"Bulgaria"
,
"bo"
,
"Bolivia"
,
"br"
,
"Brazil"
,
"bs"
,
"Bahamas"
,
"bz"
,
"Belize"
,
"ca"
,
"Canada"
,
"ch"
,
"Switzerland"
,
"cl"
,
"Chile"
,
"cm"
,
"Cameroon"
,
"cn"
,
"China"
,
"co"
,
"Colombia"
,
"cr"
,
"Costa Rica"
,
"cy"
,
"Cyprus"
,
"cz"
,
"Czech Republic"
,
"de"
,
"Germany"
,
"dk"
,
"Denmark"
,
"dm"
,
"Dominica"
,
"do"
,
"Dominican Republic"
,
"ec"
,
"Ecuador"
,
"ee"
,
"Estonia"
,
"eg"
,
"Egypt"
,
"es"
,
"Spain"
,
"fi"
,
"Finland"
,
"fj"
,
"Fiji"
,
"fr"
,
"France"
,
"gb"
,
"Great Britain"
,
"gh"
,
"Ghana"
,
"gr"
,
"Greece"
,
"hk"
,
"Hong Kong"
,
"hr"
,
"Croatia"
,
"hu"
,
"Hungary"
,
"id"
,
"Indonesia"
,
"ie"
,
"Ireland"
,
"il"
,
"Israel"
,
"in"
,
"India"
,
"is"
,
"Iceland"
,
"it"
,
"Italy"
,
"jm"
,
"Jamaica"
,
"jp"
,
"Japan"
,
"km"
,
"Comoros"
,
"kn"
,
"Saint Kitts and Nevis"
,
"kr"
,
"Republic of Korea"
,
"kw"
,
"Kuwait"
,
"lc"
,
"Saint Lucia"
,
"li"
,
"Liechtenstein"
,
"lk"
,
"Sri Lanka"
,
"lu"
,
"Luxembourg"
,
"lv"
,
"Latvia"
,
"my"
,
"Malaysia"
,
"mx"
,
"Mexico"
,
"na"
,
"Namibia"
,
"ni"
,
"Nicaragua"
,
"nl"
,
"Netherlands"
,
"no"
,
"Norway"
,
"nz"
,
"New Zealand"
,
"pe"
,
"Peru"
,
"pg"
,
"Papua New Guinea"
,
"ph"
,
"Philippines"
,
"pl"
,
"Poland"
,
"pr"
,
"Puerto Rico"
,
"pt"
,
"Portugal"
,
"py"
,
"Paraguay"
,
"ro"
,
"Romania"
,
"se"
,
"Sweden"
,
"sg"
,
"Singapore"
,
"si"
,
"Slovenia"
,
"sk"
,
"Slovakia"
,
"sr"
,
"Suriname"
,
"su"
,
"USSR"
,
"tw"
,
"Taiwan"
,
"th"
,
"Thailand"
,
"tn"
,
"Tunisia"
,
"tr"
,
"Turkey"
,
"tt"
,
"Trinidad and Tobago"
,
"uk"
,
"United Kingdom"
,
"us"
,
"United States"
,
"uy"
,
"Uruguay"
,
"vc"
,
"Saint Vincent and the Grenadines"
,
"ve"
,
"Venezuela"
,
"vi"
,
"Virgin Islands"
,
"yu"
,
"Yugoslavia"
,
"za"
,
"South Africa"
,
"zw"
,
"Zimbabwe"
);
country
=
{
"ag"
:
"Antigua and Barbuda"
,
"al"
:
"Albania"
,
"aq"
:
"Antarctica"
,
"ar"
:
"Argentina"
,
"at"
:
"Austria"
,
"au"
:
"Australia"
,
"bb"
:
"Barbados"
,
"be"
:
"Belgium"
,
"bg"
:
"Bulgaria"
,
"bo"
:
"Bolivia"
,
"br"
:
"Brazil"
,
"bs"
:
"Bahamas"
,
"bz"
:
"Belize"
,
"ca"
:
"Canada"
,
"ch"
:
"Switzerland"
,
"cl"
:
"Chile"
,
"cm"
:
"Cameroon"
,
"cn"
:
"China"
,
"co"
:
"Colombia"
,
"cr"
:
"Costa Rica"
,
"cy"
:
"Cyprus"
,
"cz"
:
"Czech Republic"
,
"de"
:
"Germany"
,
"dk"
:
"Denmark"
,
"dm"
:
"Dominica"
,
"do"
:
"Dominican Republic"
,
"ec"
:
"Ecuador"
,
"ee"
:
"Estonia"
,
"eg"
:
"Egypt"
,
"es"
:
"Spain"
,
"fi"
:
"Finland"
,
"fj"
:
"Fiji"
,
"fr"
:
"France"
,
"gb"
:
"Great Britain"
,
"gh"
:
"Ghana"
,
"gr"
:
"Greece"
,
"hk"
:
"Hong Kong"
,
"hr"
:
"Croatia"
,
"hu"
:
"Hungary"
,
"id"
:
"Indonesia"
,
"ie"
:
"Ireland"
,
"il"
:
"Israel"
,
"in"
:
"India"
,
"is"
:
"Iceland"
,
"it"
:
"Italy"
,
"jm"
:
"Jamaica"
,
"jp"
:
"Japan"
,
"km"
:
"Comoros"
,
"kn"
:
"Saint Kitts and Nevis"
,
"kr"
:
"Republic of Korea"
,
"kw"
:
"Kuwait"
,
"lc"
:
"Saint Lucia"
,
"li"
:
"Liechtenstein"
,
"lk"
:
"Sri Lanka"
,
"lu"
:
"Luxembourg"
,
"lv"
:
"Latvia"
,
"my"
:
"Malaysia"
,
"mx"
:
"Mexico"
,
"na"
:
"Namibia"
,
"ni"
:
"Nicaragua"
,
"nl"
:
"Netherlands"
,
"no"
:
"Norway"
,
"nz"
:
"New Zealand"
,
"pe"
:
"Peru"
,
"pg"
:
"Papua New Guinea"
,
"ph"
:
"Philippines"
,
"pl"
:
"Poland"
,
"pr"
:
"Puerto Rico"
,
"pt"
:
"Portugal"
,
"py"
:
"Paraguay"
,
"ro"
:
"Romania"
,
"se"
:
"Sweden"
,
"sg"
:
"Singapore"
,
"si"
:
"Slovenia"
,
"sk"
:
"Slovakia"
,
"sr"
:
"Suriname"
,
"su"
:
"USSR"
,
"tw"
:
"Taiwan"
,
"th"
:
"Thailand"
,
"tn"
:
"Tunisia"
,
"tr"
:
"Turkey"
,
"tt"
:
"Trinidad and Tobago"
,
"uk"
:
"United Kingdom"
,
"us"
:
"United States"
,
"uy"
:
"Uruguay"
,
"vc"
:
"Saint Vincent and the Grenadines"
,
"ve"
:
"Venezuela"
,
"vi"
:
"Virgin Islands"
,
"yu"
:
"Yugoslavia"
,
"za"
:
"South Africa"
,
"zw"
:
"Zimbabwe"
}
while
(
$addr
=
shift
@ARGV
)
{
(
$_
)
=
$addr
=~
/\.(.*)$/
;
$_
=
$addr
if
!
$_
;
import
string
if
(
$nameorg
{
$_
})
{
# its one of the `special' USA organizational domains
print
"$addr is from a USA $nameorg{$_} organization\n"
;
}
elsif
(
$country
{
$_
})
{
# its a country code
print
"$addr originated from $country{$_}\n"
;
}
else
{
# who knows?
print
"I have no idea where $addr came from!\n"
;
}
}
while
sys
.
argv
:
rawaddr
=
sys
.
argv
[
0
]
del
sys
.
argv
[
0
]
components
=
string
.
splitfields
(
rawaddr
,
"."
)
addr
=
components
[
-
1
]
if
nameorg
.
has_key
(
addr
):
print
addr
,
"is from a USA"
,
nameorg
[
addr
],
"organization"
elif
country
.
has_key
(
addr
):
print
addr
,
"originated from"
,
country
[
addr
]
else
:
print
"I have no idea where"
,
addr
,
"came from!"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment