• SECCON CTF 2014: Easy Cipher Write-up

    Crypto100 - Easy Cipher

    87 101 108 1100011 0157 6d 0145 040 116 0157 100000 0164 104 1100101 32 0123 69 67 0103 1001111 1001110 040 062 060 49 064 100000 0157 110 6c 0151 1101110 101 040 0103 1010100 70 101110 0124 1101000 101 100000 1010011 1000101 67 0103 4f 4e 100000 105 1110011 040 116 1101000 0145 040 1100010 0151 103 103 0145 1110011 0164 100000 1101000 0141 99 6b 1100101 0162 32 0143 111 1101110 1110100 101 0163 0164 040 0151 0156 040 74 0141 1110000 1100001 0156 056 4f 0157 0160 115 44 040 0171 1101111 117 100000 1110111 0141 0156 1110100 32 0164 6f 32 6b 1101110 1101111 1110111 100000 0164 1101000 0145 040 0146 6c 97 1100111 2c 100000 0144 111 110 100111 116 100000 1111001 6f 117 63 0110 1100101 0162 0145 100000 1111001 111 117 100000 97 114 0145 46 1010011 0105 0103 67 79 1001110 123 87 110011 110001 67 110000 1001101 32 55 060 100000 110111 0110 110011 32 53 51 0103 0103 060 0116 040 5a 0117 73 0101 7d 1001000 0141 1110110 1100101 100000 102 0165 0156 33

    It looks like a set of numbers split with space. But there are multiple integer bases.

    nums = %w(87 101 108 1100011 0157 6d 0145 040 116 0157 100000 0164 104 1100101
              32 0123 69 67 0103 1001111 1001110 040 062 060 49 064 100000 0157 110
              6c 0151 1101110 101 040 0103 1010100 70 101110 0124 1101000 101 100000
              1010011 1000101 67 0103 4f 4e 100000 105 1110011 040 116 1101000 0145
              040 1100010 0151 103 103 0145 1110011 0164 100000 1101000 0141 99 6b
              1100101 0162 32 0143 111 1101110 1110100 101 0163 0164 040 0151 0156
              040 74 0141 1110000 1100001 0156 056 4f 0157 0160 115 44 040 0171
              1101111 117 100000 1110111 0141 0156 1110100 32 0164 6f 32 6b 1101110
              1101111 1110111 100000 0164 1101000 0145 040 0146 6c 97 1100111 2c
              100000 0144 111 110 100111 116 100000 1111001 6f 117 63 0110 1100101
              0162 0145 100000 1111001 111 117 100000 97 114 0145 46 1010011 0105
              0103 67 79 1001110 123 87 110011 110001 67 110000 1001101 32 55 060
              100000 110111 0110 110011 32 53 51 0103 0103 060 0116 040 5a 0117 73
              0101 7d 1001000 0141 1110110 1100101 100000 102 0165 0156 33)
    str = nums.map do |s|
      ord = if s.size >= 5
              s.to_i(2)
            elsif s =~ /[a-f]/
              s.to_i(16)
            elsif s.start_with?('0')
              s.to_i(8)
            else
              s.to_i
            end
      ord.chr
    end
    puts str.join
    

    Just run with Ruby:

    Welcome to the SECCON 2014 online CTF.The SECCON is the biggest hacker contest in Japan.Oops, you want to know the flag, don't you?Here you are.SECCON{W31C0M 70 7H3 53CC0N ZOIA}Have fun!
    

    Finally the flag is:

    SECCON{W31C0M 70 7H3 53CC0N ZOIA}
    
  • SECCON CTF 2014: QR (Easy) Write-up

    QR200 - QR (Easy)

    Funniest joke in the world(?):
    “Last night, I had a dream I was eating QR cakes….
    but when I woke up, half my QR code was gone!”

    QR (Easy)


    世界一面白いジョーク:
    昨晩フランネルケーキを食べる夢を見たんだけど、
    朝起きたらQRコードが半分なくなってたんだ!

    Read on →

  • Automatically Quit Vim if Actual Files are Closed

    Vim

    Sidebar

    Many Vim user use plugins which open sidebar like NERDTree or Tag List. In my case, I always open NERDTree and Tag List on Vim startup. Their file and tag navigation features are extremely handy.

    We use :q to quit, :q! or ZQ to quit without saving, :wq, :x or ZZ to save and quit. But these commands are applied to only one buffer. NERDTree or Tag List windows are not closed until we close them individually or quit all using :qa.

    Getting into the Problem

    But as one of the Vim users, I close it within a few minutes or even a few seconds after I opened it. I want to keep quitting Vim easy. Using :qa everytime doesn’t make sence. Actually, NERDTree gives us a tip to close Vim if the only window left open is a NERDTree:

    autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
    

    If I close the last window when a NERDTree exists, Vim automatically closes. But what if we have Tag List window also? winnr("$") returns the current window count, so the above code triggers only when the window count is 1. So Vim will quit automatically only when NERDTree is the last window.

    Read on →

  • On becoming an expert C programmer →

    The following is from an EMail message that I sent to to an individual on 12-Apr-2001. You may find this EMail message useful.

    The Writer asked:

    ``I just recently visited your website … Just wanted to say greetings and ask a simple question: Do you think I stand a chance in the C programming field if I keep it up? Tell me what I should do in order to keep strong feelings towards C.’’

  • Yet Another Hex Word

    #01de57 #0a7 #0dd #0ff #0ff1ce #10ca1e #57ab1e #5ad #5afe57 #50f7ba11 #70e #7a7700 #7ab #7ab1e7 #7ea #ad1da5 #affec7 #b01dface #b0771e #ba11ad #ba5eba11 #c0ffee #c105e7 #c105ed #ca7 #cafebabe #d00d1e #d1ab10 #dad #de7ec7 #deadbeef #dec0de #defea7 #defec7 #defec7ed #ea7 #effec7 #f007ba11 #f01ded #faceb00c