Merge branch 'master' of github.com:failedxyz/easyctf
Conflicts: rsa1/description.md rsa1/grader.py rsa1/problem.yml
This commit is contained in:
commit
fc2a47c92e
39 changed files with 793 additions and 163 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.pyc
|
|
@ -1,6 +1,6 @@
|
|||
author: blockingthesky
|
||||
title: Bizarro
|
||||
category: Steganography
|
||||
category: Forensics
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 400
|
||||
|
|
12
count.py
12
count.py
|
@ -20,13 +20,17 @@ for problem_name in problem_names:
|
|||
pass
|
||||
# print traceback.format_exc()
|
||||
|
||||
print "Grand Total: %d" % len(problems)
|
||||
print "Category Breakdown:"
|
||||
problems.sort(key=lambda p: p.get("value"), reverse=True)
|
||||
print("Grand Total: %d" % len(problems))
|
||||
print("Category Breakdown:")
|
||||
|
||||
maxtitle = max(map(lambda p: len(p.get("title")), problems)) + 3
|
||||
maxauthor = max(map(lambda p: len(p.get("author")), problems)) + 3
|
||||
|
||||
c = Counter(map(lambda p: p.get("category", ""), problems))
|
||||
categories = sorted(c.items(), key=lambda c: c[1], reverse=True)
|
||||
for category, count in categories:
|
||||
print " %s: %s" % (category, count)
|
||||
print(" %s: %s" % (category, count))
|
||||
for problem in problems:
|
||||
if problem.get("category") != category: continue
|
||||
print " %s" % problem.get("title")
|
||||
print(" %s %s %sp" % (problem.get("title") + " " * (maxtitle - len(problem.get("title"))), problem.get("author") + " " * (maxauthor - len(problem.get("author"))), problem.get("value")))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
title: Decode Me
|
||||
author: dududum561
|
||||
hint: Simple decoding :)
|
||||
category: Forensics
|
||||
category: Cryptography
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 100
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
This is a high-level programming challenge. Given a set of vertices corresponding to the map below, your program must output the shortest path from `a` to `z`.
|
||||
|
||||
![image](${dijkstra_map_svg})
|
||||
|
||||
The length of the line segments is randomized such that the length (`l`) satisfies `20 <= l <= 120`.
|
||||
|
||||
Input will consist of 49 lines in the format `vertex1 vertex2 distanceBetween`
|
||||
|
||||
Here are a few lines of example input:
|
||||
```shell
|
||||
h i 94
|
||||
h o 40
|
||||
i l 95
|
||||
l k 65
|
||||
l t 63
|
||||
t u 47
|
||||
```
|
||||
|
||||
The output should be written to a file named "dijkstra.out" in the current directory. Output will consist of the entire path, with `->` in between vertices. Print the current distance traveled in parenthesis after each vertex, as shown below.
|
||||
```
|
||||
a -> b(113) -> c(210) -> f(262) -> h(291) -> i(326) -> m(381) -> s(409) -> x(444) -> y(534) -> z(557)
|
||||
```
|
|
@ -1,108 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="1280px" height="800px" viewBox="0 0 1280 800" enable-background="new 0 0 1280 800" xml:space="preserve">
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="151.5" cy="127.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="288.5" cy="231.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="315.5" cy="86.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="486.5" cy="86.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="486.5" cy="215.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="198.5" cy="385.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="392.5" cy="363.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="361.5" cy="511.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="498.5" cy="556.5" r="30.5"/>
|
||||
<text transform="matrix(1 0 0 1 139 141)" font-family="'Consolas'" font-size="45">A</text>
|
||||
<text transform="matrix(1 0 0 1 303.5 101.5)" font-family="'Consolas'" font-size="45">B</text>
|
||||
<text transform="matrix(1 0 0 1 475 100)" font-family="'Consolas'" font-size="45">E</text>
|
||||
<text transform="matrix(1 0 0 1 275 245)" font-family="'Consolas'" font-size="45">C</text>
|
||||
<text transform="matrix(1 0 0 1 189 400)" font-family="'Consolas'" font-size="45">D</text>
|
||||
<text transform="matrix(1 0 0 1 476 229.5)" font-family="'Consolas'" font-size="45">F</text>
|
||||
<text transform="matrix(1 0 0 1 381 379)" font-family="'Consolas'" font-size="45">J</text>
|
||||
<text transform="matrix(1 0 0 1 350.5 525.5)" font-family="'Consolas'" font-size="45">K</text>
|
||||
<text transform="matrix(1 0 0 1 487.5 570.5)" font-family="'Consolas'" font-size="45">L</text>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="621.5" cy="446.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="524.5" cy="363.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="639.5" cy="238.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="662.5" cy="86.5" r="30.5"/>
|
||||
<text transform="matrix(1 0 0 1 609 462)" font-family="'Consolas'" font-size="45">M</text>
|
||||
<text transform="matrix(1 0 0 1 513 379)" font-family="'Consolas'" font-size="45">I</text>
|
||||
<text transform="matrix(1 0 0 1 628 254)" font-family="'Consolas'" font-size="45">H</text>
|
||||
<text transform="matrix(1 0 0 1 648.5 100.5)" font-family="'Consolas'" font-size="45">G</text>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="791.5" cy="116.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="911.5" cy="184.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="977.5" cy="284.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="984.5" cy="416.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="1125.5" cy="470.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="984.5" cy="649.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="890.5" cy="531.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="632.5" cy="704.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="792.5" cy="680.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="761.5" cy="481.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="768.5" cy="345.5" r="30.5"/>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="786.5" cy="238.5" r="30.5"/>
|
||||
<text transform="matrix(1 0 0 1 782 132)" font-family="'Consolas'" font-size="45">P</text>
|
||||
<text transform="matrix(1 0 0 1 899.5 195.5)" font-family="'Consolas'" font-size="45">Q</text>
|
||||
<text transform="matrix(1 0 0 1 968 300)" font-family="'Consolas'" font-size="45">R</text>
|
||||
<text transform="matrix(1 0 0 1 973 431)" font-family="'Consolas'" font-size="45">X</text>
|
||||
<text transform="matrix(1 0 0 1 1113 487)" font-family="'Consolas'" font-size="45">Y</text>
|
||||
<text transform="matrix(1 0 0 1 973 665)" font-family="'Consolas'" font-size="45">Z</text>
|
||||
<text transform="matrix(1 0 0 1 779.5 696.5)" font-family="'Consolas'" font-size="45">V</text>
|
||||
<text transform="matrix(1 0 0 1 621 718.5)" font-family="'Consolas'" font-size="45">U</text>
|
||||
<circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="639.5" cy="572.5" r="30.5"/>
|
||||
<text transform="matrix(1 0 0 1 628 589)" font-family="'Consolas'" font-size="45">T</text>
|
||||
<text transform="matrix(1 0 0 1 750 495)" font-family="'Consolas'" font-size="45">S</text>
|
||||
<text transform="matrix(1 0 0 1 756 362.5)" font-family="'Consolas'" font-size="45">N</text>
|
||||
<text transform="matrix(1 0 0 1 775 254)" font-family="'Consolas'" font-size="45">O</text>
|
||||
<text transform="matrix(1 0 0 1 878 548)" font-family="'Consolas'" font-size="45">W</text>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="179.947" y1="116.5" x2="286.856" y2="97"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="315.5" y1="117" x2="298" y2="201"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="275" y1="258.851" x2="218.519" y2="362.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="309.088" y1="254" x2="371.909" y2="341.002"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="229" y1="385.5" x2="364.677" y2="376"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="392.5" y1="394" x2="361.5" y2="481"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="423" y1="363.5" x2="494" y2="363.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="486.5" y1="246" x2="524.5" y2="333"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="405.12" y1="335.735" x2="460.534" y2="231.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="319" y1="231.5" x2="456" y2="215.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="346" y1="86.5" x2="456" y2="86.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="486.5" y1="117" x2="486.5" y2="185"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="517" y1="86.5" x2="632" y2="86.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="693" y1="86.5" x2="761" y2="116.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="662.5" y1="117" x2="639.5" y2="208"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="517" y1="215.5" x2="609" y2="238.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="549.118" y1="345.5" x2="621.5" y2="263.118"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="665.766" y1="254" x2="746.479" y2="324.41"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="648.5" y1="432.315" x2="743.175" y2="362.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="545.612" y1="385.5" x2="598.59" y2="426.377"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="524.5" y1="394" x2="498.5" y2="526"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="391.064" y1="519.015" x2="471.662" y2="542"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="529" y1="556.5" x2="609" y2="572.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="639.5" y1="603" x2="632.5" y2="674"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="663" y1="704.5" x2="762" y2="680.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="666.338" y1="587" x2="768.5" y2="661.69"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="665.466" y1="556.5" x2="738" y2="500.941"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="766.977" y1="511.5" x2="786.5" y2="650"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="792" y1="481.5" x2="867.051" y2="512"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="916.146" y1="548" x2="967.256" y2="624.346"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="823" y1="680.5" x2="954" y2="649.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="873.038" y1="556.5" x2="808.357" y2="654.442"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="621.5" y1="477" x2="639.5" y2="542"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="648.851" y1="460" x2="733.053" y2="470.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="768.5" y1="376" x2="761.5" y2="451"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="786.5" y1="269" x2="768.5" y2="315"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="670" y1="238.5" x2="756" y2="238.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="791.5" y1="147" x2="786.5" y2="208"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="819.947" y1="127.5" x2="888.5" y2="164.481"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="796.319" y1="333" x2="892.059" y2="208"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="799" y1="345.5" x2="947" y2="284.5"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="937.146" y1="201" x2="967.256" y2="255.769"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="977.5" y1="315" x2="984.5" y2="386"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="786.5" y1="464.038" x2="958.507" y2="308.355"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="789.947" y1="470.5" x2="954.52" y2="422.086"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="1013.355" y1="426.377" x2="1098.524" y2="456.269"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="1113" y1="498.319" x2="1008" y2="630.059"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="916.146" y1="515" x2="1095.701" y2="477"/>
|
||||
<line fill="none" stroke="#000000" stroke-width="5" stroke-miterlimit="10" x1="903.575" y1="503.94" x2="965.059" y2="440"/>
|
||||
<text transform="matrix(1 0 0 1 112 638.5)"><tspan x="0" y="0" font-family="'Consolas'" font-size="38"> Start:</tspan><tspan x="146.248" y="0" font-family="'Consolas'" font-size="38" letter-spacing="12"> </tspan><tspan x="180" y="0" font-family="'Consolas'" font-size="38">A</tspan><tspan x="0" y="45.6" font-family="'Consolas'" font-size="38">Target:</tspan><tspan x="146.248" y="45.6" font-family="'Consolas'" font-size="38" letter-spacing="12"> </tspan><tspan x="180" y="45.6" font-family="'Consolas'" font-size="38">Z</tspan></text>
|
||||
</svg>
|
Before Width: | Height: | Size: 12 KiB |
|
@ -1,4 +0,0 @@
|
|||
def grade(autogen, answer):
|
||||
if answer.find("edsger_wybe_dijkstra_was_a_happy_accident") != -1:
|
||||
return True, "Great Job! That's a tough one."
|
||||
return False, "Nope, try again."
|
|
@ -1,9 +0,0 @@
|
|||
title: Dijkstra
|
||||
author: ztaylor54
|
||||
hint: You might consider reading up on shortest-path algorithms.
|
||||
category: Programming
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 450
|
||||
files:
|
||||
- dijkstra_map.svg
|
5
fizz-buzz-2/source_grader.py
Normal file
5
fizz-buzz-2/source_grader.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
code = raw_input()
|
||||
if ("i" in code) or ("I" in code) or ("?" in code):
|
||||
print "Your program contains an 'i', 'I', or '?'. Please remove it and try again."
|
||||
else
|
||||
print "OK"
|
|
@ -4,6 +4,6 @@ hint: You're not looking deep enough
|
|||
category: Forensics
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 50
|
||||
value: 150
|
||||
files:
|
||||
- heresaflag.jpg
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
author: GenericNickname
|
||||
title: Listen Closely
|
||||
hint: 1, 16, 8000
|
||||
category: Crytpography
|
||||
category: Cryptography
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 50
|
||||
value: 300
|
||||
files:
|
||||
- listenclosely.wav
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
author: blockingthesky
|
||||
title: Lucky Guess
|
||||
category: Reversing
|
||||
category: Reverse Engineering
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 200
|
||||
|
|
|
@ -4,7 +4,7 @@ hint: This is a fairly well-known graph problem, there's probably some sort of i
|
|||
category: Algorithms
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 50
|
||||
value: 400
|
||||
files:
|
||||
- female_prefs.txt
|
||||
- male_prefs.txt
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
author: blockingthesky
|
||||
title: Phunky Python I
|
||||
category: Reversing
|
||||
category: Reverse Engineering
|
||||
autogen: true
|
||||
programming: false
|
||||
value: 30
|
||||
value: 30
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
author: blockingthesky
|
||||
title: Phunky Python II
|
||||
category: Reversing
|
||||
category: Reverse Engineering
|
||||
autogen: true
|
||||
programming: false
|
||||
value: 115
|
||||
value: 115
|
||||
|
|
2
qr-1/description.md
Normal file
2
qr-1/description.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
I just saw this QR code the other day, but couldn't tell what data it has. Can you help?
|
||||
[Here](${qr1_bmp}) it is.
|
4
qr-1/grader.py
Normal file
4
qr-1/grader.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
def grade(autogen, answer):
|
||||
if answer.find("n0w_who-w0u1d_do_thAT_to_Th3ir_QR?") != -1:
|
||||
return True, "Congrats!"
|
||||
return False, "Nope, try again."
|
9
qr-1/problem.yml
Normal file
9
qr-1/problem.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
title: QR 1
|
||||
author: wiresboy
|
||||
category: Forensics
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 100
|
||||
hint: Is the image only black and white?
|
||||
files:
|
||||
- qr1.bmp
|
BIN
qr-1/qr1.bmp
Normal file
BIN
qr-1/qr1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 469 KiB |
|
@ -1 +1 @@
|
|||
When I am not practicing my [Oboe](https://en.wikipedia.org/wiki/Oboe) for band, I have been working on a QR code generator. For some reason, some of the images are not scannable. [Here](${qr_bmp}) is one, can you tell me what it says?
|
||||
When I am not practicing my [Oboe](https://en.wikipedia.org/wiki/Oboe) for band, I have been working on a QR code generator. For some reason, some of the images are not scannable. [Here](${qr2_bmp}) is one, can you tell me what it says?
|
|
@ -3,7 +3,7 @@ author: wiresboy
|
|||
category: Forensics
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 180
|
||||
value: 330
|
||||
hint: Is there another kind of Oboe?
|
||||
files:
|
||||
- qr.bmp
|
||||
- qr2.bmp
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
1
qrt/description.md
Normal file
1
qrt/description.md
Normal file
|
@ -0,0 +1 @@
|
|||
I've stumbled upon a very strange [QR code](${flag_png})... seems like it was generated with [this generator](http://hexqr.web.easyctf.com). What could it mean?
|
BIN
qrt/flag.png
Normal file
BIN
qrt/flag.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
330
qrt/grader.py
Normal file
330
qrt/grader.py
Normal file
|
@ -0,0 +1,330 @@
|
|||
from cStringIO import StringIO
|
||||
from PIL import Image, ImageDraw
|
||||
from math import ceil, sqrt
|
||||
|
||||
ALTCONST = sqrt(3) / 2.0
|
||||
ISIZE = 784.0
|
||||
IMARGIN = 22.0
|
||||
|
||||
def empty_hex(size):
|
||||
c = 0
|
||||
points = []
|
||||
for i in range(2, size * 2 + 2, 2):
|
||||
points.append([0] * i)
|
||||
middle = []
|
||||
for i in range(size * 2 - 1):
|
||||
row = [0] * (size * 2)
|
||||
middle.append(row)
|
||||
epoints = list(row[:] for row in points[::-1])
|
||||
return points + middle + epoints
|
||||
|
||||
def intify(points):
|
||||
return map(lambda c: (int(c[0]), int(c[1])), points)
|
||||
|
||||
def draw_triangle(im, points, cell, size):
|
||||
draw = ImageDraw.Draw(im)
|
||||
# draw.polygon(points, outline=(0, 0, 0))
|
||||
if cell:
|
||||
draw.polygon(intify(points), fill=(0, 0, 0))
|
||||
return im
|
||||
|
||||
def getsection(i, size):
|
||||
return 0 if i <= size - 1 else (1 if i < 3 * size - 1 else 2)
|
||||
|
||||
def getspace(size):
|
||||
return max(0, sum(len(filter(lambda a: a == 0, b)) for b in empty_hex(size)) - 2)
|
||||
|
||||
def generate_image(string, debug=False):
|
||||
size = 0
|
||||
binstring = bin(int(string.encode("hex"), 16)).strip("0b")
|
||||
while size < 2 or getspace(size + 1) < len(binstring):
|
||||
size += 1
|
||||
n = getspace(size)
|
||||
# print size, len(binstring)
|
||||
if debug: print "SIZE", size, " n =", n
|
||||
im = Image.new("RGB", (int(ISIZE), int(ISIZE)), "white")
|
||||
pattern = empty_hex(size)
|
||||
# print len(binstring)
|
||||
# print sum(len(i) for i in pattern)
|
||||
pattern[0][len(string) % 2] = 1
|
||||
curr = (1, 1 + len(string) % 2, 3 - len(string) % 2)
|
||||
# 0 1
|
||||
# 3 2
|
||||
for c in range(n): # range(len(binstring)):
|
||||
i, j, d = curr
|
||||
row = pattern[i]
|
||||
if c < len(binstring):
|
||||
b = int(binstring[c])
|
||||
pattern[i][j] = b
|
||||
if c % 2 == 0:
|
||||
pattern[i][j] ^= 1
|
||||
|
||||
section = getsection(i, size)
|
||||
leftfacing = [j % 2 == 0, j % 2 != (i - size) % 2, j % 2 == 0][section]
|
||||
if debug: print "c =", c, ", i =", i, ", j =", j, ", d =", d, ", s =", section, ", l =", leftfacing
|
||||
if section == 0:
|
||||
if getsection(i + 1, size) == 0:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j + 1, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j + 2, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif getsection(i + 1, size) == 1:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif section == 1:
|
||||
if getsection(i - 1, size) == 0:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 1:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if j == 0:
|
||||
if d == 0:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif getsection(i - 1, size) == 1:
|
||||
if getsection(i + 1, size) == 1:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if j == 0:
|
||||
if d == 0:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif getsection(i + 1, size) == 2:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i, j - 1, d
|
||||
elif section == 2:
|
||||
if getsection(i - 1, size) == 1:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j - 2, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
elif getsection(i - 1, size) == 2:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
else:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j - 2, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j - 1, d
|
||||
# for i in range(len(pattern)):
|
||||
# for j in range(len(pattern[i])):
|
||||
# section = 0 if i <= size - 1 else (1 if i < 3 * size - 1 else 2)
|
||||
# leftfacing = [j % 2 == 0, j % 2 != (i - size) % 2, j % 2 == 0][section]
|
||||
# if not leftfacing:
|
||||
# print j,
|
||||
# print
|
||||
sidelen = (ISIZE - IMARGIN * 2) / (2.0 * size)
|
||||
altitude = sidelen * ALTCONST
|
||||
# print sidelen, altitude
|
||||
for i in range(len(pattern)):
|
||||
section = getsection(i, size)
|
||||
row = pattern[i]
|
||||
rowleft = (ISIZE / 2) - (altitude * len(row) / 2)
|
||||
if section % 2 == 0:
|
||||
evenrow = i % 2 == 0
|
||||
for j in range(len(row)):
|
||||
cell = row[j]
|
||||
top = ceil(i / 2.0) * sidelen - (0.5 * sidelen if not evenrow else 0) + IMARGIN
|
||||
bottom = top + sidelen
|
||||
if j % 2 == 0:
|
||||
points = [
|
||||
(rowleft + altitude * j, top + sidelen / 2),
|
||||
(rowleft + altitude * (j + 1), top), (rowleft + altitude * (j + 1), bottom)
|
||||
]
|
||||
else:
|
||||
points = [
|
||||
(rowleft + altitude * (j + 1), top + sidelen / 2),
|
||||
(rowleft + altitude * j, top), (rowleft + altitude * j, bottom)
|
||||
]
|
||||
draw_triangle(im, points, cell, size)
|
||||
else:
|
||||
evenrow = (i - size) % 2 == 1
|
||||
for j in range(len(row)):
|
||||
cell = row[j]
|
||||
top = ceil(i / 2.0) * sidelen - (0.5 * sidelen if i % 2 == 1 else 0) + IMARGIN
|
||||
bottom = top + sidelen
|
||||
if j % 2 == (i - size) % 2:
|
||||
points = [
|
||||
(rowleft + altitude * (j + 1), top + sidelen / 2),
|
||||
(rowleft + altitude * j, top), (rowleft + altitude * j, bottom)
|
||||
]
|
||||
else:
|
||||
points = [
|
||||
(rowleft + altitude * j, top + sidelen / 2),
|
||||
(rowleft + altitude * (j + 1), top), (rowleft + altitude * (j + 1), bottom)
|
||||
]
|
||||
draw_triangle(im, points, cell, size)
|
||||
return im
|
||||
|
||||
FLAG = "are_triangles_more_secure_than_squares?_%s"
|
||||
|
||||
def get_salt(random):
|
||||
salt = "".join([random.choice("0123456789abcdef") for i in range(8)])
|
||||
return salt
|
||||
|
||||
def generate_flag(random):
|
||||
salt = get_salt(random)
|
||||
im = generate_image("easyctf{%s}" % (FLAG % salt))
|
||||
flag = StringIO()
|
||||
im.save(flag, format="PNG")
|
||||
return flag
|
||||
|
||||
def generate(random):
|
||||
return dict(files={
|
||||
"flag.png": generate_flag
|
||||
})
|
||||
|
||||
def grade(random, key):
|
||||
salt = get_salt(random)
|
||||
if key.find(FLAG % salt) >= 0:
|
||||
return True, "Correct!"
|
||||
return False, "Nope."
|
5
qrt/problem.yml
Normal file
5
qrt/problem.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
title: Hex QR
|
||||
category: Reverse Engineering
|
||||
value: 200
|
||||
author: mzhang
|
||||
autogen: true
|
311
qrt/qrt.py
Normal file
311
qrt/qrt.py
Normal file
|
@ -0,0 +1,311 @@
|
|||
from PIL import Image, ImageDraw
|
||||
from math import ceil, sqrt
|
||||
|
||||
ALTCONST = sqrt(3) / 2.0
|
||||
ISIZE = 784.0
|
||||
IMARGIN = 22.0
|
||||
|
||||
def empty_hex(size):
|
||||
c = 0
|
||||
points = []
|
||||
for i in range(2, size * 2 + 2, 2):
|
||||
points.append([0] * i)
|
||||
middle = []
|
||||
for i in range(size * 2 - 1):
|
||||
row = [0] * (size * 2)
|
||||
middle.append(row)
|
||||
epoints = list(row[:] for row in points[::-1])
|
||||
return points + middle + epoints
|
||||
|
||||
def intify(points):
|
||||
return map(lambda c: (int(c[0]), int(c[1])), points)
|
||||
|
||||
def draw_triangle(im, points, cell, size):
|
||||
draw = ImageDraw.Draw(im)
|
||||
# draw.polygon(points, outline=(0, 0, 0))
|
||||
if cell:
|
||||
draw.polygon(intify(points), fill=(0, 0, 0))
|
||||
return im
|
||||
|
||||
def getsection(i, size):
|
||||
return 0 if i <= size - 1 else (1 if i < 3 * size - 1 else 2)
|
||||
|
||||
def getspace(size):
|
||||
return max(0, sum(len(filter(lambda a: a == 0, b)) for b in empty_hex(size)) - 2)
|
||||
|
||||
def generate(string, debug=False):
|
||||
size = 0
|
||||
binstring = bin(int(string.encode("hex"), 16)).strip("0b")
|
||||
while size < 3 or getspace(size + 1) - 8 < len(binstring):
|
||||
size += 1
|
||||
n = getspace(size)
|
||||
# print size, len(binstring)
|
||||
if debug: print "SIZE", size, " n =", n
|
||||
im = Image.new("RGB", (int(ISIZE), int(ISIZE)), "white")
|
||||
pattern = empty_hex(size)
|
||||
# print len(binstring)
|
||||
# print sum(len(i) for i in pattern)
|
||||
pattern[0][len(string) % 2] = 1
|
||||
curr = (1, 1 + len(string) % 2, 3 - len(string) % 2)
|
||||
# 0 1
|
||||
# 3 2
|
||||
for c in range(n): # range(len(binstring)):
|
||||
i, j, d = curr
|
||||
row = pattern[i]
|
||||
if c < len(binstring):
|
||||
b = int(binstring[c])
|
||||
pattern[i][j] = b
|
||||
if c % 2 == 0:
|
||||
pattern[i][j] ^= 1
|
||||
|
||||
section = getsection(i, size)
|
||||
leftfacing = [j % 2 == 0, j % 2 != (i - size) % 2, j % 2 == 0][section]
|
||||
if debug: print "c =", c, ", i =", i, ", j =", j, ", d =", d, ", s =", section, ", l =", leftfacing
|
||||
if section == 0:
|
||||
if getsection(i + 1, size) == 0:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j + 1, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j + 2, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif getsection(i + 1, size) == 1:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i - 1, j - 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif section == 1:
|
||||
if getsection(i - 1, size) == 0:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 1:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if j == 0:
|
||||
if d == 0:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif getsection(i - 1, size) == 1:
|
||||
if getsection(i + 1, size) == 1:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 2:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if j == 0:
|
||||
if d == 0:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
curr = i + 2, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif getsection(i + 1, size) == 2:
|
||||
if leftfacing:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
curr = i + 1, j, d
|
||||
else:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i, j - 1, d
|
||||
elif section == 2:
|
||||
if getsection(i - 1, size) == 1:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
curr = i - 1, j, d
|
||||
elif d == 1:
|
||||
curr = i, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j, d
|
||||
elif d == 2:
|
||||
if j == len(row) - 1:
|
||||
curr = i + 1, j - 2, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
elif getsection(i - 1, size) == 2:
|
||||
if leftfacing:
|
||||
if d == 0:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 1 or d == 2:
|
||||
curr = i, j + 1, d
|
||||
elif d == 3:
|
||||
if j == 0:
|
||||
curr = i + 1, j, (d + 2) % 4
|
||||
else:
|
||||
curr = i + 1, j - 1, d
|
||||
else:
|
||||
if j == len(row) - 1:
|
||||
if d == 0:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j - 2, (d + 2) % 4
|
||||
else:
|
||||
if d == 0 or d == 3:
|
||||
curr = i, j - 1, d
|
||||
elif d == 1:
|
||||
curr = i - 1, j + 1, d
|
||||
elif d == 2:
|
||||
curr = i + 1, j - 1, d
|
||||
# for i in range(len(pattern)):
|
||||
# for j in range(len(pattern[i])):
|
||||
# section = 0 if i <= size - 1 else (1 if i < 3 * size - 1 else 2)
|
||||
# leftfacing = [j % 2 == 0, j % 2 != (i - size) % 2, j % 2 == 0][section]
|
||||
# if not leftfacing:
|
||||
# print j,
|
||||
# print
|
||||
sidelen = (ISIZE - IMARGIN * 2) / (2.0 * size)
|
||||
altitude = sidelen * ALTCONST
|
||||
# print sidelen, altitude
|
||||
for i in range(len(pattern)):
|
||||
section = getsection(i, size)
|
||||
row = pattern[i]
|
||||
rowleft = (ISIZE / 2) - (altitude * len(row) / 2)
|
||||
if section % 2 == 0:
|
||||
evenrow = i % 2 == 0
|
||||
for j in range(len(row)):
|
||||
cell = row[j]
|
||||
top = ceil(i / 2.0) * sidelen - (0.5 * sidelen if not evenrow else 0) + IMARGIN
|
||||
bottom = top + sidelen
|
||||
if j % 2 == 0:
|
||||
points = [
|
||||
(rowleft + altitude * j, top + sidelen / 2),
|
||||
(rowleft + altitude * (j + 1), top), (rowleft + altitude * (j + 1), bottom)
|
||||
]
|
||||
else:
|
||||
points = [
|
||||
(rowleft + altitude * (j + 1), top + sidelen / 2),
|
||||
(rowleft + altitude * j, top), (rowleft + altitude * j, bottom)
|
||||
]
|
||||
draw_triangle(im, points, cell, size)
|
||||
else:
|
||||
evenrow = (i - size) % 2 == 1
|
||||
for j in range(len(row)):
|
||||
cell = row[j]
|
||||
top = ceil(i / 2.0) * sidelen - (0.5 * sidelen if i % 2 == 1 else 0) + IMARGIN
|
||||
bottom = top + sidelen
|
||||
if j % 2 == (i - size) % 2:
|
||||
points = [
|
||||
(rowleft + altitude * (j + 1), top + sidelen / 2),
|
||||
(rowleft + altitude * j, top), (rowleft + altitude * j, bottom)
|
||||
]
|
||||
else:
|
||||
points = [
|
||||
(rowleft + altitude * j, top + sidelen / 2),
|
||||
(rowleft + altitude * (j + 1), top), (rowleft + altitude * (j + 1), bottom)
|
||||
]
|
||||
draw_triangle(im, points, cell, size)
|
||||
return im
|
||||
|
||||
# im = generate("easyctf{are_triangles_more_secure_than_squares?}")
|
||||
# im.save("flag.png")
|
||||
|
||||
# for i in range(40, 60):
|
||||
# generate("A" * i, "/tmp/%d.png" % i)
|
30
qrt/server.py
Normal file
30
qrt/server.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from flask import Flask, request
|
||||
from qrt import generate
|
||||
from base64 import b64encode
|
||||
from binascii import b2a_base64
|
||||
from cStringIO import StringIO
|
||||
from traceback import format_exc
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def index():
|
||||
try:
|
||||
html = "<title>hex qr</title><form method=post>enter a string: <input type=text name=text value='%s' autocomplete=off autofocus /></form>"
|
||||
if request.method == "POST":
|
||||
if not request.form.get("text"):
|
||||
html %= ""
|
||||
html += "<p>empty</p>"
|
||||
else:
|
||||
html %= request.form["text"]
|
||||
im = generate(request.form["text"])
|
||||
buf = StringIO()
|
||||
im.save(buf, format="JPEG")
|
||||
html += "<img src='data:image/jpeg;base64,%s'>" % b2a_base64(buf.getvalue())
|
||||
else:
|
||||
html %= ""
|
||||
return html
|
||||
except:
|
||||
return "<!--\nthere's a problem, here's the details:\n%s\n-->" % format_exc()
|
||||
|
||||
app.run(host="0.0.0.0", port=5000)
|
|
@ -1 +1,5 @@
|
|||
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
|
||||
<<<<<<< HEAD
|
||||
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
|
||||
=======
|
||||
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
|
||||
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
from cStringIO import StringIO
|
||||
|
||||
flag = "wh3n_y0u_h4ve_p&q_RSA_iz_ez"
|
||||
|
@ -47,3 +48,9 @@ def grade(random, key):
|
|||
if key.find("%s_%s" % (flag, salt)) >= 0:
|
||||
return True, "Correct!"
|
||||
return False, "Nope."
|
||||
=======
|
||||
def grade(autogen, key):
|
||||
if key.find("tw0_v3ry_merrry_tw1n_pr1m35!!_417c0d") != -1:
|
||||
return True, "Really Superb! Applause!"
|
||||
return False, "RIP"
|
||||
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
<<<<<<< HEAD
|
||||
title: RSA 1
|
||||
author: neptunia
|
||||
hint: Go google RSA if you're stuck.
|
||||
category: Cryptography
|
||||
autogen: true
|
||||
programming: false
|
||||
value: 25
|
||||
value: 25
|
||||
=======
|
||||
author: blockingthesky
|
||||
title: RSA 3
|
||||
hint: You might want to read up on how RSA works.
|
||||
category: Cryptography
|
||||
autogen: false
|
||||
programming: false
|
||||
value: 70
|
||||
files:
|
||||
- rsa3
|
||||
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657
|
||||
|
|
2
rsa1/rsa3
Normal file
2
rsa1/rsa3
Normal file
|
@ -0,0 +1,2 @@
|
|||
{N : e : c}
|
||||
{0x27335d21ca51432fa000ddf9e81f630314a0ef2e35d81a839584c5a7356b94934630ebfc2ef9c55b111e8c373f2db66ca3be0c0818b1d4eda7d53c1bd0067f66a12897099b5e322d85a8da45b72b828813af23L : 0x10001 : 0x9b9c138e0d473b6e6cf44acfa3becb358b91d0ba9bfb37bf11effcebf9e0fe4a86439e8217819c273ea5c1c5acfd70147533aa550aa70f2e07cc98be1a1b0ea36c0738d1c994c50b1bd633e3873fc0cb377e7L}
|
2
simple-rop/Makefile
Normal file
2
simple-rop/Makefile
Normal file
|
@ -0,0 +1,2 @@
|
|||
(all):
|
||||
gcc -m32 -o simple-rop -fno-stack-protector -O0 simple-rop.c
|
3
simple-rop/description.md
Normal file
3
simple-rop/description.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
On the shell there is a folder `<insert location>`.
|
||||
Read flag.txt
|
||||
[Source](${simple-rop.c})
|
1
simple-rop/flag.txt
Normal file
1
simple-rop/flag.txt
Normal file
|
@ -0,0 +1 @@
|
|||
easyctf{r0p_7o_v1ct0ry}
|
4
simple-rop/grader.py
Normal file
4
simple-rop/grader.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
def grade(random, key):
|
||||
if key.find("r0p_7o_v1ct0ry") != -1:
|
||||
return True, "Correct!"
|
||||
return False, "Nope."
|
7
simple-rop/problem.yml
Normal file
7
simple-rop/problem.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
title: Simple Rop
|
||||
category: Binary Exploitation
|
||||
value: 75
|
||||
author: r3ndom
|
||||
autogen: false
|
||||
files:
|
||||
- simple-rop.c
|
25
simple-rop/simple-rop.c
Normal file
25
simple-rop/simple-rop.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void print_flag();
|
||||
void what_did_you_say();
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
gid_t gid = getegid();
|
||||
setresgid(gid, gid, gid);
|
||||
what_did_you_say();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_flag()
|
||||
{
|
||||
system("cat flag.txt");
|
||||
}
|
||||
|
||||
void what_did_you_say()
|
||||
{
|
||||
char buff[64];
|
||||
gets(buff);
|
||||
printf("You said: %s\n", buff);
|
||||
}
|
4
wayward-space-junk/solution.txt
Normal file
4
wayward-space-junk/solution.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
In reality, the space junk will be following a very predictable orbit, around
|
||||
a polar function, which means that it will eventually be repeating as well.
|
||||
The trick is to just shoot a bunch of test ones and see how far off you miss.
|
||||
The pilot key simply identifies the team so they can enter the correct flag.
|
Loading…
Reference in a new issue