Spoofing User Agent Types from the Command line

I’m back on the command line…look out…

ubuntu terminal spoofing user agents
green on black...my favorite

So, I am still poking away at various ways to interface between the bash and various web components. This stuff is still shaking out of my Twitter to CLI to LCD project. I have been using some of the usual suspects (wget, python url libraries, etc) in an effort to find one that is best suited to sniffing and parsing html info. I have found that writing to serial is the most fail-proof means of mashing around data quickly, so that is my inspiration.

Anyhow, I was horsing around with curl on the command line. It turns out, that spoofing user agents is pretty simple to implement.

Take this two-line one liner for instance:

swantron@Dell15:~$ x=10
swantron@Dell15:~$ for (( y=1; y<=x; y++)) ; do curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" swantron.com ; done

In a nutshell, this is acting to snag this site ten times, with credentials indicating the machine is running Windows 2000 and MS Internet Explorer 5.1. The success is indicated by my server statistics:

Before:

Windows 2000 IE 5.1
Windows 2000 IE 5.1

After:

IE 5.1 on Windows 2000
IE 5.1 on Windows 2000

Not too bad. I am considering using this as a testing tool for my site. Messing around with PHP and CSS…I can put together a quick regression using some legacy operating systems and browsers to make certain that I can still snag my content. Granted, the example setup may seem like gross overkill, but as those stats indicate, I do see quite a few requests from ancient machines. Makes you wonder..

Anyhow, this layout is in need of some serious testing. If anyone is interested in a copy, drop me a line. Cheers.

Microsoft Hohm FTW!

I’d absolutely love to spend my time with all of my nerd accessories fired up and the thermostat cranked up to 80 degrees. Unfortunately, if I had both TVs, all 4 notebooks, the PS3 and Wii fired up, the power meter would move faster than Blanch from the Golden Girls. Oh snaps! Energy saving in our house is a tricky beast, not so much from the obvious (use less energy) reasons as in physical reasons…plain and simple, the sucker is old as dirt. Like Sophia from the Golden Girls. Now I’m reaching a bit…

Enter Microsoft Hohm. When presented with an opportunity to rattle on about something for a small sum of money, I only accept said opportunity if I can rattle on with some sort of insight into the topic. This one definitely strikes close to home. I’d much rather spend my well-earned money on things I enjoy, like gadgets and vacations. Last fall, Kate and I managed to seal our leaky windows with plastic wrap in order to drive down our heating bill…I’m guessing we saved well over the price of a funny blended drink in Vegas per day during the cold months. As far as home energy in general…we have been taking steps to unplug unused (sad panda) powered items. Not much, maybe, but something.

Anyhow, I logged onto Microsoft Hohm’s website and fired up an account, which was free. You do need a MS email account, and my old Hotmail guy worked just fine. You are prompted for basic info about your abode…pretty straight forward. The cool (and somewhat embarrassing in the case of our place) thing is seeing how you stack up against the averages in your area. Check out how we rank against the Bozo crowd:

averages
Average schmaverage...wait for it

And more specifically

ouch
d-d-d-d-deal breaker

Ouch. Looks like it is back to the drawing board. The good thing about Hohm’s site is that they drill you with recommendations after they analyze your scenario…

screen shot 3
at least we have options, it seems

So they good news is they have a grip of solutions to drive down your costs, from changing settings on your home appliances to blowing in additional insulation into your attic. Pretty slick stuff

They also have tips for nerds, like changing your machine to enter sleep mode. Maybe on Vista, Microsoft. Maybe on Vista. I’ll be wrapping my water heater with a jacket well before I’ll horse around with my Linux desktop settings.

Hit one of the above bumps and check it out for yourselves…it is definitely an eye-opener.