Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
268a39fb
Commit
268a39fb
authored
Jun 15, 1995
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted to python
parent
f1945466
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
124 deletions
+123
-124
Tools/world/world
Tools/world/world
+123
-124
No files found.
Tools/world/world
View file @
268a39fb
#! /depot/
gnu/plat/bin/perl
#! /depot/
sundry/plat/bin/python
#
#
# Note: you may have to edit the top line in this file.
# Note: you may have to edit the top line in this file.
#
#
...
@@ -14,133 +14,132 @@
...
@@ -14,133 +14,132 @@
# the speed in which political boundaries are changing these days, no
# the speed in which political boundaries are changing these days, no
# doubt there are some incorrect mappings.
# doubt there are some incorrect mappings.
$prog
=
$0
;
import
sys
$ARGV
[
0
]
||
die
"
No addresses provided.
\n
Usage:
$prog
addr1 [addr2 ...]
\n
";
prog
=
sys
.
argv
[
0
]
del
sys
.
argv
[
0
]
if
not
sys
.
argv
:
print
"No addresses provided.
\
n
Usage:"
,
prog
,
"addr1 [addr2 ...]
\
n
"
# The mappings
# The mappings
%
nameorg
=
(
nameorg
=
{
"
arpa
"
,
"
Arpanet
",
"arpa"
:
"Arpanet"
,
'
com
',
'
commercial
'
,
"com"
:
"commercial"
,
'
edu
',
'
educational
'
,
"edu"
:
"educational"
,
'
gov
',
'
government
'
,
"gov"
:
"government"
,
'
mil
',
'
military
'
,
"mil"
:
"military"
,
'
net
',
'
networking
'
,
"net"
:
"networking"
,
'
org
',
'
non-commercial
'
,
"org"
:
"non-commercial"
,
'
int
',
'
international
'
"int"
:
"international"
);
}
%
country
=
(
country
=
{
"
ag
"
,
"
Antigua and Barbuda
",
"ag"
:
"Antigua and Barbuda"
,
"
al
"
,
"
Albania
",
"al"
:
"Albania"
,
"
aq
"
,
"
Antarctica
",
"aq"
:
"Antarctica"
,
"
ar
"
,
"
Argentina
",
"ar"
:
"Argentina"
,
"
at
"
,
"
Austria
",
"at"
:
"Austria"
,
"
au
"
,
"
Australia
",
"au"
:
"Australia"
,
"
bb
"
,
"
Barbados
",
"bb"
:
"Barbados"
,
"
be
"
,
"
Belgium
",
"be"
:
"Belgium"
,
"
bg
"
,
"
Bulgaria
",
"bg"
:
"Bulgaria"
,
"
bo
"
,
"
Bolivia
",
"bo"
:
"Bolivia"
,
"
br
"
,
"
Brazil
",
"br"
:
"Brazil"
,
"
bs
"
,
"
Bahamas
",
"bs"
:
"Bahamas"
,
"
bz
"
,
"
Belize
",
"bz"
:
"Belize"
,
"
ca
"
,
"
Canada
",
"ca"
:
"Canada"
,
"
ch
"
,
"
Switzerland
",
"ch"
:
"Switzerland"
,
"
cl
"
,
"
Chile
",
"cl"
:
"Chile"
,
"
cm
"
,
"
Cameroon
",
"cm"
:
"Cameroon"
,
"
cn
"
,
"
China
",
"cn"
:
"China"
,
"
co
"
,
"
Colombia
",
"co"
:
"Colombia"
,
"
cr
"
,
"
Costa Rica
",
"cr"
:
"Costa Rica"
,
"
cy
"
,
"
Cyprus
",
"cy"
:
"Cyprus"
,
"
cz
"
,
"
Czech Republic
",
"cz"
:
"Czech Republic"
,
"
de
"
,
"
Germany
",
"de"
:
"Germany"
,
"
dk
"
,
"
Denmark
",
"dk"
:
"Denmark"
,
"
dm
"
,
"
Dominica
",
"dm"
:
"Dominica"
,
"
do
"
,
"
Dominican Republic
",
"do"
:
"Dominican Republic"
,
"
ec
"
,
"
Ecuador
",
"ec"
:
"Ecuador"
,
"
ee
"
,
"
Estonia
",
"ee"
:
"Estonia"
,
"
eg
"
,
"
Egypt
",
"eg"
:
"Egypt"
,
"
es
"
,
"
Spain
",
"es"
:
"Spain"
,
"
fi
"
,
"
Finland
",
"fi"
:
"Finland"
,
"
fj
"
,
"
Fiji
",
"fj"
:
"Fiji"
,
"
fr
"
,
"
France
",
"fr"
:
"France"
,
"
gb
"
,
"
Great Britain
",
"gb"
:
"Great Britain"
,
"
gh
"
,
"
Ghana
",
"gh"
:
"Ghana"
,
"
gr
"
,
"
Greece
",
"gr"
:
"Greece"
,
"
hk
"
,
"
Hong Kong
",
"hk"
:
"Hong Kong"
,
"
hr
"
,
"
Croatia
",
"hr"
:
"Croatia"
,
"
hu
"
,
"
Hungary
",
"hu"
:
"Hungary"
,
"
id
"
,
"
Indonesia
",
"id"
:
"Indonesia"
,
"
ie
"
,
"
Ireland
",
"ie"
:
"Ireland"
,
"
il
"
,
"
Israel
",
"il"
:
"Israel"
,
"
in
"
,
"
India
",
"in"
:
"India"
,
"
is
"
,
"
Iceland
",
"is"
:
"Iceland"
,
"
it
"
,
"
Italy
",
"it"
:
"Italy"
,
"
jm
"
,
"
Jamaica
",
"jm"
:
"Jamaica"
,
"
jp
"
,
"
Japan
",
"jp"
:
"Japan"
,
"
km
"
,
"
Comoros
",
"km"
:
"Comoros"
,
"
kn
"
,
"
Saint Kitts and Nevis
",
"kn"
:
"Saint Kitts and Nevis"
,
"
kr
"
,
"
Republic of Korea
",
"kr"
:
"Republic of Korea"
,
"
kw
"
,
"
Kuwait
",
"kw"
:
"Kuwait"
,
"
lc
"
,
"
Saint Lucia
",
"lc"
:
"Saint Lucia"
,
"
li
"
,
"
Liechtenstein
",
"li"
:
"Liechtenstein"
,
"
lk
"
,
"
Sri Lanka
",
"lk"
:
"Sri Lanka"
,
"
lu
"
,
"
Luxembourg
",
"lu"
:
"Luxembourg"
,
"
lv
"
,
"
Latvia
",
"lv"
:
"Latvia"
,
"
my
"
,
"
Malaysia
",
"my"
:
"Malaysia"
,
"
mx
"
,
"
Mexico
",
"mx"
:
"Mexico"
,
"
na
"
,
"
Namibia
",
"na"
:
"Namibia"
,
"
ni
"
,
"
Nicaragua
",
"ni"
:
"Nicaragua"
,
"
nl
"
,
"
Netherlands
",
"nl"
:
"Netherlands"
,
"
no
"
,
"
Norway
",
"no"
:
"Norway"
,
"
nz
"
,
"
New Zealand
",
"nz"
:
"New Zealand"
,
"
pe
"
,
"
Peru
",
"pe"
:
"Peru"
,
"
pg
"
,
"
Papua New Guinea
",
"pg"
:
"Papua New Guinea"
,
"
ph
"
,
"
Philippines
",
"ph"
:
"Philippines"
,
"
pl
"
,
"
Poland
",
"pl"
:
"Poland"
,
"
pr
"
,
"
Puerto Rico
",
"pr"
:
"Puerto Rico"
,
"
pt
"
,
"
Portugal
",
"pt"
:
"Portugal"
,
"
py
"
,
"
Paraguay
",
"py"
:
"Paraguay"
,
"
ro
"
,
"
Romania
",
"ro"
:
"Romania"
,
"
se
"
,
"
Sweden
",
"se"
:
"Sweden"
,
"
sg
"
,
"
Singapore
",
"sg"
:
"Singapore"
,
"
si
"
,
"
Slovenia
",
"si"
:
"Slovenia"
,
"
sk
"
,
"
Slovakia
",
"sk"
:
"Slovakia"
,
"
sr
"
,
"
Suriname
",
"sr"
:
"Suriname"
,
"
su
"
,
"
USSR
",
"su"
:
"USSR"
,
"
tw
"
,
"
Taiwan
",
"tw"
:
"Taiwan"
,
"
th
"
,
"
Thailand
",
"th"
:
"Thailand"
,
"
tn
"
,
"
Tunisia
",
"tn"
:
"Tunisia"
,
"
tr
"
,
"
Turkey
",
"tr"
:
"Turkey"
,
"
tt
"
,
"
Trinidad and Tobago
",
"tt"
:
"Trinidad and Tobago"
,
"
uk
"
,
"
United Kingdom
",
"uk"
:
"United Kingdom"
,
"
us
"
,
"
United States
",
"us"
:
"United States"
,
"
uy
"
,
"
Uruguay
",
"uy"
:
"Uruguay"
,
"
vc
"
,
"
Saint Vincent and the Grenadines
",
"vc"
:
"Saint Vincent and the Grenadines"
,
"
ve
"
,
"
Venezuela
",
"ve"
:
"Venezuela"
,
"
vi
"
,
"
Virgin Islands
",
"vi"
:
"Virgin Islands"
,
"
yu
"
,
"
Yugoslavia
",
"yu"
:
"Yugoslavia"
,
"
za
"
,
"
South Africa
",
"za"
:
"South Africa"
,
"
zw
"
,
"
Zimbabwe
"
"zw"
:
"Zimbabwe"
);
}
import
string
while
(
$addr
=
shift
@ARGV
)
{
(
$_
)
=
$addr
=~
/\.(.*)$/
;
$_
=
$addr
if
!
$_
;
if
(
$nameorg
{
$_
})
{
while
sys
.
argv
:
# its one of the `special' USA organizational domains
rawaddr
=
sys
.
argv
[
0
]
print
"
$addr
is from a USA
$nameorg
{
$_
} organization
\n
";
del
sys
.
argv
[
0
]
}
elsif
(
$country
{
$_
})
{
components
=
string
.
splitfields
(
rawaddr
,
"."
)
# its a country code
addr
=
components
[
-
1
]
print
"
$addr
originated from
$country
{
$_
}
\n
";
}
if
nameorg
.
has_key
(
addr
):
else
{
print
addr
,
"is from a USA"
,
nameorg
[
addr
],
"organization"
# who knows?
elif
country
.
has_key
(
addr
):
print
"
I have no idea where
$addr
came from!
\n
";
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