当前位置:网站首页>[VNCTF 2022]ezmath wp
[VNCTF 2022]ezmath wp
2022-07-06 17:20:00 【bestkasscn】
[VNCTF 2022]ezmath wp
One sha256 Blast + A mathematical problem , You can go to baidu , The answer is num * 4, But looking at the source code, you can find that you want to submit 777 Secondary answer , So we can only write scripts to solve , This kind of interactive question is generally to nc The server , You can also use python Third party Library in pwntools.
exp
from hashlib import sha256
import random
from pwn import *
import string
# Create a dictionary of upper and lower case letters and numbers
dir = string.ascii_letters + string.digits
# Change the environment yourself
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)
# Burst four digit string
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
# Decryption of mathematical problems
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))
边栏推荐
猜你喜欢
Alibaba cloud server builds SVN version Library
JVM类加载子系统
Activiti目录(四)查询代办/已办、审核
February database ranking: how long can Oracle remain the first?
微信防撤回是怎么实现的?
Take you hand-in-hand to do intensive learning experiments -- knock the level in detail
Flink 解析(一):基础概念解析
Compile homework after class
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
Prototype chain inheritance
随机推荐
【逆向初级】独树一帜
Install docker under windows10 (through Oracle VM VirtualBox)
Garbage first of JVM garbage collector
Interpretation of Flink source code (III): Interpretation of executiongraph source code
Resume of a microservice architecture teacher with 10 years of work experience
arithmetic operation
Typescript basic operations
汇编语言基础知识
Shawshank's sense of redemption
8086 memory
关于Stream和Map的巧用
Activiti directory (I) highlights
關於Stream和Map的巧用
唯有学C不负众望 TOP4 S1E6:数据类型
Ruoyi-Cloud 踩坑的BUG
Take you hand-in-hand to do intensive learning experiments -- knock the level in detail
Flink 解析(三):内存管理
Description of project structure configuration of idea
唯有学C不负众望 TOP1环境配置
Akamai浅谈风控原理与解决方案