Friday, October 12, 2012

Teaching Ruby to a 9-Year-Old, Part 2: The Smart - Dumb Computer

This is part of a series of posts titled "Teaching Ruby to a 9-Year-Old."  See the Introduction for more information.


Computers are Really Smart...

Computers are basically giant calculators.  Type in a big multiplication problem, and watch how long it takes to figure out the answer.  Note:  On computers, we say "times" with a *.


This took less than 1 second.  My computer is super smart!


Computers are Also Really Stupid and Stuck Up.

Computers speak their own special language.  If you say something to the computer, and you don't say it exactly the right way, it says it doesn't understand.  Then it barfs on you. Look at these examples when I try to tell it to clear the screen:




Don't Make the Computer Barf

When we write a computer program, we need to be sure we don't make the computer sick.  This means we have to be very careful about how we write things.  Even something as simple as forgetting to put the period at the end of a sentence can make the entire program not work.

 

Nil


A long time ago, I put Ruby on my tablet.  I thought it was broken because it kept saying nil all the time.  Later on, I learned that nil is good!

The word "nil" means "nothing."  When Ruby tells you "nil," it means "Nothing is wrong.  I'm not going to barf on you."  So whenever you see that word on your screen, get excited because the computer just gave you a high-five (or fist bump)!




Tuesday, September 25, 2012

Teaching Ruby to a 9-Year-Old, Part 1 - Introduction

I Learned This When I Was a Child


I learned how to write computer programs when I was a boy.  This was due to interest as much as necessity.  Our Commodore 64 and Texas Instruments TI-994-A didn't have a mouse, Windows, or any of the other features we currently take for granted.  I wasn't a child prodigy; programming was simply part of the experience of using a computer.  The language was called BASIC, and that word best describes my abilities at the time.


Fast forward more years than I like to acknowledge, and my grasp of computer programming is still nascent, or perhaps adolescent, at best.

Although not required for my daily work, knowing how to program (or "script" as we say now) could be very helpful and lucrative.  So I've set upon the journey of learning, and what an adventure that has been.  Like many computer geeks, my knowledge is fragmented.  I have great understanding of certain advanced subjects and little understanding of others.  Like most people who don't understand programming, when looking at lines of code, such as this simple snippet, I feel like it might as well be written in hieroglyphics. 

A snippet of code I wrote for submission to the metasploit project.

This fragmentation of knowledge is a strange combination.  On certain subjects, I could teach a college-level course.  On others, I need to sit in a class and have an instructor mete out knowledge as if I'm a child.  After many false starts - reading books that quickly traveled beyond my comprehension - I had  the realization that (with respect to computer programming) I need to be taught like a child.  This ultimately led to some measurable advances in my education and understanding.

If this is you - if the words in the picture above seem like complete gibberish - I encourage you to keep reading.

Teaching Ruby to a 9-Year-Old

My son is 9 years old and is interested in math and science.  But for the son of a Digital Forensic Analyst, he's woefully uneducated regarding computers.  I've often heard the expression, "The best way to learn is by teaching," so I've dedicated myself to learning Ruby by teaching him.  Convincing him was easy:   He was hooked the minute he discovered that, with a few lines of code, he could make the computer display the word "butt" on the screen 100,000 times.  I hope he never gets too old to enjoy that experience.

In this series of posts, I will chronicle my method of explanation.   If you're already knowledgeable about computer programming, these posts will drive you crazy with their slow pace and simplistic language.  But if you're like me, wanting to learn this one bite at a time, you may find them helpful.

So, fellow Grownups - set your ego aside and put on your thinking caps.  The bell has rung; class has begun.

Note:  If you want to follow along, you will need to install Ruby and use a programming-friendly text editor like Notepad++.

Saturday, January 7, 2012

A Shout-Out to a Great Piece of Software


I want to take an opportunity to write about a piece of software I use in every single investigation.  Please note that I do not work for the software company, nor do I receive any compensation from them.

SAW (SMART Acquisition Workshop) is a staple in my forensics lab.  The software is made by Andrew Rosen of ASR Data.  I'll take a moment to mention here that his software (an entire Forensics suite, including SAW) is cheaper than the stuff from Big G or Big A, and he doesn't charge annual "maintenance" fees.

This is how SAW works, as I understand it.  When imaging a device, instead of writing out a cluster of zeroes, it simply makes a note of it.  The resulting file is often significantly smaller than a dd image would be because it is a sparse file.

SAW imaging a 160GB 2.5" SATA HDD.

In the example shown in the picture (sorry for the bad quality), the Source device is mostly empty.  Because SAW creates a sparse file, the acquisition process isn't slowed by having to write zeroes to the Target drive.  Note the current acquisition speed of 82.28 MB / second on a standard USB3 connection and the amount of data "optimized."

