Tuesday, April 30, 2019

[Writeup] Mates SS3 Round 4

Programing

Đề bài làm bắt chúng ta phải làm sao từ 2 bình nước x, y có thể tích vx, vy và phải đong nước làm sao cho được z lít. Đây là bài toàn đong nước kinh điển, may mắn là mình đã được học qua ở trường nên có thể làm được bài này một cách nhanh chóng bằng thuật toán dẫn luật.

Soure code:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'''
Luat 1: Neu VX day thi do nuoc trong binh X di               
Luat 2: Neu VY rong thi do day nuoc cho binh Y
Luat 3: Neu VX khong day va VY khong rong thi 
trut nuoc tu binh Y sang binh X cho den khi binh X day    

e lam rong binh
f lam day binh
o do tu binh nay sang binh kia

'''

from pwn import *
host = '125.235.240.166'

port =  11223
r = remote(host,port)
def dongnuoc(Vx,Vy,z):
    x = 0
    y = 0
    s = ''
    s = ""
    while (x!=z) and (y!=z):
        if x == Vx:
            x = 0
            s += '1:e_'
        if y == 0:
            y = Vy
            s += '2:f_'
        if y > 0:
            k = min(Vx-x,y)             
            x = x+k
            y = y-k 
            s += '2:o_'
    return s

def agr():
    r.recvuntil('1: ')
    Vx = int(r.recvuntil('\n').strip())
    r.recvuntil('2: ')
    Vy = int(r.recvuntil('\n').strip())
    r.recvuntil('z: ')
    z = int(r.recvuntil('\n').strip())
    return Vx,Vy,z

for i in range(5):   
    Vx,Vy,z = agr()
    s = dongnuoc(Vx,Vy,z)
    s = s[:-1]
    r.recvuntil('op> ')
    r.sendline(s)
    print r.recvuntil('\n')
    print r.recvuntil('\n')
r.interactive()


Forensics

Đề bài là một file pcap với giao thức chính là NTP và data strem là một chuỗi base64 nhưng không decode ra gì cả, sau khi xem tổng thể mình để ý thấy có 1 gói tin Malformed packet tra google mình biết đó là PNG bị hỏng trong quá trình chuyển tin. Để ý lại một lần nữa mình mới thấy là bản thân khá fail khi chỉ loại 1 loạt dấu !!! mà không thử loại loạt chữ AAA ở đầu. Thử decdoe bằng đoạn mới mình có một bức ảnh PNG chứa flag:


Related Posts:

  • [Writeup] Pragyan CTF - ForensicsWelcome We have a jpg file, I used HXD and see a zip file in it, then I used binwalk to get the zip file. 1 2 3 4 5 6 7 $ binwalk welcome.jpeg DECIMAL HEXADECIMAL DESCRIPTION ---------------------------------… Read More
  • [Writeup] Mates SS3 Round 4 Programing Đề bài làm bắt chúng ta phải làm sao từ 2 bình nước x, y có thể tích vx, vy và phải đong nước làm sao cho được z lít. Đây là bài toàn đong nước kinh điển, may mắn là mình đã được học qua ở trường nên có thể làm đ… Read More
  • [Writeup] Insomnihack final 2019 myBrokenBash For this challenge, the author give us something about stdout and when I try to send something the server will reply the string that I send, it's make me remember to a challenge in Ringzer0 CTF about bash shell… Read More
  • [Writeup] Sunshine CTF 2019 Forensics Golly It's a code of Golly rle file, when I run a code given I just have a alphabet table: Run it and nothing else, I read a rle file document at here. And I know a "$" represents the end of each row and a… Read More
  • [Writeup] HSCTF 2019 FORENSICS Chicken Crossing Use strings and grep command in linux I have a flag. Flag: hsctf{2_get_2_the_other_side} Cool Image The author give us a file with extension is .pdf, but I can open it, check back the… Read More

0 comments:

Post a Comment