Created
May 22, 2022 23:46
-
-
Save becojo/29c9671b9fe2cee014e8d7711a6c583f to your computer and use it in GitHub Desktop.
Northsec 2022 CTF - Rego Prototype Review
This file contains 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
package challenge1 | |
default correct_flag = false | |
mycorize(s) := replace(replace(s, "o", "0"), "i", "y") | |
correct_flag { | |
words := ["champ", "mycoverse", "exo", "meta", "cyber", "block", "chain", "life"] | |
parts := split(input.flag, "-") | |
parts[1] == mycorize(words[x]) | |
indexof(input.flag, "4") == 15 | |
parts[3] == mycorize(words[y]) | |
[parts[0], x, y] == ["FLAG", 1, 7] | |
} |
This file contains 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
package challenge2 | |
default correct_flag = false | |
parts = split(input.flag, "-") | |
flag = split(parts[1], "") | |
correct_flag { | |
parts[0] == "FLAG" | |
regex.match("[0-9a-f]{18}", parts[1]) | |
check_flag | |
} | |
check_daeb6676fb { | |
checks = ["{2,5,f,e}", "{f,e,0}", "{7,a}", "{0,3}", "{8,3,4}", "{9,3}", "{b,6}", "{3,1}", "{7,0}", "{5,6,7,f}", "{4,d,3,b}", "{0,6}", "{5,7,d,0}", "{b,0,f}", "{0,2}", "{e,6}", "{5,4,a,3}", "{9,a,8}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_6fab77bfa0 { | |
checks = ["{1,0}", "{0,3,5,1}", "{a,8,1,d}", "{f,b,a}", "{8,4}", "{f,2}", "{e,0,9,8}", "{8,d}", "{b,9}", "{e,6}", "{4,8}", "{c,e,a}", "{2,b,0}", "{4,3}", "{2,c,9,b}", "{e,0,6,1}", "{8,7,b,e}", "{a,2}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_1303f08f3b { | |
checks = ["{8,c,5}", "{b,1,7,f}", "{9,7,c}", "{0,e}", "{3,1}", "{0,e,7,6}", "{6,5,e}", "{9,c,4,3}", "{5,f,d}", "{8,f,7}", "{1,a,f}", "{4,0}", "{8,3,9}", "{1,4}", "{a,2}", "{6,3}", "{4,f,6}", "{4,e,f}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_1e7696120e { | |
checks = ["{0,5}", "{2,a,3}", "{8,7,e,f}", "{3,8,7,9}", "{2,6,9,7}", "{1,7}", "{d,b,a,5}", "{a,c,b}", "{a,7,1}", "{3,9,2,5}", "{8,2,7}", "{d,a,1,5}", "{8,3}", "{8,3,d}", "{0,b,9}", "{0,1}", "{b,c,1}", "{4,2}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_7dfd706380 { | |
checks = ["{2,a,3}", "{3,a,6,2}", "{5,4}", "{d,7,b,f}", "{6,2,7}", "{a,3,b,1}", "{5,4}", "{1,6}", "{2,b,d}", "{3,a}", "{d,5}", "{f,c,b}", "{7,4,e,8}", "{6,0,5,8}", "{9,d,3,e}", "{9,c,5}", "{d,8,b}", "{0,e,7,8}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_428af9a07f { | |
checks = ["{c,d,1,5}", "{3,7,d,6}", "{b,d,4,f}", "{f,b,6}", "{9,e,c,8}", "{2,a,1}", "{1,0,8,e}", "{9,1,5,a}", "{2,b}", "{5,b,c,f}", "{8,f}", "{c,3}", "{b,2,4}", "{e,4,9}", "{4,0,9}", "{1,b}", "{f,7}", "{a,4,1,c}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_31c7b0af16 { | |
checks = ["{a,c}", "{1,e,8}", "{3,c,4,6}", "{6,d,8,0}", "{b,5,d,2}", "{a,2}", "{4,0,f,7}", "{7,5,4,e}", "{7,2,1,d}", "{7,2,b}", "{6,2,5}", "{9,b}", "{4,5}", "{d,2}", "{7,a,d,b}", "{b,0,2,7}", "{d,f,1}", "{e,8,2,6}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_549bdbab83 { | |
checks = ["{3,9,8}", "{2,7,e,4}", "{9,4,7}", "{3,0,f,1}", "{5,b}", "{f,3}", "{f,1}", "{f,e}", "{c,1}", "{e,3,4}", "{1,a,2}", "{e,c,9}", "{9,7,5,1}", "{9,1}", "{d,9,3,8}", "{2,0,5}", "{e,0,1,4}", "{e,2,c,1}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_544db8ad08 { | |
checks = ["{8,7,0,2}", "{2,7,3,f}", "{2,f,9,d}", "{6,9,2}", "{9,c}", "{7,0}", "{4,a,b}", "{c,6,b}", "{9,8,e}", "{6,9,3}", "{f,6,e,5}", "{6,7,0,b}", "{9,7}", "{6,9,0}", "{d,b}", "{e,9,0,d}", "{1,5,a}", "{d,4,8,0}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_8d627e437c { | |
checks = ["{e,2,4}", "{b,d}", "{6,2,3}", "{5,b,3,1}", "{a,d,9,f}", "{f,d,e}", "{0,e,6}", "{8,4}", "{7,0,8,1}", "{c,5,0,8}", "{8,5,b,3}", "{5,f,7,a}", "{8,1}", "{8,f,7}", "{2,1,b,6}", "{e,6}", "{6,e,7}", "{f,4,0}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_a1ab717ea8 { | |
checks = ["{2,b,7}", "{d,e,f}", "{a,9,8,e}", "{2,6}", "{b,c,2}", "{9,6,e,4}", "{4,b,1}", "{8,c,9}", "{f,5,d,1}", "{3,8}", "{5,7}", "{5,1}", "{9,4}", "{0,5,c,b}", "{5,a,e,3}", "{7,c}", "{c,5}", "{5,f,c,a}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_2a472fcb62 { | |
checks = ["{e,9,5}", "{0,d,6}", "{8,4,7}", "{f,9}", "{d,8,2}", "{d,b,c,e}", "{4,0,a,5}", "{4,7,b}", "{1,c,6}", "{7,f,a}", "{f,5,3,6}", "{d,e,7}", "{d,8,2,7}", "{b,e,3,c}", "{7,8,e}", "{d,2}", "{3,e,f,6}", "{0,6,3,f}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_32ad655751 { | |
checks = ["{5,7,8}", "{2,b,3,1}", "{d,4,a}", "{2,8,7}", "{6,5,9}", "{6,0,c,f}", "{c,8,1,6}", "{c,e,1,4}", "{1,6,f,2}", "{d,6,b}", "{2,6}", "{1,b}", "{2,6,7,5}", "{f,b,7,c}", "{0,c,d}", "{c,2,e,4}", "{5,f,2}", "{3,8,5,9}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_dd21d3c001 { | |
checks = ["{b,7}", "{6,4}", "{4,6,7,b}", "{e,0,f,3}", "{1,7,4,d}", "{6,8,9,2}", "{1,8}", "{8,9}", "{c,7,5,d}", "{b,8}", "{f,6}", "{c,f,d}", "{1,4}", "{e,8}", "{c,6,4}", "{4,c,3,9}", "{0,b,f}", "{e,c,a,5}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_5ef3d7283b { | |
checks = ["{d,8,2,a}", "{0,d,6,c}", "{2,b}", "{d,4,3}", "{f,6,b,2}", "{2,1,d,b}", "{f,d}", "{8,7,3}", "{8,0,6}", "{f,0}", "{a,4}", "{0,e}", "{2,8,5}", "{c,1,b}", "{7,2,4,1}", "{5,c}", "{1,a}", "{c,2,0}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_122e25ab7a { | |
checks = ["{1,e,2}", "{1,4,0}", "{c,9}", "{5,3,a}", "{4,8,d}", "{1,a}", "{0,a,6,d}", "{c,d,a}", "{8,1,0,2}", "{f,b,3}", "{7,8,1}", "{9,5,c}", "{a,0}", "{4,9,c,2}", "{7,e,a}", "{0,5,9,4}", "{5,4}", "{d,1,f}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_a592a1319d { | |
checks = ["{d,e,8,b}", "{4,7,e}", "{6,a,9}", "{d,2,3,4}", "{4,d}", "{0,1,c,8}", "{d,8,6,4}", "{7,9,4}", "{c,6}", "{d,5}", "{2,8,a,d}", "{d,7}", "{f,d}", "{e,7}", "{e,4,7}", "{2,4,7,b}", "{3,a,b}", "{f,c,8,7}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_c657345566 { | |
checks = ["{a,2,0,b}", "{c,8,5,6}", "{1,9,3}", "{4,e,a,f}", "{f,6,c}", "{9,a,c,8}", "{5,8,e}", "{8,f}", "{b,9}", "{e,7,f,0}", "{3,4,6}", "{6,1}", "{f,2,8,4}", "{c,f,e}", "{6,0,b,8}", "{b,5,4}", "{d,e}", "{d,8}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_7c7db63c8b { | |
checks = ["{5,e,2}", "{b,2,6,8}", "{7,6,2,4}", "{9,d}", "{c,4,3,f}", "{e,f,d}", "{b,c}", "{b,8,4}", "{0,f,5,d}", "{7,0,4,b}", "{f,7}", "{1,f}", "{a,0,7}", "{6,2,b}", "{9,1,6}", "{1,d,c,b}", "{1,7,2,d}", "{8,9,7}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_13feb5fbad { | |
checks = ["{b,0,5}", "{b,3}", "{7,d,c}", "{2,7}", "{f,8}", "{4,f,1,0}", "{4,8,1}", "{5,3,c,b}", "{8,5,6}", "{f,a,7,6}", "{1,9}", "{5,3,1}", "{4,0}", "{6,b,1,4}", "{1,2}", "{7,9,e,6}", "{0,6}", "{3,d,e,0}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_818e5b66b1 { | |
checks = ["{9,5}", "{0,8,e,c}", "{e,d,2}", "{9,a,6,5}", "{2,4}", "{0,e}", "{0,8,d,1}", "{5,c,b}", "{0,e}", "{6,b}", "{b,a,d,3}", "{f,6,7,4}", "{4,e,8}", "{e,c}", "{6,7,3}", "{4,d,0}", "{b,a}", "{5,6,c,9}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_a40912a851 { | |
checks = ["{f,3,9,5}", "{7,a,3,1}", "{8,e,b,2}", "{d,a,e}", "{9,f,b}", "{4,1}", "{c,3,7,b}", "{6,3,a,7}", "{f,2,e}", "{f,3,8,0}", "{6,b,7}", "{0,a,8,e}", "{5,6,0,b}", "{c,4,9}", "{e,a,6,1}", "{0,c,5}", "{0,5}", "{3,a}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_06e9b90392 { | |
checks = ["{1,2,8,b}", "{0,b,2}", "{a,8}", "{0,f,4}", "{c,a}", "{0,c}", "{6,3,e,5}", "{d,0}", "{f,b}", "{0,c}", "{3,1,6}", "{9,6,c}", "{5,1}", "{d,7,8,4}", "{0,9,7,c}", "{b,5,4}", "{b,7}", "{4,1}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_6a9b5a6923 { | |
checks = ["{b,a}", "{0,c}", "{6,f,2,c}", "{4,e}", "{8,5}", "{a,1}", "{4,a,1,f}", "{e,8}", "{b,2,d}", "{6,0,4}", "{d,1,6,2}", "{6,7,9}", "{f,a,4}", "{3,6,7}", "{e,c}", "{b,4,6,1}", "{2,d,5,0}", "{9,4}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_88634b49bd { | |
checks = ["{a,3,c,e}", "{8,5,2}", "{b,4}", "{f,9}", "{6,2}", "{f,6}", "{9,b,3}", "{1,5,4}", "{1,5}", "{e,c}", "{2,7,4}", "{6,0,7,f}", "{8,2}", "{9,1,2,6}", "{9,c}", "{2,4,3,d}", "{f,b,0}", "{e,a,4,8}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_0d9a709c04 { | |
checks = ["{5,9}", "{b,4,e,c}", "{1,4}", "{2,a,3}", "{6,d,c}", "{3,e,b,0}", "{7,e,a}", "{7,d,f,8}", "{4,9,7,1}", "{f,8,3,d}", "{6,7,0,9}", "{c,6}", "{5,d,e}", "{1,3,f,8}", "{1,9}", "{7,6}", "{4,0,3}", "{4,3,9}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_c52d9dc000 { | |
checks = ["{d,5,9}", "{f,b}", "{b,d}", "{3,8,b,e}", "{1,d,8,3}", "{2,f,e}", "{1,9,e,b}", "{f,6,8,a}", "{0,e}", "{0,b}", "{a,7,2,d}", "{d,3,b,1}", "{1,0,7}", "{5,2,c,e}", "{6,3,7}", "{e,8}", "{5,1}", "{1,7,5}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_4ef6d355b8 { | |
checks = ["{f,8,e}", "{d,a,1}", "{b,d,6}", "{1,7,2}", "{1,8,b,f}", "{a,b,1,d}", "{5,a}", "{c,a,f}", "{7,e,6}", "{f,0}", "{6,e,9,d}", "{9,6}", "{b,3,4,a}", "{1,0,f,5}", "{e,6}", "{3,c,4}", "{8,c}", "{6,e}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_564539041c { | |
checks = ["{2,1,d}", "{3,a,f,6}", "{5,1}", "{f,9,b,1}", "{2,1,9}", "{3,2,b,e}", "{0,5,d}", "{1,f,9}", "{8,a,7,b}", "{d,e,a,c}", "{d,7,f,a}", "{f,a}", "{f,d,0}", "{3,9,4,e}", "{c,0,b,5}", "{4,5,1,7}", "{4,f}", "{e,5,4,f}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_736ca3e0fa { | |
checks = ["{9,c,8,3}", "{3,4,d}", "{1,9}", "{f,b}", "{5,8,3,6}", "{a,b}", "{8,6}", "{6,f}", "{d,4,9}", "{9,e}", "{5,8,7}", "{6,8}", "{0,2}", "{5,3}", "{e,a,1}", "{6,d,9,5}", "{7,a}", "{3,c}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_a896cae94d { | |
checks = ["{a,7,3,2}", "{5,b,c,4}", "{9,2,d,a}", "{a,3}", "{b,d}", "{b,f,0,a}", "{0,5,a,e}", "{e,0,b}", "{8,6,f,d}", "{7,6}", "{4,b,e}", "{9,3,5}", "{f,6}", "{5,e,3,c}", "{0,2,7}", "{d,6}", "{2,b}", "{7,5,0,1}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_f50c810345 { | |
checks = ["{e,a,9,b}", "{1,0}", "{f,4,8}", "{4,5,0}", "{b,6,7}", "{e,9}", "{c,d,b}", "{5,1,e}", "{d,2,0,7}", "{7,c}", "{3,4,7,6}", "{7,5,0,e}", "{7,5}", "{1,c,0,8}", "{8,b}", "{2,6,a}", "{0,5}", "{1,9,3,d}"] | |
glob.match(checks[i], [], flag[i]) | |
} | |
check_flag { | |
not check_daeb6676fb | |
not check_6fab77bfa0 | |
not check_1303f08f3b | |
not check_1e7696120e | |
not check_7dfd706380 | |
not check_428af9a07f | |
not check_31c7b0af16 | |
not check_549bdbab83 | |
not check_544db8ad08 | |
not check_8d627e437c | |
not check_a1ab717ea8 | |
not check_2a472fcb62 | |
not check_32ad655751 | |
not check_dd21d3c001 | |
not check_5ef3d7283b | |
not check_122e25ab7a | |
not check_a592a1319d | |
not check_c657345566 | |
not check_7c7db63c8b | |
not check_13feb5fbad | |
not check_818e5b66b1 | |
not check_a40912a851 | |
not check_06e9b90392 | |
not check_6a9b5a6923 | |
not check_88634b49bd | |
not check_0d9a709c04 | |
not check_c52d9dc000 | |
not check_4ef6d355b8 | |
not check_564539041c | |
not check_736ca3e0fa | |
not check_a896cae94d | |
not check_f50c810345 | |
} |
This file contains 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
package challenge3 | |
default correct_flag = false | |
parts = split(input.flag, "FLAG-") | |
flag = split(parts[1], "") | |
f(s) = sp { | |
c := flag[s.i] | |
g[s.s][0] == c | |
j := count({ x | array.slice(flag, 0, s.i)[x] == c }) | |
sp := { "i": s.i + 1, "s": g[s.s][2][j] } | |
} | |
g = [["y",1,[11]],["n",1,[13]],["-",3,[12,10,9]],["h",1,[2]],["u",1,[9]],["l",1,[8]],["b",1,[13]],["t",1,[3]],["i",2,[7,4]],["m",3,[13,0,null]],["w",1,[8]],["c",2,[12,13]],["o",2,[9,1]],["e",4,[11,2,2,5]]] | |
hash := crypto.sha256(parts[1]) | |
correct_flag { | |
g[s][0] == flag[0] | |
f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f({ "i": 0, "s": s })))))))))))))))))))))))).i == count(flag) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment