Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Codefest CTF/b1n4rY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
We are given a binary list of pixels:

```
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000110000110000111111001100000000000000111111111111111111111111111111000000000000001100001100001111110011000000000000001111111111111111111111111111110011111111110011111100000011111111110011111111110011111111111111111111111111111100111111111100111111000000111111111100111111111100111111111111111111111111111111001100000011001111000011111100001111001100000011001111111111111111111111111111110011000000110011110000111111000011110011000000110011111111111111111111111111111100110000001100110000110011000000111100110000001100111111111111111111111111111111001100000011001100001100110000001111001100000011001111111111111111111111111111110011000000110011001100111111000011110011000000110011111111111111111111111111111100110000001100110011001111110000111100110000001100111111111111111111111111111111001111111111001100110000001100110011001111111111001111111111111111111111111111110011111111110011001100000011001100110011111111110011111111111111111111111111111100000000000000110011001100110011001100000000000000111111111111111111111111111111000000000000001100110011001100110011000000000000001111111111111111111111111111111111111111111111000011000011001111111111111111111111111111111111111111111111111111111111111111110000110000110011111111111111111111111111111111111111111111111111001111110011000000111100110011000000000000001111001111111111111111111111111111110011111100110000001111001100110000000000000011110011111111111111111111111111111100111111001111110000111111111111000011000000111111111111111111111111111111111111001111110011111100001111111111110000110000001111111111111111111111111111111111110011001111000011110000001111110011001100000000111111111111111111111111111111111100110011110000111100000011111100110011000000001111111111111111111111111111111111110000001111110000110011111100110011111100110011001111111111111111111111111111111100000011111100001100111111001100111111001100110011111111111111111111111111111111111111000000000011111100111111000000111111000011111111111111111111111111111111111111110000000000111111001111110000001111110000111111111111111111111111111111110011110000111100001111110000110000001111000011111111111111111111111111111111111100111100001111000011111100001100000011110000111111111111111111111111111111111111111111001111000011111100001100000011111111110011111111111111111111111111111111111111110011110000111111000011000000111111111100111111111111111111111111111111111111110011110011000000000000110000110011001111001100111111111111111111111111111111111100111100110000000000001100001100110011110011001111111111111111111111111111110000000011000000001100001100111100000000001100110011111111111111111111111111111100000000110000000011000011001111000000000011001100111111111111111111111111111111111111111111111100001100111111000011111100001111111111111111111111111111111111111111111111111111000011001111110000111111000011111111111111111111111111111111111100000000000000110011110000000011001100110000111111111111111111111111111111111111000000000000001100111100000000110011001100001111111111111111111111111111111111110011111111110011111111111111000000111111001100000011111111111111111111111111111100111111111100111111111111110000001111110011000000111111111111111111111111111111001100000011001100000011111100110000000000110011111111111111111111111111111111110011000000110011000000111111001100000000001100111111111111111111111111111111111100110000001100111100000000001100000000111100110000111111111111111111111111111111001100000011001111000000000011000000001111001100001111111111111111111111111111110011000000110011110011001111001100111100111100001111111111111111111111111111111100110000001100111100110011110011001111001111000011111111111111111111111111111111001111111111001111001111111111111111000000110000111111111111111111111111111111110011111111110011110011111111111111110000001100001111111111111111111111111111111100000000000000110011111111111100110011000000000000111111111111111111111111111111000000000000001100111111111111001100110000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
```

* Using https://www.dcode.fr/binary-image we convert this to an image which is a QR.
* Decoding it gives us the flag.
11 changes: 11 additions & 0 deletions Codefest CTF/rsa_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from Crypto.Util.number import *
n = 750663646847528873168937831391907810647591913965562495296199585082759057318274521553757550724463451891668175905206221877858317290777877060166997790624527965837837993129383290402509996587556406778482067347232022225466937668396768390983554357611376057823852179263682649072729435912583278183812954787442057976301035654942470184201720410477691326653029842426252391647509934740335989269071438620690320401576861478427178128804784352142271832603194431176323445880836139
pq = 80970512687406090889060992576336286518763523653333428346066206717567693624044162491796922556346210471950404967161997779545603412053582932354160368128117099634532601019309976159157713252768640669410333127578132624183514430252557952811102781031315190048386214745340936679285725364013916829276058253922234988379
c = 221975957171552618997196127189899209276336291387640550554967727731818563960555600691881715668156105819191779108737770660990397331961689607338541452069797368288215716485835439777459317512238532636172979397173548812054679237802827275184091619620252887678664409116710340000218841023351238456144820005968602870644031701303645229364391309952172259686888808938835775360009896210855708140351244441167461823250549764537506364091367096196182191704433664638829177854628679

e = 65537
r = n//(pq)
d = inverse(e,r-1)
m = pow(c,d,r)

print(long_to_bytes(m))
12 changes: 12 additions & 0 deletions Codefest CTF/rsa_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from Crypto.Util.number import *
from labmath import polyrootsmod

p = 151504136086085116766143566124150275674073392929821608731193313303579549567486780984882103878189021716475112187664571076380701312144707968796469474077396203079356104319166539457117762979236714826426908047910529451429037552027255450267166159899155876867790669696867818896423172168830285791913854195932438702321
q = 103830664295009091893886752305087173101905116416231118984740125697489572383920741106883033358012404414250903398273361420080940861355058896027909558044477593238426139173175903469841531670082355641543985372882381822644581374082868518234109972478903771291945965032201075848195104712153515556622192413687460682033
e = 112
c = 7376083179301871727319662441290512768979499624954698397165424050024666168943377478129926304132046879741349597229411809080978573590530226067752606719487158834511752336008287600324551704896881690547279678544392014784520001523240813365339789395536491039305623640655624806350548548554437985830405020169663539939018239643445566882380359742208558132490655657280619850656880232036155057833081215187526442724687828214045430674207843841122060416377750502505640447395732809699800028565067081780511133517020113861405502897034245617267331520262877918693182867532420288135211820606290453667200638642871988519470430475958049806666
for i in polyrootsmod([-c, *[0 for i in range(e - 1)], 1],
{p: 1, q: 1}):
while (long_to_bytes(i).endswith(b'}')):
print(long_to_bytes(i))
break