# We simulate the scene of picking a PIN from “Terminator 2”

In the beginning of the movie Terminator 2: Judgment Day John Connor uses a laptop to brute-force the PIN of a stolen debit card.

I don’t think I saw Terminator 2 in the theater. I probably watched it a few years later on LaserDisc, but this scene made a pretty strong impression. A similar reaction was caused by the dialer from “War Games” and a black box from Tikhushnikov

The War Dialer from War Games (1983)

Black box from “Tikhushniki” (1992)

I recently remembered this scene from Terminator 2, so I started googling “laptop from Terminator 2”.

It turned out to be Atari Portfolio – the world’s first palmtop computer (“handheld” computer). It was released in June 1989.

The computer had a monochrome LCD display with a resolution of 240×64 pixels or 40 characters x 8 lines and was powered by three AA batteries.

Then I wondered how difficult it would be to write such a program. Not a program that actually cracks the PIN of a debit card (I don’t think this is actually possible with a serial cable and aluminum foil wrapped around the card), but a program that can simulate the display of a palmtop in this scene.

First, let’s study the necessary technical requirements!

If you watch the video carefully, you will see that the program banner is displayed first.

The image is clear enough that we can easily copy the banner.

``````PPPPP   IIIIIII   N    N
P   PP     I      NN   N IDENTIFICATION
P   PP     I      N N  N
PPPPP      I      N  N N   PROGRAM
P          I      N   NN
P       IIIIIII   N    N

Strike a key when ready ...``````

After that John presses Enter and numbers begin to scroll on the screen. If you look after a few frames:

then we will see that the first line of numbers looks like this:

``12345678901234567890123457890123456780``

One would assume that these are just digits 1 through 0 repeated four times, but upon closer examination it turns out that the string is only 38 characters long. In the third repetition, the number 6 is missing, and in the last, the number 9.

The principle of decreasing numbers is also not obvious, but it looks like the program prints out about 5 lines of a certain length, and then decreases the length by 1, but after the next set, it decreases the length by 2, and then alternately uses the decrease by 1 and 2 until it determines the PIN of four digits, which is printed to the command line.

Well, it looks pretty simple. I was learning Python, so I wrote a Python 3 script:

``````#!/usr/bin/env python3
import time
import random

delay = 0.025

print("PPPPP   IIIIIII   N    N")
time.sleep(delay)
print("P   PP     I      NN   N IDENTIFICATION")
time.sleep(delay)
print("P   PP     I      N N  N")
time.sleep(delay)
print("PPPPP      I      N  N N   PROGRAM")
time.sleep(delay)
print("P          I      N   NN")
time.sleep(delay)
print("P       IIIIIII   N    N")
time.sleep(delay)

print('')
input("Strike a key when ready ...")

print("nn12345678901234567890123457890123456780")

lines = 1

length = 38
decrease = 1
while True:
for i in range(0, length):
print(random.randint(0,9), end='')
print('')
time.sleep(delay)
lines += 1
if (lines == 5):
lines = 0
length -= decrease
if (decrease == 1):
decrease = 2
else:
decrease = 1
if (length <= 4):
break
for i in range(0, 10):
print("9003")

print("nPIN IDENTIFICATION NUMBER: 9003")

print("na>", end='')``````

The script is very fast, so I added a delay between the lines to keep the speed the same as in the movie clip. I’m sure the code can still be optimized, but if I saw it as a task of writing bad code in a technical interview, I would think I did it.

Using a google image search, I found a site that sells plastic panels for the Atari Portfolio with beautiful graphics on the screen:

Experimenting a bit with termtosvg, in particular, with the function SVG templates, I was able to create this insane SVG:

Despite the fact that I have supported html5zombo.com, before creating this SVG, I did not appreciate all their capabilities. Can they embed images? CSS? Javascript? Any site that allows users to upload arbitrary SVGs and render them, has now received my greatest respect.

As I amused myself with creating my little standalone SVG, the thought persisted in the thought that my Python code would never actually run on the Atari Portfolio. The Atari Portfolio has “DIP Operating System 2.11” (DIP DOS) installed, which is “mostly compatible” with MS-DOS.

In my early years of high school, even before I got paid to write software professionally, I wrote software for BBSs, mods and games in a mixture of Turbo Pascal and a PCBoard Programming Language, which was reminiscent of BASIC. With minimal research, I figured out that if I can write a Turbo Pascal program and compile it, it will probably run on the Atari Portfolio.