The resulting evidence file in this particular case (a 160 GB drive) was just over 6 GB - a whopping 96% reduction in file size.

The use of a sparse file is a clever idea in several ways:

First, the original data is not altered or compressed.  What is missing from the end file is what wasn't there in the first place (e.g. thousands of 4k chunks of \x00).  Andrew likes to say, "What's missing from the file is Nothing.  Nothing is missing."

(That play on words reminds me of a co-worker who called IT and stated his keyboard wasn't working. When the tech arrived, my co-worker stated, "Seems like somebody spilled coffee on it." The tech picked up the keyboard and out poured what seemed like a full mug's worth of coffee.  The tech said: "Be honest, you did this, didn't you?" to which my co-worker replied, "Well, I'm somebody!")

Second, the resulting sparse file can be read (e.g. keyword searched, carved, etc.) by any other program without that program supporting a specific decompression algorithm.  Additionally, the processor isn't bogged down with any decompression.  For the drive shown in the picture, it would mean no waiting for the hard drive to read out 154 gigabytes of zeroes on every job.  I've run tools like IEF against such files with great success.

Third, if you want to mount an actual image, with zeroes and all, you simply instantiate one using a companion piece of software called Smart Mount.  Smart Mount presents the filesystem with a dd image (called 'image.dd') while simultaneously creating a mount point that can be browsed manually.  That's neat and all, but what is significant is how the zeroes are re-inserted.

When the OS reads the instantiated image.dd, or you browse through the mounted filesystem, the "missing" zeroes are read not from the hard drive (remember, they were never included in the forensic image), but instead from /dev/zero.  So the processor, not the hard drive, is slinging those zeroes about.

I wrote this as some food for thought that might help some of you - especially those of you who find your storage arrays filling up with mostly-empty forensic images.  Again, I use this piece of software on every forensics or data recovery job I perform. 

Friday, November 11, 2011

Beware the LaCie iamakey!

A customer called regarding his USB device that was no longer working properly. The device is a LaCie iamakey USB drive that has the form factor of a large house key:


The LaCie iamakey USB device



The customer stated that his girlfriend kept the device on her keychain and allowed it to dangle from the front of the computer when she used it. When the device began having problems, she wrapped it in tape and continued. Eventually the drive was no longer functioning and, according to the customer, it would get very hot when plugged in.


Our company doesn't care much for the pretty packaging your drive comes in. External drive enclosures can be replaced - your precious data can't. We operate under the K.I.S.S. principle, so we work directly with the drives themselves. Plus we like taking stuff apart.

Here is the device disassembled:

The unit disassembled into its component parts.


As you can see, most of the weight or "strength" of the device is in the large square portion of the key. The portion containing the flash memory is not reinforced.

Also, when inserted into a USB port and left hanging with a weight attached, the weak point - the fulcrum of the lever, if you will - is just above the 4 contacts.


In the next photograph, we can see a hairline crack that runs diagonally through the medium:


One side of card - notice the cracked casing.



Here is the reverse side of the card. The bend in the card causes it to reflect the camera's flash unevenly:


Opposite side of card with bend highlighted.


Further examination of this card indicates that the crack runs all the way through the circuit board, severing multiple connections that were improperly mated when the card was "fixed," causing a short-circuit and overheating.

Lesson learned: When purchasing a USB device, consider all consequences if its form factor. Sure, a USB device that fits onto your key ring may seem practical. However, if we know anything about human nature, we can formulate a number of great ways to finish this sentence:

"I would normally remove it from the keychain to plug it in, but...."

Saturday, September 3, 2011

Child Safety on the Internet

I’m often asked about the best methods for keeping one’s children safe on the Internet. I generally advise, “Keep your system updated and your anti-virus running.” Those are great guidelines to follow, but they’re honestly just the tip of the proverbial iceberg. I’m going to offer some simple advice here that will likely cause the reader’s mind to instantly fill with a slew of excuses about why it can’t be followed. Nevertheless, here it is: “The best way to protect your kids on the Internet is to watch them. There is no substitute for a pair of eyes.”

No parent would dream of allowing a pedophile, criminal, or any random person to spend extended periods of unsupervised time with their children. However, many parents do that very thing by allowing their children unrestricted and unsupervised access to the Internet. And those who believe their children are safe because they’ve updated their anti-virus and patched their computers are perhaps hurting more than they are helping. People with patched computers are still vulnerable because the weakest link in the security chain (the person at the keyboard) is still there. And their false sense of security often leads them to take more risks, such as letting their children use the Internet alone.

