Friday, September 26, 2014

How to Terminate a Terminator

Today we celebrate 30 years from the release of The Terminator. The story of a machine which was sent from the future to kill John Connor before he was even born.
Ever since I watched that movie, I was damn afraid that one day the machine will over rise and kill us all. Arnold is quite a scary dude.
What a tough motherfucker.

Recently I decided to cope with my nightmares, and watch the entire series all over again. But this time I’m doing it not to be scared, but to gather information about future robotics to be ready to fight it when the day will come. As a software guy, I decided to focus on what makes these cyborgs tick. And as far as it goes to the first module they sent back in time, a Motorola 6502 is the main CPU.

In the picture above, we can see the very first picture taken from the eye of the Terminator. We see it got some kind of compass (Just like the iPhone), and it compiles some code.
Wait. What?!
Yes, it compiles some code, from source. It's even got remarks to help us understand the code. It defines some constants and then moves to the next operation.

Now it’s done with compiling, so it checks the checksum, to see that there are no errors or malwares in the binary (On the right). On the left side, we can see a binary dump of the code, what brings
up the inescapable conclusion that this CPU got 16bit address space, so bill gates was right after all, 64k should be enough for anyone.

If anyone wants to go through the process I went by he would probably need the instruction set for this CPU, so here is a link to it
Bottom line, the code seems like some kind of checksum calculator subroutine (I hate this name, why not call it a function, subroutine sounds so old).
Next we get a more readable code, with many comments, lucky for us, this cyborg left us lots of debugging information.
We now know the address in memory of much of the code, what would become handy if we would like to exploit this cyborg.
More code on the bottom, and some data table on the left.
At this point of the movie we see the HID of the cyborg for the first time. We see that it’s got many options to choose from, and it takes it a long time to move around the menu and choose the desired answer. What a UI nightmare. Besides, we see that it uses some kind of ASCII art to display stuff on the right top corner, in higher resolution than before, therefore it’s very hard to read it.
Some OCR app, very cool. From now on, I use CAPTCHs for any private detail that might uncover my true location. I thought that the M6502 can’t do much, but then again, these cyborgs must be very good programmers.
Again code checksum, I think the dog has scared the cyborg, so it went into catatonic mode of rechecking everything.
Same code as before, This must be some kind of code that the cyborg must execute before it can work a gun. We defiantly need to find flaws here.
I’m starting to think that the entire cyborg is made out of two subroutines that just checks for errors on each other. Here we find a new kind of application that is not made of any ASCII-art, and might be scanning for something. It’s hard to see since the resolution is very bad here.
Look at this, a car reversing application. It works very fast and it gives results in no time. It uses many English letters and glowing pictures of what you are supposed to push. We are going to have to put some anti-debugging stuff on all the cars from now on.
That's about it for the terminator in this movie, we still got some pictures from future technology such as choppers.
Again lots of Motorola 6502 code, written in the most wired format I have ever seen.

