Created
August 23, 2019 14:58
-
-
Save Nicholaz99/bbb2cc5b8a014f03a9c34591848c800b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
from Crypto.Util.number import * | |
import gmpy2 | |
import math | |
context.log_level = "error" | |
e = 65537 | |
r = remote('68.183.158.95', 7777) | |
r.recvuntil("\n") | |
c = int(r.recvuntil("\n").strip().split("- ")[1]) | |
r.recvuntil('Exit\n') | |
r.sendline("2") | |
r.recvuntil('\n') | |
# retrieve N with input: -1 | |
r.sendline("-1") | |
n = int(r.recvuntil('\n').strip()) + 1 | |
# start retrieving flag | |
r.recvuntil("Exit\n") | |
r.sendline("2") | |
r.recvuntil('\n') | |
# Craft Payload | |
mul = pow(2, e, n) | |
payload = c*mul % n | |
r.sendline(str(payload)) | |
flag = int(r.recvuntil('\n').strip()) | |
print "Flag:", long_to_bytes(flag/2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment