for k inrange(0,10000): try: os.mkdir(str(k)) except: pass if k in arr: f=open("./"+str(k)+"/"+os.urandom(8).encode("hex")+"."+os.urandom(8).encode("hex"),"w").write(str(flag[count])) count +=1
create_folder_player.py: there will be 10000 folders with one part of the flag in several of them choosen randomly.
misc.py: lol, the spell. blaclist vs blacklist.
misc.py: ok seriously, blacklist usage sucks so I wont do a script to send a ls for the all 10000 folders. I will simply find a command not blacklisted: grep.
grep is magic, you can use all kind of regex and use it recursively:
File.open('misc04.txt').each do |line| # math the folderName, fileName and content of each file (one char) regex = line.match(/\/([0-9]{1,4})\/([a-f0-9]{16}\.[a-f0-9]{16}):(.)/) folderName = regex.captures[0] fileName = regex.captures[1] char = regex.captures[2] # convert folderName to int in order to be able to sort it the right way. Sort as int (2464 > 251), sort a string (2464 < 251). arr.push([folderName.to_i,fileName,char]) end
# sort by first col, so sort by fileName arr.sort! # display only chars (third column of each row) arr.each{|r| print r[2]}