ctfのお勉強 ksnctf #1 #2 Easy Cipher #8 Basic is secure? #10 #!

ksnctfを解いてみた

ksnctf

とりあえず正解者の多い問題から順番に

problem.1 Test Problem

サンプル問題なのでコピー&ペーストで終わります。

problem.2 Easy Cipher

よくある暗号ね。
回転させるやつ。ぱっと見想像できるけども、総当たりのプログラム書いてみた。

tmp="EBG KVVV vf n fvzcyr yrggre fhofgvghgvba pvcure gung ercynprf n yrggre jvgu gur yrggre KVVV yr\
ggref nsgre vg va gur nycunorg. EBG KVVV vf na rknzcyr bs gur Pnrfne pvcure, qrirybcrq va napvrag E\
bzr. Synt vf SYNTFjmtkOWFNZdjkkNH. Vafreg na haqrefpber vzzrqvngryl nsgre SYNT."

alph = Array('a'..'z')
alph_up = Array('A'..'Z')

for i in 1..26 do
  a="*["+i.to_s+"]"
  tmp.each_char {|ch|
    if ch!=" " && ch!="." && ch!=","
      if j=alph.index(ch)
        a << alph[(i+j)%26]
      elsif j=alph_up.index(ch)
        a << alph_up[(i+j)%26]
      end
    elsif ch==" "
      a << " "
    end
  }
  puts a
end

pythonだとdecodeのrot13指定すると一行で行けるらしいよ。
他にはtranslateとか。

import string 
rot13 = string.maketrans( 
    "ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz", 
    "NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm")
string.translate("Hello World!", rot13)

("Hello World").decode("rot13")
problem.8 Basic is secure?

pcapをダウンロードしてWiresharkで眺める。
とりあえずhttpに絞り込みをして。
f:id:skymay:20170131133808p:plain

認証しているところを見るとフラグが出てくる。
f:id:skymay:20170131133847p:plain

problem.10 #!

"#!" をグーグルで検索するだけ。
FLAG_S??????


つづく。