December 31, 2006

Quickie for choosing interface for tcpdump

I’m frequently firing up tcpdump on my mac, but then having to restart it with the correct interface if I happened to be on a wireless network (which I frequently am on the mac). I finally got tired of that, so I whipped up a quick script that determines which interface is up and consequently starts tcpdump on that interface.  Allow me to `cat /usr/bin/stcpdump` for you:

#!/bin/sh

INT=`ifconfig | grep -A3 "en.:" | grep -B2 inet\ | head -n 1 | cut -f1 -d:`
sudo tcpdump -i $INT $@

Much better - saves me a big of grief. ;o)

December 26, 2006

Why I’m a Scripting Junkie

One of my more famous quotes from a previous job was “oh yea, I’ve got a script that does that…”.  Most of my co-workers know that if it can be scripted, I’ll do it.  Perhaps the recent post over on the PowerShell blog, Philosophy of Automation, explains why I’m such a script junkie.

Civilization advances by extending the number of important operations which we can perform without thinking about them.
Alfred North Whitehead, Introduction to Mathematics (1911)
English mathematician & philosopher (1861 - 1947)

I’ve been playing with PowerShell quite a bit lately as you noticed from my base64 copy/paste one-liner.  I’ve also been playing with it’s integration with .NET and COM objects (read: IE Browser Automation!) and am fairly impressed.  There’s a _lot_ that can be done with PowerShell.

December 24, 2006

Merry Christmas

Merry Christmas to my friends and family from coast to coast!  May your Christmas day be filled with Family, fun, and food - I know mine will be!

December 20, 2006

PowerShell Saves the Day

I ran into a situation today where I only had remote desktop access to a Windows machine and that machine did not have any outbound network access, but I needed to somehow get a dll onto the system. As remote desktop drive access was disabled, but I could copy and paste data via the clipboard, it only took a few moments before I realized base64 was going to be the route to take. But how could I decode it on the other end? Fortunately, the remote system had PowerShell pre-installed (rare, but very fortunate)!

Thanks to a few useful references, I was able to whip up this one-liner to get my dll over to the remote box:

$fileName = "CustomLibrary.dll"; [System.Convert]::ToBase64String((Get-Content -Encoding Byte $fileName)) | Set-Content ($fileName + ".b64")

Open the .b64 file in notepad, copy the contents, then paste into a new file on the remote side and then use the following:

$fileName = "CustomLibrary.dll"; [System.Convert]::FromBase64String((Get-Content ($fileName + ".b64"))) | Set-Content -Encoding Byte $fileName

And there you have your new dll copied over to the remote system using nothing but PowerShell. And if Out-Clipboard was still built in, I wouldn’t have even had to deal with the intermediary file!

December 11, 2006

Google Browser Sync

So Google’s recent Browser Sync tool is pretty neat. It allows you to sync your Firefox sessions between computers, which is pretty nice for a guy that frequently moves between 3-4 computers. The only curious thing I noticed when I installed it, was that it installed from dl.google.com even though I hadn’t added that to my list of exceptions - photographic evidence here:

My current list of exceptions:

Firefox Exceptions

The browser sync install dialog:

Google Browser Sync Install
So how did Google achieve this? I was quite suspicious at first, but it turns out it’s simply a little collaboration with Mozilla. There is a browser sync page on the Mozilla addons site, but all it does is redirect the user to Google’s xpi for installation, which allows Google to still host the browser sync install file, but not require the user to add their servers to the exceptions. Here’s the content of the Google Browser Sync addon page:

< html>
< body onload=“window.location.href=’http://toolbar.google.com/firefox/extensions/toolbar/google-browsersync.xpi’”>
body>
html>

Cute, huh? I haven’t decided yet whether I’m upset by this or not. They haven’t bypassed the Firefox security restrictions, but they have definitely misled me…

Update: Yea, RSnake is right (see 2nd comment). Combined with an XSS on a site that’s in your trusted exception list, this could probably allow an attacker to install XPI’s from arbitrary sites if they so desired. Roxor. I’m curious if the Mozilla addon page allows JavaScript for developers - I’m assuming not, but you what assuming does…

December 10, 2006

Boarding in Baker

Baker was wicked!  It’s so awesome to be back in a place where snow sports are so readily accessible.  I tried out boarding and it was pretty cool - I was linking turns and whatnot by the end of the day and making it down one of the runs without falling too much.  I gotta run to L.A., but here’s a pic of me at the top of the last run of the day. I can’t wait to hit the trails again!

My first time boarding.

December 8, 2006

Back to the snow

Sorry for the lack of posts - I’ve been busy planning world domination. In other news, I’m heading up to Mt. Baker to do some skiing and snowboarding this weekend. The last time I went skiing, it was 1993 and entirely different technology was in use. This should be pretty interesting, but I can’t wait!

And in what is an interesting case of irony, there is now Argentine Tango Dating across the street from where I used to live in Chicago…now cool would that have been!