Created
December 12, 2022 19:07
-
-
Save torgeir/bcd297dcfbffe3aa5bbc6a98b594d66f to your computer and use it in GitHub Desktop.
The beginning of pico ctf 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns pico) | |
;; basic-mod1 | |
;; | |
(def data [91 322 57 124 40 406 272 147 239 285 353 272 77 110 296 262 299 323 255 337 150 102]) | |
(def alph | |
"0-25 is the alphabet (uppercase), 26-35 are the decimal digits, and 36 is an underscore." | |
(clojure.string/split "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" #"")) | |
(->> data | |
(map #(mod % 37)) | |
(map #(alph %)) | |
(clojure.string/join "")) | |
;; basic-mod2 | |
(def msg-basic-mod2 (slurp "https://artifacts.picoctf.net/c/500/message.txt")) | |
(defn modinverse [a m] | |
"https://stackoverflow.com/questions/4798654/modular-multiplicative-inverse-function-in-python" | |
(->> (range 1 m) | |
(filter (fn [x] | |
(when (= 1 (mod (* (mod a m) (mod x m)) m)) | |
x))) | |
(first))) | |
(defn flagify [s] (format "picoCTF{%s}" s)) | |
(defn parse-int [s] (Integer/parseInt s)) | |
(->> (clojure.string/split msg-basic-mod2 #" ") | |
(map parse-int) | |
(map #(mod % 41)) | |
(map #(modinverse % 41)) | |
(map dec) | |
(map #(alph %)) | |
(clojure.string/join "") | |
flagify) | |
;; 3 | |
;; | |
;; 99 tegn? | |
;; 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 | |
;; 4 | |
;; | |
;; 378 | |
;; cvpbPGS{P7e1S_54I35_71Z3} | |
;; https://www.dcode.fr/caesar-cipher, mens jeg venta på brew install ciphey | |
;; 5 | |
;; | |
;; https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527 | |
;; picoCTF{CVE-2021-34527} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment