-
Notifications
You must be signed in to change notification settings - Fork 1
/
pow.py
30 lines (25 loc) · 801 Bytes
/
pow.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
import hashlib
import time
from pwn import *
def solve_pow(r):
prefix = r.recvline().decode().split("'")[1]
print(time.time(), "solving pow ...")
solved = b''
for i in range(1000000000):
h = hashlib.sha1((prefix + str(i)).encode()).hexdigest()
if h[:6] == '000000':
solved = str(i).encode()
print("solved =", solved)
break;
print(time.time(), "done.")
r.sendlineafter(b'string S: ', base64.b64encode(solved))
if __name__ == '__main__':
#r = remote('localhost', 10330);
r = remote('up23.zoolab.org', 10330)
solve_pow(r)
r.interactive()
r.close()
# vim: set tabstop=4 expandtab shiftwidth=4 softtabstop=4 number cindent fileencoding=utf-8 :