Homemade_Keeloq_I

Flag: ECW{cRyPt0gr4pHy_Is_t00_Hard_1468}

Challenge

file-archive
4KB
arrow-up-right-from-squareOuvrir
circle-info

Description


Your mission : Find the next key value, more information given in the source.

Flag is in the format ECW{cRyPt0gr4pHy_Is_t00_Hard_NEXTKEY}. NEXTKEY being the next 16 bit key in decimal format.

Challenge made by:

Solution

On a un enregistrement fait avec un Flipper Zero, il va falloir parser les raw data Γ  la main. En gros, on cherche des paires de nombres qui font 1800Β΅s. On va se base sur la porteuse et le silence pour dΓ©terminer les 1 et les 0.

Bit
Silence (OFF)
Porteuse (ON)
Total

1

~700 Β΅s

~1100 Β΅s

~1800 Β΅s

0

~1400 Β΅s

~400 Β΅s

~1800 Β΅s

En python, Γ§a donne :

with open('obscure_portal.sub', 'r') as f:
  lines = [line for line in f.read().splitlines() if line.startswith('RAW_Data')] 
  data = [[int(n) for n in line.split(': ', 1)[1].split(' ')] for line in lines]


def near(n, of, epsilon):
  return 0 <= abs(n - of) < epsilon

def parse_raw(raw: list[int]):
  epsilon = 100
  binary = ''
  i = 0
  while i < len(raw)-1:
    if near(raw[i], -700, epsilon) and near(raw[i+1], 1100, epsilon):
      binary += '1'
      i += 1
    elif near(raw[i], -1400, epsilon) and near(raw[i+1], 400, epsilon):
      binary += '0'
      i += 1
    i += 1
  return binary

def main():
  for raw in data:
    binary = parse_raw(raw)
    print(f'({len(binary)}) {binary}')
    
main()

66 bits, c'est exactement la structure d'un Keeloq. Voici un peu Γ  quoi une trame ressemble :

Le compteur est sur les 16 derniers bits. On peut continuer le parsing pour afficher ses valeurs :

Le compteur s'incrΓ©mente de 3 Γ  chaque fois, le prochain est donc 1468.

Mis Γ  jour