Skip to content

Instantly share code, notes, and snippets.

@abcang
Created December 6, 2015 08:55
Show Gist options
  • Save abcang/bce25c3b0e6b51fd9c99 to your computer and use it in GitHub Desktop.
Save abcang/bce25c3b0e6b51fd9c99 to your computer and use it in GitHub Desktop.
cryptooo
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"
@abcang
Copy link
Author

abcang commented Dec 6, 2015

keyを3文字づつ増やしていく
実行して、一致したら手動で書き足した

最後のあたりは文字数減らして }を付けるなどして対応

最終的にSECCON{Cry_Pto_Oo_Oo1Oo_oo_Oo_O}になった

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment