Created
December 6, 2015 08:55
-
-
Save abcang/bce25c3b0e6b51fd9c99 to your computer and use it in GitHub Desktop.
cryptooo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
key = "SECCON{Cry_Pto_Oo_Oo1Oo_" | |
ans = "waUqjjDGnYxVyvUOLN8HquEO0J5Dqkh/zr/3KXJCEnw=" | |
o = [('a'..'z'), ('A'..'Z'), ('0'..'9'), ['-', '_']].map { |i| i.to_a }.flatten | |
c = 0 | |
index = [] | |
max = o.length ** 3 | |
while true | |
index[2] = c % o.length | |
index[1] = (c / o.length) % o.length | |
index[0] = (c / o.length) / o.length | |
test_key = key + (0...3).map {|i| o[index[i]] }.join | |
p "c: #{c} key: #{test_key}" | |
res = `./cryptooo #{test_key}`.chomp.split(" ")[1] | |
p "res: #{res}" | |
unless ans.start_with?(res[0..(ans.length-3)]) | |
c += o.length | |
next | |
end | |
break if res == ans || c > max | |
c += 1 | |
end | |
p "end" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
key
を3文字づつ増やしていく実行して、一致したら手動で書き足した
最後のあたりは文字数減らして
}
を付けるなどして対応最終的に
SECCON{Cry_Pto_Oo_Oo1Oo_oo_Oo_O}
になった