TG:Hack

TG:Hack writeup Math Bonanza

Math Bonanza

Author: PewZ

Can you answer 1000 math questions?

nc math.tghack.no 10000

サーバに接続すると簡単な四則演算の問題が出題されます。それに自動的に応答するPythonプログラムを書きます。
# -*- coding:utf-8 -*-
import socket
import sys

def solve(s):
    a = s.split(' ')
    if a[1] == '+':
        return int(a[0]) + int(a[2])
    elif a[1] == '-':
        return int(a[0]) - int(a[2])
    elif a[1] == '*':
        return int(a[0]) * int(a[2])
    elif a[1] == '/':
        return int(a[0]) / int(a[2])

host = 'math.tghack.no'
if len(sys.argv) > 1:
    host = sys.argv[1]
port = 10000
if len(sys.argv) > 2:
    host = int(sys.argv[2])

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((host, port))
client_file = client.makefile('b')

while True:
    s = client.recv(100)
    print(s)
    if 'TG19{' in s:
        sys.exit(1)
    a = s.split('\n')
    for i in range(len(a)):
        if 'Level' in a[i]:
            ans = solve(a[i + 1])
            print(ans)
            client_file.write(str(ans) + "\n")
            client_file.flush()
            break
実行すると次のようになります。
(略)
Level 998/1000
245 - 149
Answer: 
96
Yay!
Level 999/1000
40 / 1
Answer: 
40
Yay!
TG19{calculate_all_the_things}
フラグは、
TG19{calculate_all_the_things}
です。



TG:Hack writeup Exclusive Magic Club

Exclusive Magic Club

Author: Einar Antonsen - Chabz/Chabaluz

Someone sent the Exclusive Magic Club all these 1's and 0's and told us mother_knows_best.

00111001 00101000 01000101 01010001 00011110 00010000 00110000 00011100
00110001 00001011 00011000 00000100 00110001 00111101 00010001 00011100
00101011 00011001 00000111 00010001 00110111 00100100 00111011 00000000
00000100 00011000 00001010 00000101 00011111 00110000 00010000 00000001
00000000 00001001
2進数のASCIIコードと与えられた文字列"mother_knows_best"とを順番にXORを取ります。
s = '''
00111001 00101000 01000101 01010001 00011110 00010000 00110000 00011100
00110001 00001011 00011000 00000100 00110001 00111101 00010001 00011100
00101011 00011001 00000111 00010001 00110111 00100100 00111011 00000000
00000100 00011000 00001010 00000101 00011111 00110000 00010000 00000001
00000000 00001001
'''
key = 'mother_knows_best'
flag = ''
i = 0
for c in s.replace('\n', ' ').strip().split(' '):
flag += chr(int(c, 2) ^ ord(key[i % len(key)]))
i += 1
print(flag)
フラグは、
TG19{bow_down_to_the_AI_overlords}
です。

文系プログラマーのためのPythonで学び直す高校数学
谷尻かおり(メディックエンジニアリング)
日経BP社
2019-03-14


TG:Hack writeup American Standard Code for Information Interchange

American Standard Code for Information Interchange

Author: Einar Antonsen - Chabz/Chabaluz

I got some mystical numbers here, but I don't know what it means. Can you help me?

84 71 49 57 123 65 83 67 73 73 95 97 110 100 95 121 111 117 95 115 104 97 108 108 95 114 101 99 101 105 118 101 125
ASCIIコードを文字列にして出力します。
s = '84 71 49 57 123 65 83 67 73 73 95 97 110 100 95 121 111 117 95 115 104 97 108 108 95 114 101 99 101 105 118 101 125'
flag = ''
for c in s.split(' '):
flag += chr(int(c))
print(flag)
フラグは、
TG19{ASCII_and_you_shall_receive}

TG:Hack writeup Rotarius

Rotarius

Author: Einar Antonsen - Chabz/Chabaluz

This looks like a flag, but something is not quite right... or was it left?

OB19{ocz_hjno_wvndx_otkz_ja_zixmtkodji}
アルファベットを5つずらします。
フラグは、
TG19{the_most_basic_type_of_encryption}
です。



TG:Hack writeup Land of Encoding

Land of Encoding

Author: Einar Antonsen - Chabz/Chabaluz

Handle this flag with care. It is from the 64 wizards and witches based in the Land of Encoding.

VEcxOXtiZV9jYXJlZnVsX3doZW5fZHJvcHBpbmdfdGhlX2Jhc2V9
Base64でデコードします。
フラグは、
TG19{be_careful_when_dropping_the_base}
です。



TG:Hack writeup Echo Chamber

Echo Chamber

Author: PewZ

Echo back what you receive 50 times! See the Python tutorial for more information.

nc echo.tghack.no 5555

サーバからの文字列をそのままエコーバックするPythonプログラムを書きます。
# -*- coding:utf-8 -*-
import socket
import sys

host = 'echo.tghack.no'
if len(sys.argv) > 1:
    host = sys.argv[1]
port = 5555
if len(sys.argv) > 2:
    host = int(sys.argv[2])

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((host, port))
client_file = client.makefile('b')

while True:
    s = client_file.readline().strip()
    print(s)
    if 'TG19{' in s:
        sys.exit(1)
    client_file.write(s + "\n")
    client_file.flush()
実行するとフラグが得られます。
(略)
Expelliarmus
Salvio Hexia
Good job! Here's your flag: TG19{behold_the_echo_chamber_of_secrets}
フラグは、
TG19{behold_the_echo_chamber_of_secrets}
記事検索
ギャラリー
  • TetCTF 2023 NewYearBot
  • UUT CTF writeup Find The Password
  • UUT CTF writeup The Puzzle
  • Hack Zone Tunisia 2019 writeup Microscope
  • Hack Zone Tunisia 2019 writeup Welcome
  • SwampCTF 2019 writeup Brokerboard
  • SwampCTF 2019 writeup Leap of Faith
  • SwampCTF 2019 writeup Last Transmission
  • CBM CTF 2019 writeup Long road
カテゴリー