[VNCTF 2022]ezmath wp

[VNCTF 2022]ezmath wp

一个sha256爆破+一个数学问题,可以去百度一下,得到答案就是num * 4,但是查看源码可以发现要提交777次答案,所以只能写脚本来解决,这类交互题一般是去nc服务器,也可以使用python中的第三方库pwntools。

exp

from hashlib import sha256
import random
from pwn import *
import string

# 创建由大小写字母和数字组成的字典
dir = string.ascii_letters + string.digits
# 自己改环境
p = remote("node4.buuoj.cn", 27166)


p.recvuntil('[+] sha256(XXXX+')
salt = p.recv(16).strip().decode()
p.recvuntil(') == ')
hash = p.recv(64).strip().decode()

print('salt: %s' % salt)
print('target hash: %s' % hash)

# 爆破四位字符串
while True:
    rand_str = (''.join([random.choice(dir) for _ in range(4)])) + salt
    if sha256(rand_str.encode()).hexdigest() == hash:
        print(rand_str[:4])
        p.sendlineafter('[+] Plz Tell Me XXXX :', rand_str[:4])
        break

# 数学题解密
for i in range(777):
    p.recvuntil("plz give me the ")
    count = p.recv(10).strip().decode()
    count = int(count)
    res = str(count*4)
    p.recvuntil('th (n) that satisfying (2^n-1) % 15 == 0   (the 1st 2^n-1 is 15):')
    p.sendline(res)
p.recvuntil('You get flag!')
print(p.recvlines(2))



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

bestkasscn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值