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}


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!!!}


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

flag: sctf{51196695}


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

I wrote a script as shown in below.

import math
s = [[0,0,0],[2000,0,0],[2000,2000,0],[3000,1500,1700]]

def GetDistances(f):
	line = list(map(float, f.readline().strip().split(" "))) 
	return line

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

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

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

I got the following flag.

flag: sctf{537, 516, 487}


We should obtain both colorcodes and characters.

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


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

img = np.array( + img_name))
for y in range(img.shape[0]):
	code = ""
	color = -1
	if all(img[y][0] == [255,255,0]):#color
		color = 4
	elif all(img[y][0] == [255,165,0]):
		color = 5
	elif all(img[y][0] == [128,0,128]):
		color = 1
	elif all(img[y][0] == [0,128,0]):
		color = 3
	elif all(img[y][0] == [255,0,0]):
		color = 0
	elif all(img[y][0] == [0,0,255]):
		color = 2
	for x in range(1,img.shape[1]):#binary
		if img[y][x][0] == 0:
			code += "1"
			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}