Your children see and do much more on the Internet than you know. Think back to your own youth – the things you got away with. Now throw in instant and uncensored access to any type of information, the ability to act out any fantasies with strangers, and an anonymous line of communication with literally millions of people. Imagine the trouble even good kids can get into with the environment I just described.

And externally there are continuous, unrelenting efforts to break through your system’s security and “pwn” your computer. Much is done by using weaknesses in the computer, but most is aided (usually unwittingly) by the user. Many of the hackers infecting our systems are the same “good kids” who, 20 years ago, would go out at night armed with toilet paper. These days, instead of trespassing and “harmlessly defacing” someone’s tree, they’re hacking into computers and stealing information. And they don’t have to sneak out of the house to do it – their parents grant them access to a powerful weapon to be used in the privacy of their own bedrooms.

Every case I have ever investigated involving a computer used by a teenager has contained pornography and / or sexually-explicit messages between the teen and his / her friends. And, if you follow the current Operation Antisec - the malicious hackers behind attacks on major corporations and government agencies) - on Twitter (#antisec), you will find that many of their supporters, peers, and agents are teens.

I’ve been sitting behind a keyboard for two decades now, and I’ve used a computer to talk to strangers long before the World Wide Web existed. I am aware that some will dismiss my descriptions and advice as shrill hyperbole. However, the truth is that most adults understand the “Internet Threat” the same way their young children conceptualize the word “stranger.” It is a vague, faceless construct that poses some general threat in some unknown way. Indeed, when tempted with the right candy, the average adult is more than happy to jump into the proverbial van.

(More information about how adults are duped in another article)

Friday, July 22, 2011

Shopping Around DOESN'T Pay!

Price versus Value

Next time you are at Wal-Mart or any place that processes photographs, read their money-back guarantee. I assume you'll be infuriated to read that should they fail to develop your photos correctly and thereby ruin your pictures forever, they will only be liable up to the cost of a replacement roll of film. Imagine standing at the counter listening to someone coldly explain to you that, although your memories may be worth something to you, the plain fact is that the film itself is only worth a few dollars. They're absolutely right, and it's a perfectly logical argument. How would it make you feel?

As a man, I have to admit that we are especially guilty of being more like the person behind the counter than the customer with the lost pictures. When a hard drive fails, we look directly past the years of memories. Instead, we focus on the price of a new drive. In doing so, we are focused more on price than we are on value. Currently, as I write this blog post, a 500 gigabyte hard drive costs around $65 and can hold over 100,000 full-size digital photos. I am a father of two. I couldn't look my wife straight in the eye and tell her that those priceless pictures aren't worth more than $65!

Shopping for a "Good" Deal? Please Don't.

Picture this: You have just been in a serious car accident. You lie there, injured and bleeding, waiting for the paramedics to arrive and pull you from your car. As you're being placed in the ambulance, you gather all of your strength to utter three simple words, "Please Shop Around." Right?

No reasonable person would respond this way, but what would happen if you did? Let's imagine that you instruct the ambulance driver to whisk you around:

  1. ... to your house so you can look up do-it-yourself cures on the Internet
  2. ... then to your friend, who uses herbal remedies, incense, and other "amateur" medicines
  3. ... then to a Dentist, who is a Doctor, but in a different field (a Doctor is a Doctor, right?)
  4. ... then to your Family Practitioner, who is great, but isn't trained to handle trauma cases
  5. ... then finally to a Hospital with trained Emergency Room Technicians
What are your chances of survival? You'd either be dead or irreparably damaged before making it to step 5. In each step, you've not only let too much time pass, but you've allowed yourself to be mishandled by well-meaning, yet incompetent individuals.

The list above is completely ridiculous. However, when it comes to their lost data - which equates to lost time, memories, or profits - people do this on a regular basis. Let's look through it step by step:

  1. Do it yourself - Search YouTube and Google for DIY methods from complete strangers. Start downloading various software and choosing options you don't understand. Type weird commands into the computer when you have no idea what they do. Erase some data. Stick the hard drive in the freezer or bang on it (real suggestions!). Possibly damage it completely.

  2. Take it to your friend, the computer geek. He hooks it up to his computer, which, not being forensically sound, (over)writes data on the disk. Spin the drive up again, possibly causing physical damage. (No offense to geeks - we're computer geeks, too! See #5.)

  3. Bring it in to work and have your IT Department look at it. Your IT Department techs are trained to handle software problems, manage the mail system, and keep hackers out of your network - not repair hard drives. More overwrites, more spin-ups, more damage.

  4. Walk in to the Big Box store and give your drive to the Nerd Platoon. They will charge you over $150 for an evaluation fee. They may be "A+" certified, but that certification is for Computer Repair, not Data Recovery. They simply don't have the training or equipment to do anything more than basic file undeleting. (Technicians who have that kind of knowledge don't work for the low wages paid by the big box stores.) When they can't recover your data, they might format (erase) it. Then they will be glad to help you purchase a new hard drive.

  5. Bring your drive to Austin Data Rescue. Our techs are specifically trained to recover data. We do Computer Forensics - which is the art of finding data that isn't supposed to be there anymore, or that untrained users don't realize is there. We are specifically trained and certified for this work, and because it's all we do, we're very good at it. But there's a catch.

    We're the best in the industry, but even we can't fix something if it's been irreparably damaged. Hard drives are extremely fragile once damaged. The tiniest scratch in the wrong (right?) place can render the entire drive unrecoverable. Shopping your drive around, allowing others to (mis)handle it, dramatically increases the likelihood that more damage will occur. This virtually guarantees that your precious work, pictures or documents will be lost forever.
When you've experienced a data loss, go to an expert. Skip directly to step number 5. We'll get your data back!


Joshua Harper GCFE GCFA
Lead Technician
Austin Data Rescue
9600 Great Hills Trail Suite 150W
(512) 693-7668
josh@AustinDataRescue.com

Visit http://www.AustinDataRescue.com for service.

Thursday, July 21, 2011

OMG - The House is ON FIRE!

WAKE UP!

It's 3 o'clock in the morning, and you are awakened by the high pitched shrieks of the fire alarm. The house is filling with smoke. This is the real thing - the house is on fire.

Once you ascertain that every living creature has made it to safety, you realize that you have one chance to grab something and bring it with you. The question is, "What would you grab?" For most people, the answer is something related to a box of keepsakes or family pictures.

A logical followup question is, "Why?" to which most people answer "Because everything else in the house can be replaced."

The scenario above isn't some stretched allegory to make a point. Most of us have asked ourselves those two questions at some point. My next question builds upon the principle of everything else being replaceable: "How much is your data worth?"

I'm afraid many of us fail to fully appreciate the value of those little 1's and 0's. My business clients generally understand this better - data lost = money lost. But for the personal clients I'm blessed to have the opportunity to help, it can take a little work reminding them of their data's value.


Personal Data Represents Time
...
...and time cannot be replaced.


When a client has lost their personal data, there is generally a temporal element to the lost information. Either the data represents years of time spent working on work or on a project, or it represents years of memories. Neither one is replaceable. The time spent to create the data will never be re-invested, and the events, situations, and people will never be the same as they were when captured in a photograph. The value of the information is so high that it cannot be quantified - that's why we call it "invaluable."

Digital Pictures are Cheap...
...so they're actually worth more!

With the proliferation of digital media has come an explosion of digital content. The fact that we don't have to run down to the developer every 24 or 36 shots means we take a lot more pictures. Even if we don't own a camera, most phones have that functionality built in. In many ways, the ease of taking the pictures, and the sheer quantity of pictures taken, has lessened their value to us. However, I'd like to point you in a different direction.

Digging through your box of old photographs is a great way to look into the past. But what are you really seeing? If you're looking at photographs taken a few generations ago, you are likely seeing a posed, staged picture. I have a picture of my grandmother as a young girl. It's a black-and-white photo of her standing next to a fence. She is stiff-looking and composed, like many posed pictures. And it's the only one I've ever seen. For ordinary folks, photography was expensive and rare, so that is likely the only picture taken at that time.

Compare that image with the pictures we take these days where photography is cheap. I bet the pictures of your family and kids show them in action. There is a dynamic, active life to the photos. They show people not as they posed, but as they really lived! To me, this makes the pictures even more valuable.


More Information in One Place = More Memories to be Lost


Imagine someone having thousands of those dynamic, full-of-life pictures from your family's past, all contained in a magic box the size of a deck of cards. Now imagine that person throwing that box in the garbage. Sad, isn't it? Yet when people fear their data is lost, they simply toss it away, or refuse to pay someone to recover it.

Unlike your computer geek buddy, or the neighborhood computer shop, Austin Data Rescue is in the business of getting people's data back. We say this all the time: "That's what we do - that's all we do." For me personally, when someone brings their failing drives or devices into our shop, I have a vested interest in recovering the data. I consider it a privilege to be able to serve others in this way. That's why, for our Standard service, if we cannot recover your data, you will not be charged.

Joshua Harper GCFE GCFA
Lead Technician
Austin Data Rescue
9600 Great Hills Trail Suite 150W
(512) 693-7668
josh@AustinDataRescue.com

Visit http://www.AustinDataRescue.com for service.