Workflow Automator: Translate This

Apple’s Automator is a great to for scripting those activities that you find yourself doing over an over. I needed a way to translate a selection of text. I created this simple Automator workflow to grab the selected text and send it to Google’s Translation service. This flow is for English but you can edit the script to change the target language to anything you want.

Here are the steps in the workflow if you want to roll your own.

  1. Run AppleScript
    on run {input, parameters}
    copy "http://translate.google.com/translate_t?sl=auto&tl=en&text=" & input to urlx
    return urlx
    end run
  2. Display Webpages

That’s the entire script. Enjoy.

Installation: Download TranslateThis.zip. Double-click on the zip file to open it up. Copy the “Translate This” workflow file to your ~/Library/Services folder. The ~/ is your home folder. You can get there from your “Go” menu.

It would be nice if the script could grab the page, find the translated DIV and then just display an alert with the translated text. That would save having to open a new Safari connection. This is just a first pass to make it useful.

The Lost Symbol IP Address Mystery

In the Dan Brown novel The Lost Symbol a character finds an IP address but is confounded trying to figure out whose IP address it is. She enlists the help of a hacker friend who is also confounded but claims to be able to hack it in no time. Once again Dan Brown fails at technology. Tracking down who owns an IP address is a very simple matter. The IP address system is based on a model of fractal ownership. The ownership of all IP addresses can be traced using a simple whois command. Let’s start with something simple. Let’s find out who owns the IP address for the CIA’s web site.

Note, all of these examples have been done on a Mac using the Terminal.app. The should also work fine on an other UNIX distribution. If you’re still using windows they you are out of luck. Some of the basic networking commands are not supported by Windows’ cmd.

The first step is to resolve the host name from cia.gov to an IP address. For this we use the host command. Simply type the command followed by the domain name you want to resolve. Also note that www.cia.gov and cia.gov are not necessarily the same thing. The www version does not have a mail server because people typically do not send email there.

$ host cia.gov
cia.gov has address 198.81.129.125
cia.gov mail is handled by 10 mail1.ucia.gov.

$ host www.cia.gov
www.cia.gov has address 198.81.129.125

Now that we know the IP address of this server we can look up its ownership. For that we use the whois command followed by the IP address we want to research.

$ whois 198.81.129.125
ANS Communications, Inc BLK198-15-ANS (NET-198-80-0-0-1)
198.80.0.0 – 198.81.255.255
Central Intelligence Agency OIT-BLK1 (NET-198-81-128-0-1)
198.81.128.0 – 198.81.191.255

In this example the result is simple and immediate. The range of IP addresses 198.80.0.0 – 198.81.255.255 is owned by ANS Communications, Inc.. A portion of this range 198.81.128.0 – 198.81.191.255 has been delegated to the CIA.

Let’s try another example that’s a little more difficult. I can open up most any spam message and find the IP address of a server that has been compromised. The fist one I find is 61•129•51•17. The whois command on this IP does not give us a nice pretty answer. It instead gives us the name of a server that does have this information.

$ whois 61.129.51.17

OrgName: Asia Pacific Network Information Centre
OrgID: APNIC
Address: PO Box 2131
City: Milton
StateProv: QLD
PostalCode: 4064
Country: AU

ReferralServer: whois://whois.apnic.net

NetRange: 61.0.0.0 – 61.255.255.255
[…omitted…]

So now we know that the IP address we see if somewhere in the Asia Pacific region of the world. The Asia Pacific Network Information Centre (APNIC) manages the entire 61.x.x.x range out of Australia. So you know that if you see any IP address if is is going to be somewhere in Asia. In order to find out more, we need to ask APNIC for their customer information. Fortunately, APNIC has graciously told us the name of their whois server: whois.apnic.net. (Notice that this is a .NET top-level domain name. The .NET used to mean something special to identify network providers.) No now all we need to do is repeat the whois command using APNIC as the authority instead of whois.arin.net. The way you do this is by adding the -h parameter followed by the name of the authoritative server. The whole command looks like this…

$ whois -h whois.apnic.net 61•129•51•17
inetnum: 61.128.0.0 – 61.129.255.255
netname: CHINANET-CN
descr: Data Communication Division
descr: China Telecom
country: CN
[…omitted…]

