Archive for the 'random' Category

Creating Encrypted USB Drives with TrueCrypt

Friday, March 14th, 2008

I discovered a neat TrueCrypt trick the other day while searching for products that would encrypt flash drives on the fly. I never noticed it before but it has an option to create a “travel disk”. It’s right there in the tools menu, as you can see on the screen shot below:

Travel Disk Option

It will essentially turn your chosen external drive into a self contained vehicle for TrueCrypt encrypted volume. It will copy all the files necessary for encrypting/decrypting the volume to the drive, and set it up to use the windows auto-play feature. So you just plug it in, type in your password and can start working with the encrypted files. The process is amazingly simple - so easy even a Caveman can do it. ) You just pick the drive, and choose whether or not it should auto-mount a volume on startup (yes it should):

Creating the Travel Disk

Then you click create. That’s all you really need to do. One thing this process doesn’t do is actually creating the TrueCrypt volume file on that drive. You have to do hat separately - I wrote about how to do this earlier. I created mine ahead of time called it files.tc and plopped it in the root directory of my flash drive. All I had to do then, was to point the above dialog at it. If you don’t have a tc volume yet, you can just type in a file name in that box, - it won’t complain that it doesn’t exist. You can add the volume later.

Once you hit create, bunch of files will get copied to the selected drive:

Files on the Drive

The autoruns.inf is the interesting one. As most of you know, this file contains the commands used by the Windows auto-play functionality. This is what it really contains:

[autorun]
label=TrueCrypt Traveler Disk
icon=TrueCrypt\TrueCrypt.exe
action=Mount TrueCrypt volume
open=TrueCrypt\TrueCrypt.exe /q background /e /m rm /v "files.tc"
shell\start=Start TrueCrypt
shell\start\command=TrueCrypt\TrueCrypt.exe
shell\dismount=Dismount all TrueCrypt volumes
shell\dismount\command=TrueCrypt\TrueCrypt.exe /q /d

In fact this is the only place which references the file name you entered in that dialog box. You can easily change it to anything else and it will work. Inside the TrueCrypt folder you get the guts of TrueCrypt. These few binary files are what does the encrypting/decrypting in the background:

TrueCrypt Core Files

I can give this flash drive to anyone in the world, and as long as they are running Windows XP (I don’t think 2k autoruns flash drives) they will be able to work with it. All you do, is just plug it in, and you see this dialog:

The Automount Dialog

If you choose the TrueCrypt option you will be greeted by the familiar (well, familliar to me) TrueCrypt password dialog:

Password Dialog

If you give the correct password it will mount another drive on your system, which will be the encrypted volume:

New Volume

The two drive thing may be confusing to some lusers at first but it opens up the correct one automatically in explorer on startup. Besides, they can easily identify that one drive has some cryptic system files, while the other has their data.

From there it just works seamlessly as always - anything you move, copy to or create on the virtual drive will be encrypted. What encryption will be used? It is up to you. The encryption type is not tied to your copy of portable TC but to the volume you created. If I remember correctly I used 128 bit AES-Twofish combo on mine, but you can pick your own.

The nice part about this is that I can easily take another tc volume (different encryption algorithm, different password) stick it on my flash drive, name it files.tc (or modify the autoruns.inf with the new file name) and it will work just as well. Or I can copy the TrueCrypt folder and the autoruns.inf file to another drive, and it will work as well. I can essentially create a script that will crank these out at will, without even having TrueCrypt copy installed.

I’m considering making this mandatory for the folks at work. They do get a lot of use out of the flash drives - and the do handle confidential stuff sometimes. So this seems like a perfect solution. The only caveat is removing the flash drive from your system.The standard Windows “Safely Remove” dialog won’t work because the .tc file as well as the TrueCrypt binary will be in use. So removing the stick is really a 2 step process:

  1. Right Click on the TrueCrypt icon in the taskbar and choose “Dismount all Encrypted Volumes”
  2. Remove the Flash Drive using the usual method