I haven’t written Turbo Pascal in almost 25 years, but it doesn’t get forgotten?

I like the DOSBox fork called DOSBox-Xso I downloaded and installed the latest SDL2 version for OS X. Then I found Borland Turbo Pascal 7.0, which I will put herebecause looking for him was a real torment.

In this ZIP, you will find four files that are floppy disk images. If you put them in a folder, for example, `~/tp`, after running DOSBox-X and mounting drive C, you should be able to mount them as drive A as follows:

``imgmount a ~/tp/Disk01.img ~/tp/Disk02.img ~/tp/Disk03.img ~/tp/Disk04.img -floppy``

then switch to drive A: and run INSTALL:

``````A:
INSTALL``````

Floppy disks have to be replaced from time to time, since it was 1992.

This can be done by selecting in DOSBox-X Drive -> A -> Swap disk… This will transition from Disk 1 to Disk 2. Then just keep repeating the process and hitting Enter until all four drives are installed.

After the installation is complete, she will ask you to configure `CONFIG.SYS` and `AUTOEXEC.BAT` (don’t forget, this is 1992).

Neither is necessary. DOSBox-X already sets the FILES value higher than necessary, and adding to the paths just allows you to run TURBO from anywhere. Once completed, you can run the following command:

``````C:
cd tpbin
TURBO``````

As a child, I spent so much time with this IDE that now I felt a kind of nostalgia. But then I started porting my Python script to Pascal and the nostalgia quickly faded. I wish I could say that I wrote everything entirely in the IDE, but at some point I had to go to VSCode, and then copy the file back to the DOS folder. People who still work in WordPerfect for DOS, I understand you, and I do not understand.

Here is the script I got after spending a lot of time on this Pascal tutorial:

``````program pinid;
uses crt;

var i: byte;
var pos: byte;
var lines: byte;
var length: byte;
var decrease: byte;
var delay_amount: integer;

begin
randomize;

delay_amount := 25;

clrscr;

writeln('PPPPP   IIIIIII   N    N');
delay(delay_amount);
writeln('P   PP     I      NN   N IDENTIFICATION');
delay(delay_amount);
writeln('P   PP     I      N N  N');
delay(delay_amount);
writeln('PPPPP      I      N  N N   PROGRAM');
delay(delay_amount);
writeln('P          I      N   NN');
delay(delay_amount);
writeln('P       IIIIIII   N    N');
delay(delay_amount);
writeln('');

write('Strike a key when ready ...');

writeln('');
writeln('');
writeln('12345678901234567890123457890123456780');

pos := 0;
lines := 1;

length := 38;
decrease := 1;

while true do
begin
for i:= 1 to length do
write(random(9));
writeln('');
delay(delay_amount);
lines := lines + 1;
if (lines = 5) then
begin
lines := 0;
length := length - decrease;
if (decrease = 1) then
decrease := 2
else
decrease := 1;
end;
if (length <= 4) then
break;
end;

for i:= 1 to 10 do
begin
writeln('9003');
delay(delay_amount);
end;

writeln('');
writeln('PIN IDENTIFICATION NUMBER: 9003');
writeln('');

end.``````

Brief explanations:

• Pascal has type declarations. The byte type can be a number in the range 0-255.
• Files start with `program` and the program name, probably because all modules share a common namespace, but the filename is not important.
• Modules are imported by word `uses`… Module `crt` used to manipulate the screen.
• : = is the syntax for assigning a value to a variable so that you can compare using = and distinguish them from each other.
• If blocks are longer than one line, they need to be wrapped in `begin` and `end`, not in curly braces or spaces.
• If at the beginning of the script do not execute `randomize`, then the generated random numbers will always be the same as the output strings.
• WRITE outputs a line, WRITELN outputs a line with a line feed. READLN receives input before receiving a line feed.

Does the code work? Here’s a program running in DOSBox-X:

In order not to buy unnecessary things, I did a mental exercise, imagining what is needed for the further implementation of the project:

1. Buy on Ebay Atari Portfolio.
2. Buy a parallel Atari Portfolio interface and probably a new front panelbecause the old one is probably scratched.
3. Find a parallel cable in my cable box.
4. Find a PC or laptop with a parallel port, install MS-DOS v6.22 on it.