So now we know that this IP is owned by China Telecom. They own the entire range 1.128.0.0 – 61.129.255.255. Also provided in the response but omitted above is a phone number and email address of the person responsible for that range of IP addresses. Most network administrators are responsible and want to know if their network is being used for spam or worse.

Luke Meets Apollo

I stumbled upon an old episode of The Streets of San Francisco called “Innocent No More” from February 1977. Richard Hatch was the co-star on the show and Mark Hamill was the guest star.


The Lost Symbol Traceroute Mystery

Dan Brown’s most recent thriller novel The Lost Symbol we find Robert Langdon on the train of a bad guy who uses Dr. Langdon knowledge of ancient symbols to track down a mysterious talisman of the Masons. Mean while another character is trying to uncover the identity of a web server containing some vital but redacted information. I really enjoy Dan Brown novels but it drives me crazy when authors try to inject technical details that they really do not understand. This was a fatal flaw of one of his previous books, Digital Fortress. That book was enjoyable but filled with technical inaccuracies that were distracting for me. The latest novel is not as technical.

The secondary character is trying to identify a web site. She knows enough to try a traceroute. The problem is that a traceroute doesn’t tell you the identity of a server. It only tells you the path to that server from your location. It is helpful for diagnosing congestion or routing problems. Since the route between two points on a network is not always the same that information is not really helpful. I can tell you some information if that server is inside another organization’s network but it is not the best way to accomplish this. The character in the novel is stymied when the traceroute abruptly stops. Actually that is very common. Some protocols like ping, finger and traceroute are blocked by some routers because they are considered noise or even a security risk.

So what does a traceroute look like. Let me do a sample traceroute to whitehouse.gov. Let’s see what happens. The first response look promising. I’ll skip it because it is only showing me the path out of my house and to my ISP.

traceroute to whitehouse.gov (96.17.90.135), 64 hops max, 52 byte packets
1 10.0.1.1 (10.0.1.1) 1.117 ms 0.326 ms 0.305 ms
… omitted lines ….
7 ae-1.r21.dllstx09.us.bb.gin.ntt.net (129.250.4.181) 9.127 ms 8.965 ms 9.704 ms
8 as-0.r21.chcgil09.us.bb.gin.ntt.net (129.250.3.16) 36.514 ms 53.158 ms 32.594 ms
9 po-3.r00.chcgil09.us.bb.gin.ntt.net (129.250.3.9) 46.263 ms 32.090 ms 31.928 ms
10 * * *

These first few lines look promising. By line 10 however we are just getting the response * * *. Which is basically a non-response. The routers at that point in the trace have stopped responding. The trace will continue but you will probably not see any more meaningful information.

What’s interesting is that you can repeat the trace and get a different result.

traceroute to whitehouse.gov (96.17.90.135), 64 hops max, 52 byte packets
1 10.0.1.1 (10.0.1.1) 1.117 ms 0.326 ms 0.305 ms
… omitted lines ….
5 69.220.8.51 (69.220.8.51) 35.616 ms 35.308 ms 35.390 ms
6 chi-bb1-link.telia.net (213.248.96.117) 35.262 ms 35.124 ms 35.175 ms
7 nyk-bb2-link.telia.net (80.91.249.111) 56.628 ms
nyk-bb1-link.telia.net (80.91.248.193) 53.706 ms
nyk-bb1-pos0-3-0.telia.net (213.248.80.153) 54.319 ms
8 ash-bb1-link.telia.net (213.248.83.20) 74.448 ms
ash-bb1-link.telia.net (80.91.248.184) 54.519 ms
ash-bb1-pos7-0-0-0.telia.net (213.248.80.136) 58.251 ms
9 * * *

The second time the trace used telia.net instead of ntt.net. Somewhere there’s a map that shows these two paths and for at least that milisecond it was a faster route for our trace to take. Ten years ago the physical pathing was more limited and traceroute was more reliable. Today it is hobbled by security sensitive router managers.

TV Survey

The following survey is for an 8th grade science class. You participation is greatly appreciated. Please answer the questions honestly. This survey will close on 9/13/09.