The “Dismount Command” actually shuts down TrueCrypt which is nice. Otherwise it would be a 3 step process. I’m sure that most people in the world can deal with a single manual step when they are getting high grade encryption for free. But my users are not most people - they are the people who will cry about it. But there is not much that can be done about this other than just removing the drive without actually making sure the write buffers are flushed into the thing. I’m concerned that when working with a TrueCrypt volume, pulling out the flash drive prematurely my be doubly hazardous than usual - I have no clue how these encrypted file handle corruption and unexpected write errors.

So I suspect I will have to do a 2 hour phone in training session on this, write up a manual with step by step screnshots (hey, I already have most of them here - nice) and then just be prepared to field phone calls asking how to dismount the damn thing for the next 7 months.

What if the World Died Tomorrow?

Tuesday, March 11th, 2008

On Saturday evening I lost power. I do get a lot of brownouts around here, but this was different. It was around 7pm, and all of a sudden I found myself in total darkness. Fortunately I always keep a LED flashlight on my desk. Most times I use it when I crawl under my desk and try to sort things out in the sprawling jungle of unkempt cables down there. But every once in a while it comes in handy during power outage.

It’s interesting, but once the power is gone the different appliances do not shut down at the same time. It is like a strange sequence of events that lasts a split second, but your brain registers it as a set of well defined stages. First the house lights dimmed down. Then the desk lamp made a short buzzing sound and flickered off. The CRT followed with the characteristic”krrrr-ponk” sound echoing deep within the cathode ray tube behind the display. The video output collapsing down to a single line in the middle of the screen then fading into black. The faint wheezing sound of the desktop fans spinning down to an abrupt halt came next. Behind me I could hear the static swish of the TV and cable box dying in unison - a very different sound than that of the dying monitor, and yet the two use the very same technology to display moving pictures on their screens. After that, there was only a def and mute blackness. As if I was thrown into a black void of nothingness. Both the sense of sight and hearing suddenly went into overdrive trying to overcompensate of the sudden loss of abundant stimuli. The only sound I could hear was creaking of my own chair, and my own breathing. Sometimes, the power would come right back. I sat there waiting for few seconds.

One… Two… Three… Was it going to come back?

Five… Six… Seven… I guess not. I fumbled for my flashlight which was standing between an empty soda can a stack of letters and a coffee mug full of old pens and markers.

I climbed up the stairs from my underground lair, through the kitchen into the living room only to be greeted by a distant howling sound. A bit like sirens - maybe it was a passing ambulance, or a police car… But the pitch was wrong. It didn’t oscillate the way emergency signals do. It didn’t move closer or farther away as it’s the case with the a moving vehicle signaling it’s passage. Perhaps these were distant fire sirens? But my town doesn’t have them - we have a professional fire department, not volunteers. Besides, these sirens rise and fall in pitch. The howling sound I heard did not - it was fairly constant. What was it then? It took me a minute or two to identify the sound. It was the wind! A high pitched distant howl, and my house was creaking as the violent gusts sweep over it. I could hear it so well, because of the deathly silence in the house. There was no radio, no TV, no noise from the spinning fans on my desktop. Nothing to down out the sounds of nature.

I peeked outside through the glass deck door. I saw only darkness - as if someone coated the glass with a thick layer of black paint. I could hardly make out the outline of my deck, as my eyes adjusted to the sharp contrasts around me. The bright LED flashlight was wreaking havoc to my night vision. Judging from the absence of light outside I summarized that the whole neighborhood got hit. The nearby houses were just dark silhouettes far beyond the range of my flashlight. Not a single window was lit in any of them. They were like black, cardboard cutouts backdropped against the sky - two dimensional outlines devoid of detail. The only sources of light were glimmering high up above me the night sky. The stars and the moon - they were incredibly clear. Clearer than I have seen them in years. No wonder - suddenly all the reflected light feedback that usually obscures them was gone in the area. Now the only thing trying to obscure them were the naked winter crowns of the trees swaying violently in the wind. Like withered claws of some strange primordial Lovercaftian beast born of darkness, clawing madly at the sky.

