sCTF 2016 writeup EN

I joined sCTF as hans and marked 270pts.

The following is the problems that I could submit the correct flag.

Please tell me if there are any better solver because I'm newbie in ctf.

I'd like to learn a lot.

Banana Boy

The one picture carter.jpg was given.

I found another flame in the file with flag.

flag: sctf{tfw_d4nk_m3m3s_w1ll_a1w4y5_pr3v4il}

rev1

When I checked the strings in binary using string command, I found a little bit strange characters and that was the flag.

flag: sctf{h4x0r!!!}

rev2

I forgot how to solve, but I used objdump to find the magic number.

flag: sctf{51196695}

Tracking

We're lucky because a lot of coordinates of satellites were zero!

I wrote a script as shown in below.

```#coding:utf8
import math
s = [[0,0,0],[2000,0,0],[2000,2000,0],[3000,1500,1700]]

def GetDistances(f):
return line

def CalcLocation(d):
x = (d**2-d**2+s**2)/(2*s)
y = (d**2-d**2-2*s*x+s**2+s**2)/(2*s)
z = (d**2-d**2-2*s*x+s**2-2*s*y+s**2+s**2)/(2*s)
return [x,y,z]

def main():
with open("tracking_re.in","r") as f:
cnt = 0
sum_loc = [0,0,0]

while(True):#main loop
try:
d = GetDistances(f)
except Exception:
break
location = CalcLocation(d)
print(location)
for i in range(0,len(sum_loc)):
sum_loc[i] += location[i]
cnt += 1

#average
print(cnt)
print(sum_loc)
print([sum_loc/cnt,sum_loc/cnt,sum_loc/cnt])

if __name__ == '__main__':
main()
```

I got the following flag.

flag: sctf{537, 516, 487}

Verticode

We should obtain both colorcodes and characters.

I resized the "code1.png" to 8 x 1075 px and wrote the following script.

```#coding:utf8

import numpy as np
from PIL import Image
from matplotlib import pylab as plt
img_dir = ""
img_name = "code1.png"

img = np.array(Image.open(img_dir + img_name))
plt.imshow(img)
print(img.shape)
for y in range(img.shape):
code = ""
color = -1
if all(img[y] == [255,255,0]):#color
color = 4
elif all(img[y] == [255,165,0]):
color = 5
elif all(img[y] == [128,0,128]):
color = 1
elif all(img[y] == [0,128,0]):
color = 3
elif all(img[y] == [255,0,0]):
color = 0
elif all(img[y] == [0,0,255]):
color = 2

for x in range(1,img.shape):#binary
if img[y][x] == 0:
code += "1"
else:
code += "0"
print(chr(int(code,2)-color), end = "")
```

I could not come up with better writing immediately than elif...
That gave me the sentence and I found the flag between "ABC" and "DEF".

flag: sctf{iamtheflagalllowercasenojoke}