Rating:

# Day 1 - 7110 - keylogger, programming

> Santa is stranded on the Christmas Islands and is desperately trying to reach his trusty companion via cellphone. We've bugged the device with a primitive keylogger and have been able to decode some of the SMS, but couldn't make much sense of the last one. Can you give us a hand?

Download: [f01d32e3f32957cf42f9672e78fcb415c6deac398fdacbd69531a322b08a39c8-7110.tar.gz](https://advent2019.s3.amazonaws.com/f01d32e3f32957cf42f9672e78fcb415c6deac398fdacbd69531a322b08a39c8-7110.tar.gz)

Mirror: [7110.tar.gz](./static/f01d32e3f32957cf42f9672e78fcb415c6deac398fdacbd69531a322b08a39c8-7110.tar.gz)

## Analysis

This challenge was one of the easier ones of the competition. It presented several pairs of `csv` and `txt` files along with a `keys.h` header file. The `csv` files contained a list of timestamps (in milliseconds) and keypress integer values. I slightly remember how these keypads work - namely that you can press the same key several times and select the correct character, but if you wait a long enough time then it will advance one position to the next character.

After a little trial-and-error, I found that the time cutoff for advancing to the next character was one second (1000 milliseconds). I wrote up a [short script](./solutions/day1.py) to decode the `csv` files and ran it against the last one (which didn't have a corresponding `txt`) gave the flag:

```
$ ./day1.py
ANSWER: [-1,0][100,3][11,1]alright pal hers[102,0]e[103,0] ye flag good lucj enter[102,6][103,0][101,0]k[103,5]ing it with those hooves lol its aotw{l3ts_dr1nk_s0m3_eggnog[101,1]0g_y0u_cr4zy_d33r}[100,1]0m.. .l ,p[100,0]
```

Note that the output isn't quite correct as I didn't decode the `N7110_KEYPAD_MENU_LEFT` key in my script, but as you can imagine the `eggnog[101,1]0g` resolves to `eggn0g`.

Original writeup (https://github.com/nononovak/otwadvent2019-ctfwriteup/blob/master/day1_7110.md).