当前位置:网站首页>[VNCTF 2022]ezmath wp
[VNCTF 2022]ezmath wp
2022-07-06 09:33:00 【bestkasscn】
[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))
边栏推荐
猜你喜欢

Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.

一个数10年工作经验的微服务架构老师的简历

Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021

JVM之垃圾回收器上篇

Wu Jun's trilogy experience (VII) the essence of Commerce

Wu Jun's trilogy insight (V) refusing fake workers

Logical operation instruction

Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance

Eight part essay that everyone likes

Some feelings of brushing leetcode 300+ questions
随机推荐
Assembly language addressing mode
Take you hand-in-hand to do intensive learning experiments -- knock the level in detail
Only learning C can live up to expectations TOP4 S1E6: data type
唯有学C不负众望 TOP5 S1E8|S1E9:字符和字符串&&算术运算符
JS garbage collection mechanism and memory leakage
肖申克的救赎有感
唯有学C不负众望 TOP4 S1E6:数据类型
原型链继承
js垃圾回收机制和内存泄漏
High performance mysql (Third Edition) notes
February database ranking: how long can Oracle remain the first?
Go language uses the thrift protocol to realize the client and service end reports not enough arguments in call to oprot Writemessagebegin error resolution
DOS function call
唯有学C不负众望 TOP3 Demo练习
MySQL string function
Programmer orientation problem solving methodology
Coursera cannot play video
案例:检查空字段【注解+反射+自定义异常】
ByteDance overseas technical team won the championship again: HD video coding has won the first place in 17 items
Flink 解析(一):基础概念解析