I made my way to the front of the house, and peered outside the front door. The streetlights were off, but the headlights of a passing car bathed everything in bleak artificial white. The house across the street was dark as well. In this sudden brightness it’s windows appeared to me as dark gaping voids - bizarre black holes which collapsed upon themselves and opened passages to strange dark dimension. But illusion only lasted for a brief second. As the car passed, the house became a dark shadowy silhouette again. The red tail lights didn’t really give off much light - not enough to see the details of the house across the street. Instead they made the shadows of the trees and streetlights come alive. They seemed to dance and move in the cars wake as some unsettling procession of twirling stick figures. Soon all I could see were two red dots going of into distance, heading for a shiny green beckon!

The traffic lights! They were still on. I watched them turn amber, red, then green again. At least part of the infrastructure had to be working if they were on. If they have power at the intersection, then it shouldn’t take them that long to fix this outage. Perhaps it’s just my street that went down.

I went back inside, chilled to the core by the cold wind and decided to check the view outside the deck door again. This time I saw a faint, shaky flickering in the distance. It was almost like a mysterious swamp light. It would appear for few seconds, in one spot dim down into nothing and flare up somewhere else. My neighbor must have found a flashlight, or a candle at last and I could see it through the windows as he wandered from one room to another.

As I was sweeping the flashlight back and forward over the deck and the garden the shadows were moving eerily following and scattering away from the beam of light. The trees were still clawing at the sky. The whole world seemed to be moving to the tune of some strange music my ears could not hear. An idea about what must have happened started coalescing in my mind. The crazy wind must have downed a tree which in turn damaged a power line. That had to be it. They would just have to find it, and reroute the power. It shouldn’t take that long. Maybe 20-30 minutes tops.

I was watching the shadows scatter in front of the circle of light, only to jump out on the other side, elongate and then join the darkness which has spawned them with a strange sense of fascination. This phantom movement was both mesmerizing and unsettling. The hedges and bushes below the deck and along the fence in the back of the yard were shaking violently in the wind. It was as if there was something that was hiding in them and now decided to stumble out rushing towards the light - or perhaps away from it. On the left side there was no fence at all. On the right, it is only a symbolic waist high chain-link. Only the back of the property is somewhat shielded. Shielded from what? The neighbors? They were all good people. But suddenly it worried me that, someone could come from either direction, waltz straight onto my deck and I would never see them. Not just tonight - on any night. My back yard is never really lit up very well. Anyone could just walk across the lawn unseen almost all the way to to the deck stairs. From there, it would only take five quick steps, and they would be right in my face. And the only thing that protected me from potential intruders was a thin sheet of glass. I felt vulnerable.

I’d have to board it up. That was what popped into my head. If the power never comes back, there would be looting, and the deck door would need to be barricaded to keep people outside and hide the activity in the house.

Why was I thinking about this? Who would come here? This was a small, local power outage and I was in a nice suburban town, which would be the last place on earth you would expect to see the post apocalyptic looting war bands I suddenly imagined. Still, the thought made me uneasy. I made sure the deck door was fastened shut, and was about to shut down the vertical blinds. I figured that not having to look at the gloomy scenery out there will make me feel safer. Ironically, I wouldn’t even be able to see the potential intruders with the blinds shut. But there were no intruders to see around here.

That’s when I saw a shadow darting into the circle of the moving light made by my flashlight. Black as night, elongated and shapless it was moving on it’s own, dancing along the whole length of the deck and moving from left to right until it filled out all available space. This was not the normal shadow dance that I produced by moving the flashlight back and forward. This shadow was attached to something that seemed alive.

The owner of the shadow suddenly appeared right against the glass of the deck. Two charcoal black in black eyes peered at me from the darkness. They were darker than the night, and much deeper than those of a human being. Huge pupils, almost no retina visible - these were the eyes of a nocturnal predator. He looked inside, surveyed the room and finally affixed his gaze upon me crooking his head expectantly. Inquisitive and curious beast - he was hungry. My uneasiness evaporated, and I swung the door open letting him inside. This cat still doesn’t trust me, but he is pretty comfortable eating inside of the house. He has his bowl right by the deck door. Such an odd relationship we have - a man and a wild animal. Domesticating this little guy is an ongoing project, and there is no end in sight yet. This is no lazy house cat - he is proud, individualistic hunter. I suspect he didn’t mind the wind much, and naturally was completely unaffected by the power outage.