That's about it with this version of the Terminator.
Next we have to deal with two mother fuckers of the next movie titled The Terminator - Judgment Day. One of the cyborgs is of the same module (T-800), we will soon see that it’s got a much different interface. The other is of a newer model (T-1000), made out of some kind of liquid metal. It's a shame that we don’t get to see any view from the eyes of the new cyborg, so we are going to have some troubles trying to kill it. Lets hope the future won't use this one against us. All of the pictures from this movie are of the T-800 point of view.
It scans to find a proper motor vehicle. No code here, we don’t know what kind of CPU it is running on. But we see it’s got a much better interface than the old model. The resolution is a bit better, and the font is much more human friendly. Although, it's still uses some ASCII-art at the table on the left (the stars that separate the title from the data), and why is it all written in English, Isn’t it supposed to be using some kind of binary language, or is this a debug log used by the developers.
The checksums are still there on the left.
Lots of useless data. I wonder if we can overflow the WGHT details with some fat guy, could be an interesting entry point.
Nice enhancement. And we got some code on the left. If it’s a machine code, then it’s RISC CPU and it’s 24 bits in size, not M6502 as far as I know.
Playing arcades, the 80’s were so much fun.
The end indeed.
Good driving application, would take the beats the Google Car, that's for sure. I wonder what the IMAGE LEVEL data stand for.
Next is a scene that is found on the DVD extra features only, in which we get to see a full reboot of the cyborg, lots of useful information.
The code is a bit strange... It's neither hex encoded nor ASCII.
Bingo, now we know the version of the firmware, and we know that it’s possible to upgrade it, maybe to make a nice nanny or a hairdresser out of this terminator. Cyberdyne Systems, lets google that, to see if we have anything to worry about, or anywhere to get a firmware update from.
O no! Apparently there is a company called Cyberdyne Systems,, and they even got a web site. I will drop them an email later to ask for the source code of the Series 800 model T01.
Next is some combat & tactics apps, so be extra careful with that.
That’s a huge potential damage 534053 543596 876 874798 4745757 44
And the alternative power program:
Information about the PCB and internals. It seems like a one layer old type of PCB, not very advanced.
Diagnostics screen, or debugger.
Many analog interferences, must be old CRT technology. Very strange for future technology...
Shuts down just like an old TV set.
Many years later, we got a new movie with again, two cyborgs, but this time we get to see the Point of view of both of them. We will start by examining yet another version of the T-800 Terminator.
It's getting older, but still a good looking by any standard.
The resolution got better. Font is about the same, the information moved to the left side of the display, defiantly a newer version of the interface.
Audio Waveform, must be a new module they got into the code, because this is the first time I see it. The analysis got much more data in it this time, but it seems more like monkey punching on the keyboard data than a machine code.
What's with the small magnifier (bottom left)? It's very good in finding clothes that fit well. I need this machine for the next time I go on shopping.
Not the checksum again!
And what’s with the Z-Buffer, is it like, calculating the distance from the object, is it tries to render some 3d graphics, is it part of the GPU?

Now we are really doomed, finally, after 3 movies they got a color screen! Where did these colors come from all of a sudden?
A big improvement on the UI, everything is set in boxes, and no more silly ASCII-art.
First, create the dialog box to display some information, it takes time...
Then the data appear. Well, the worst it can do is to kill 999 people, let's hope it would spend it on people that I don't like.
A terminator when damaged, starts printing *s and some random parts of the English dictionary. It also gets blurred vision of the data, and many analog interferences. Dude, check the cable, it seems not to be connected.
I told you not to launch all the applications at once, it makes your your system to faulty.
When a terminator is badly damaged, it starts seeing colors, just like a friend of mine who took some nasty stuff back in Goa India.
Next is the other cyborg which must be the most advanced machine we saw in the entire series.
I give up, take me and do your worst!
It’s got everything one might want with his cyborg a bluish awesome display and a modem-fax.
Was that before or after the Facebook?
It’s hard to read, but the title of the picture on the left says it’s running on auto-pilot, while in fact it’s driving a vehicle.
It’s much better than going on a killing spring of all the people with the same name, as it was done on the first movie.
Double checking.
It has this window that looks like a file icon on the left side, and it seems to be open all the time. Could that be a blind spot for the cyborg.
This cyborg got an endless count of features, it got all the apps found in the App Store and the Play Store combined.
Cool 3d rendering of a car on the right.

Too cool to be true.

As for the next movie (that's the 4th one), well, it’s very hard to gather information from this one, because most of the displays looks a little like this:
Or this even this:
There is a small fight going on with a the T-800 in this movie, so we do get a short glance at its new display here:
They finally left the M6502 behind.
They did it again, they changed the UI completely, just when you get used to something, they pull a new version and you have to learn all the shortcuts all over again. The message box seems a little bit similar to the old one, probably some code reusing.

That's about as far as the movies go, but I'm not going to sit back and let them all kill me while there is some much more to learn. Yes, The Sarah Conner Chronicles, which give out many new insights to what might come to hunt us down.
Summer Glau, I love you! Definitely the most beautiful and talented Terminator of them all.
With most enhanced GUI, User interface, Fonts and killing apps.
Termo vision,
And Kendal Safe breaking application.
She is so pretty, I had to put another picture.

Hope this Information would help you survive the next apocalypse which is coming to us on 29/8/1997, wait, what?! Nevermind this information you can forget all about it now...