当前位置:网站首页>[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))
边栏推荐
- Interpretation of Flink source code (III): Interpretation of executiongraph source code
- 肖申克的救赎有感
- Wu Jun's trilogy insight (V) refusing fake workers
- Control transfer instruction
- PostgreSQL 14.2, 13.6, 12.10, 11.15 and 10.20 releases
- Set up the flutter environment pit collection
- Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
- Learn the wisdom of investment Masters
- JVM class loading subsystem
- Use of mongodb in node
猜你喜欢
随机推荐
mysql的列的数据类型详解
唯有学C不负众望 TOP2 p1变量
MySQL字符串函数
js垃圾回收机制和内存泄漏
Flink 解析(四):恢复机制
关于Stream和Map的巧用
Shawshank's sense of redemption
Only learning C can live up to expectations TOP4 S1E6: data type
MySQL数字函数
Prototype chain inheritance
PostgreSQL 14.2, 13.6, 12.10, 11.15 and 10.20 releases
JVM之垃圾回收器下篇
Jetpack compose 1.1 release, based on kotlin's Android UI Toolkit
在 vi 编辑器中的命令模式下,删除当前光标处的字符使用 __ 命 令。
Mongodb在node中的使用
arithmetic operation
字节跳动春招攻略:学长学姐笔经面经,还有出题人「锦囊」
Wu Jun's trilogy experience (VII) the essence of Commerce
關於Stream和Map的巧用
Von Neumann architecture