I often wondered how he perceives us, humans. He was born out in the suburban wilderness and has never known a human touch. Never lived inside of a house. How strange we must be to him. Awkward towering giants with booming voices, always hoarding food and are curiously willing to share it. What we have is a fragile truce - and he reminds me of it by hissing and baring his fangs as I pass by him to fetch him something to eat. To close for comfort. Sorry pal, didn’t mean to startle you…

As my feline friend was getting his evening meal the family assembled at the kitchen table, speculating about the power outage and fiddling with different battery powered light sources and candles. We sat there for several hours chit-chatting and gathering field reports from friends and relatives in the area. For some time the cell phones were in constant use - calling ringing, connecting. Then it all died down, as we got the low down on everyone’s situation. It seems that the outage affected more than just my town but rather a larger area comprised of 2-3 towns. It seemed serious, but nothing that could not be fixed in few hours. I called the power company, only to get re-routed the automated power outage reporting system every time.

As we sat together the wind dropped off and picked up several times. It’s low pitched howling mixed with actual emergency siren sounds fading in and out from all directions. My brother works at a restaurant 10 minutes away from the house. You cross the bridge, and jump on the highway, make a U turn and you are there. He had power all evening so obviously the damage was local. But sitting in that dark house, and listening to the howling wind, and counting the passing ambulance/police sirens it almost seemed like we were are in some post apocalyptic movie in which the civilization just came crushing but no one has noticed yet.

Around 11pm, I went back downstairs with a big battery powered lamp, and a plastic yellow radio/cassette player we used to take to the beach. I hooked the lamp above my bed, propped the radio on my night stand, and tuned into some music station. Compared to the howling, and creaking I heard upstairs, my room was quiet as some ancient tomb. Initially I wanted to play some mp3’s from the desktop, but naturally this wouldn’t work without electricity - and I don’t have any music on my work laptop. So the radio had to do for the time being. I desperately needed some background noise in this deathly silence. Next to the radio I placed my cell phone which was both my life line to the outside world, and also the only watch I owned that still worked. All of the other time keeping devices in the room, require running power. Next to the cell phone, I placed my trusty LED flashlight. Thus armed I hopped into bed with a book and decided to use this time to catch up on my reading.

It’s funny how even during this blackout I was desperately clinging to technology. My cell phone, the radio, the electric lamp. They were all my crutches. What it this was it, though? What if the power never came back up? What if the world died that night for whatever reason? My cell phone would die unless I found some way to recharge it that didn’t involve plugging it into the power socket. My lamp, my flashlight and my radio would only work as long as I would keep feeding them DD batteries. And then what?

Even worse, was that all of my lives work - everything that I have created, and learned so far would suddenly become irrelevant, and absolutely useless. My MS in Computer Science and sysadmin/software developer background would mean nothing in a world where computers were just a distant memory. I was ill prepared for living in a post apocalyptic world. My professional skill set was narrow and useless - the only useful bits of knowledge would be the stuff I have learned in the science classes. Chemistry would probably be useful if I had to Robinson Crusoe by myself for the rest of my life in the urban jungle. So was math, engineering and biology. But computer science would be all but irrelevant.

I did not really posses any survival skills to speak off - I’d usually just google up just look up stuff like that as needed. I think that if the civilization ended tomorrow, and I was one of the few survivors, one of my priorities would be to loot a library searching for useful urban survival knowledge. But my mind balked at the prospect of searching for knowledge this way. That would be so slow and inefficient - and there would be no guarantees I’d find what I was looking for.

What would I do in this new world? How I would the rest of my life play out? Would I be a drain on my family, and the local society possessing few useful skills? How would I deal with all my hopes, dreams and hobbies being blinked out of existence. How about you? Do you think you would survive in such scenario? Do you think you would be ready?

I must have dozed off with the book, and my dark thoughts about the end of the world. I woke up way past midnight. All the lights in the room were on, and the blaring TV was trying to compete with the radio over who can assault my ears with a louder and harsher cacophony of sounds. I smiled to myself, I switched the radio off, turned the volume down on the TV, shut off the lights and went to check my email. I really needed to finally buy that damn UPS for the desktop.

