Ulli Weichert/ April 2, 2022/ IT-Security, Write-Ups/ 0Kommentare

basic-mod2

Description

A new modular challenge!
Download the message here.
Take each number mod 41 and find the modular inverse for the result. Then map to the following character set: 1-26 are the alphabet, 27-36 are the decimal digits, and 37 is an underscore.
Wrap your decrypted message in the picoCTF flag format (i.e. picoCTF{decrypted_message})

Solving

This challenge is similar to the basic_mod1 just with a different mod and mod inverse.
Without further delay, directly to the script to solve the challenge:

#!/usr/bin/env python

from sympy import mod_inverse

charset = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","_"]

flag = "picoCTF{"

encfile = "message.txt"

print("Try to decrypt file " + encfile)

with open(encfile, 'r', encoding='utf-8') as file:
    for line in file:
        numbers = line.split()
        for number in numbers:
            flag = flag + (charset[(mod_inverse(int(number),41))-1])

print("If anything worked... this should be the flag...")
print(flag + "}")
Share this Post

Über Ulli Weichert

2004 fing Ulli bei der Bundeswehr als Ausbilder und IT-Spezialist an. 2011 hat Ulli eine Umschulung zum Fachinformatiker für Systemintegration absolviert und sich auf Linux spezialisiert. 2016 hat Ulli dann bei einem mittelständischem Unternehmen, welches Kunden in ganz Deutschland betreut, als Linuxadministrator angefangen und kümmert sich seither nebst, Netzwerk, Security, Firewall, Storage überwiegend um Linuxthemen aller Art. Seit kurzem hat auch Ihn das Thema Container und k8s erwischt.

Hinterlasse einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*
*