[Write up] OverTheWire 2019 – Practice typing with 7110

Tram Ho

1. Read the lesson

This is an article about coding capabilities. The subject gives us 8 files including:

  • 3 log file keys from brick nokia 7110 (sms1 / 2 / 3.csv)
  • 3 sms1 / 2 / 3.txt files containing original contents of sms1 / 2 / 3.csv
  • A log file sms4.csv contains the flag content
  • A file defining keys.h keys

Looking through the sms4 356 log file, make sure I am not the lord of the time to sit and work hands, just have to code ?

Open keys.h file:

Basically, these keys are the same as when I was playing with Nokia during class time ? But in addition to straight typing, when reading the log file we can see there are other activities such as moving the cursor, deleting …

To be true to the idea of ​​the creator, I will code 1 tool to retype based on the results from the log file. There are 2 ways to code here:

  • Method 1: Code read log file and print string, when encountering the navigation keys, just print the key name and do it yourself.
  • Method 2: Code tool controls keyboard for machine to type automatically.

Because I was lazy, I chose option 2 ?
I code tool typing in python, using pynput

2. Analysis

2.1 Nokia 7110 phone

I did not write the wrong title: v To code out, you have to see how this 7110, here is a picture of it: Regarding the number keys, the text is normal, but it does not have a navigation key. Instead 7171 has an additional scrollbar like on a computer mouse.

2.2 Pynput library

pynput is a library that supports controlling input devices such as keyboards and mice. In this article, we only need to care about how to control the keyboard.

To control the keyboard, you need to add a list of keys and control methods. You can read the article Controlling the keyboard with pynput here.

One small thing to note is that the keyboard control will start as soon as the code runs, the keys will be typed right at the location of the text cursor, regardless of where it is located. So let the program sleep for a few seconds before starting to run to have time to click on the empty text file.

2.3 Key log file

Each log file consists of 2 columns:

  • The first column is the time for pressing the key
  • The second column is the key pressed

Do not skip column 1. Why ?

Notice the contents of the sms1.txt file as follows: "rudolf where are you brrr".
See the "rrr" text, in the log file, that's 9 times of typing 7: 3

According to my analysis, if the time between 2 key presses> 1000, it means that I have stopped to type new characters. Otherwise, a character is still selected.

3. Code

In the analysis I also talked about the Nokia 7110 only has scroll bars instead of 4 navigation keys. The effect of that bar is actually in place of 2 left – right navigation keys. Scrolling the cursor will move to the left, scroll down the cursor will move to the right.

In addition to typing the wrong, it must be deleted again, this time the MENU_RIGHT key (key code = 101) will correspond to the Backspace key on the computer keyboard.

Keycode 7110 Keyboard
101 MENU_RIGHT Backspace
102 MENU_UP Left
103 MENU_DOWN Right

I still don't know what the keycode = 11 (Convert T9 <-> ABC) for, nor does it affect the flag


Capitalize aotw flag: AOTW {l3ts_dr1nk_s0m3_eggn0g_y0u_cr4zy_d33r}

Share the news now

Source : Viblo