Product Key Game

Thursday, January 31st, 2008

Here is a fun little game we play around here. This is ideal for IT shops or generally places where you have bunch of geeks installing crappy software on windows boxen. It’s called the PK Master. The goal of the game is to type in the product key/CD key perfectly the first time around. A perfect game is worth certain number of point’s. We use 3 because of the old saying “3rd time’s a charm”. You can use 1 if you are all or nothing type of a person, or 5 if you want nice round numbers. Each time you mess up, you lose a point. This means that with our setup you are allowed 2 typos to score the minimal amount of points.

Product Keys

You can optionally subtract points for style. For example hitting tab in a system that automatically moves the cursor into the next box (in other words effectively skipping a box) can be penalized. Backspacing is another optional penalty. And of course if you are nasty you can take away points for squinting or picking up and re-reading the key.

At the end of the week/month you tally up the score and the person with the highest scoring average wins. It’s only fair to use averages because people do not always get equal number of attempts even if you all take turns. This someone only got to go once this week can still win, if he scored 3 points.

What does the winner get? It’s up to you - for example, the lowest scoring player may have to buy a lunch for the highest scoring one. This makes reinstalling windows on a box that is not imaged a little bit less of a chore because at least you get an opportunity to score 6-9 points and significantly improve your average.

Before you say this is easy, please think back to the last time you had to do enter a product key. If I give you a MS Office CD right now do you think you can score 3 points? Personally I can’t even remember the last time I got a perfect score. I always mess up and type 8 instead of B, G instead of 6 or O instead of 0. And if the product key is lower case I always fuck up 1 and l.

Office Product Key (Not Mine)

Then there is that tricky “are the dashes/spaces part of this key?” problem. Sometimes they are, sometimes they are not. Do they tell you this on the sticker? Of course not. Does the system complain when you type a dash when you don’t need it? Silly idea - that would just be to easy. This uncertainty adds element of chance to this game. When you are installing a new or unfamiliar piece of software it’s always a gamble. Do you risk plunging your average into oblivion, or do you let your co-worker type it? It’s a tough choice!

I really love how the software makers keep finding innovative ways to keep this game challenging. In most cases they print the keys in very small, non-distinct sans-serif font on some crazy colorful background. Most normal people would put a long alphanumeric key like that on contrasting background in a large font with big serifs and other features that clearly distinguish letters and numbers (such as crossed zeros). But not these guys - they literally go out of their way to make it fun for us!

Sometimes I wonder how normal people deal with this whole product key thing. I only see it in the game terms these days. I pick up a CD and go “oh boy, this one has too many B’s and 8’s… I better drop it on someone’s desk and hope they fall for it”. I actually find it hilarious to find a sequence like 8B8B6G6B within a key. It’s funny even if it causes you to score poorly because you can then show people the damn key and talk about Microsoft conspiring against you and your free lunch. But normal people… Hell, they must be mighty annoyed with these damn things. I would be if I didn’t see these stickers as free lunch opportunities.

Then again, if you think about it, the CD key is the least annoying and obtrusive form of copy protection. Much more convenient and harder to lose than a hardware dongle, and way better than some crazy DRM rootkit that makes your optical drive explode after detecting a blank CD.

Naturally they don’t work - even if you combine them with an online activation. All the copies circulating on torrent and warez sites are cracked and have the key/activation parts removed. Then again no DRM really works anyway. Digital copy protection is just a pipe dream of the software industry. But until the proprietary software moguls figure this out we might as well stick with the lesser evil.

Seriously, try this game people! Let me know if it catches up! I would love to see it spread into the wild. )

Mechanical Dog Toys

Tuesday, December 11th, 2007

Yesterday, as I often do I fell asleep with the TV on. I usually tune to Adult Swim in the evenings so I woke up to the morning block of Cartoon Network today. Since I usually stumble out of the bed, and perform a zombie like shuffle to the bathroom with my eyes closed still half asleep turning the TV off was out of the question. I ended up half-watching it from the corner of my blood shot eye while shaving and dressing for work. Note that at this point my brain was in standby mode using only as much processing as it takes to move around the electric shaver around my face, and pull out random bits of clothing from the closet attempting to find a combination that is presentable enough for work. But even in this low processing mode two things struck me.

