[Writeup] Gold in Garbage | Word Search Forensics CTF Challenge

September 1, 2018 Script hunter

This is a full writeup of challenge Gold in Garbage Word Search Forensics CTF Challenge.

Gold in Garbage | Word Search Forensics CTF Challenge writeup

Challenge description:
Challenge has given a file and you need to search flag in that.Also hint was suggested that you need to do word search in that file.
There are 8 directions where look at your word.

So we’ll look at 8 directions for every character of file but it can not easy by your easy so i wrote a python code that’s will do your work.
normalfile.txt

file = [list(x) for x in open('normalfile.txt').read().split('\n')]
patx = [0,1,1,0,-1,-1,-1,1] #this is a pattern which is decided by value of d
paty = [1,0,1,-1,0,-1,1,-1]

def check(x,y,d):
	s= ''
	while(x < len(file) and y < len(file[x]) and x>0 and y>0):
		s += file[x][y]
		x += patx[d]
		y += paty[d]

		if s.startswith('cherry{') and s.endswith('}'): # flag starts with cherry{ and end with }
			print 'Flag found : ',s
			exit()

def search():
	for x in range(len(file)):
		for y in range(len(file[x])):
				if file[x][y] == 'c': #because flag start with c only
					for d in range(8):
						check(x,y,d)  
'''d denotes direction d = 0(right side) ,d = 1(towards down in file), d = 2(down-right),d = 3(left), d=4(up) , d=5(up-left) , d=6(up-right) , d=7(down-left)'''


for i in range(26):
	search()
	

Run this python script with file and you will get your flag.

Flag: cherry{uffdeepikapadukone}
verify your flag at Gold in Garbage Word Search Forensics CTF Challenge.