Firstly, I could not recognize a single cartoon out of the lineup. It was all new original stuff, and none of the classics that I grew up with. Does that mean I’m getting old or perhaps Cartoon Network doesn’t have rights to air the old stuff?

Secondly, there was an obscene amount of commercials for mechanical dog toys. There was some plastic dog robot that follows you, a big yellow puppy that pees when you lift it’s leg up, another one that moves it’s head from side to side and barks, a poodle like puppy bot that grows in real time, something called iDog which looked like a Apple lawsuit waiting to happen, and bunch of huggable plush dog toys. And that was just one commercial break. There were like 3 other spots, and the rest were fucking dog-bots. WTF?

I guess they are really ramping up the pet like toys for the holidays. I’m guessing there is a (un)healthy demand for these damn things since kids usually either desperately want a dog or already have one. Your kid wants a dog? No worries, you can buy him a cheep, plastic imitation that sucks ass and will get forgotten and abandoned 10 times faster than that fucking Tickle Me Elmo thing. Sigh…

Seriously people, if you have the means for it, and you are not allergic or anything like that just buy a fucking dog. It will make you a better person, it will brighten up your life, and it will shit on your carpet - but that’s a small price to pay. Really, what you are getting out of this is a loyal companion who will always enthusiastically greet you when you come back home, or take 20 minutes of their busy schedule to diligently lick your feet.

Then again, I’m not a parent and I do not own a carpet that could be shat on, so perhaps I’m missing the point here. But I do believe that a dog is a solid investment, and that the bond which forms between a human and a dog is something everyone should experience. A cat is fine too, if you are not a dog person. And no, taking care of someone else’s dog for a week does not count.

I actually find it kinda sad that a lot of parents would actually try to substitute the real experience with a piece of cheep plastic made in Taiwan just because they shy away from a little bit of additional responsibility. I mean, next to raising a child taking care of the dog is a piece of cake. Unless of course you believe that parenting is something that should be left to TV and public schools in which case I can see why a dog or a cat would be a huge issue.

Personally I really don’t think that an AI that would be even half as amusing as my dog will become commercially available anytime soon. Emergent behavior may often be amusing and exciting - that’s true. But it requires certain suspension of disbelief to believe that your Roomba slammed the door on you out of spite or as a revenge for kicking it earlier tat day. Real animals on the other hand, have real moods, attitudes and they do communicate them quite effectively. As long as AI is only trying to emulate these moods and behaviors we are not there yet. I’ve seen the stuff modern robotics has to offer to us, and while some of this stuff is impressive, it’s not even close to being lifelike yet. And we probably won’t get a life-like dynamic AI that would actually develop traits of a living being like curiosity and etc within my lifetime.

Of course, if we do build one like that, it would probably indicate we are on the cusp of singularity and some interesting shit is bound to go down in the next few years. And by interesting I mean anything between extinction of human species, to technical immortality and anything in between.

Until then though, fuck the pseudo-dogs. If you are not planning to buy your kid a real pet, at least get him a Wii or something cool, not a plastic tease-dog.

IP Fun

Monday, December 3rd, 2007

Ok, it’s time for a silly little game/competition once again! How do you participate?

  1. Figure out your external IP address (ie. the routable one you get from your ISP, not the NAT address you get from the router).
  2. Your IP address is composed of 4 octets divided by dots. Take the octets and add them together. This is your sum.
  3. Take the sum, and divide it by 4. This is your average.

Post your sum and average in the comments below. Person with the highest average and/or sum wins the intenet.

If you are lazy, I implemented a tiny script that will do this for you. Simply peek into the iframe below:

For privacy reasons, please don’t post your actual IP. No need to anouce it to the whole world. Also note that I can see your IP when you post your comment so no cheating. I will be checking it! ) Oh, and if you roam between various IP addresses during the day, you can post once for each of them - maybe your work IP is better than your home one.

Let me start. My average is 109.75 and my sum is 439. What is yours?