# RazviOverflow

from pwn import *
import zlib
import base64

# https://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
def inflate(data):
    #decompress = zlib.decompressobj(-zlib.MAX_WBITS)
    inflated = zlib.decompress(data)
    #inflated += zlib.flush()
    return inflated.decode("utf-8")

# From https://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
def decode_base64_and_inflate( b64string ):
    decoded_data = base64.b64decode(b64string, "-_")
    return inflate( decoded_data)

p = remote("35.246.158.241", 30948)

#encoded_string = "eJwrzy_Kji8oys9Psy3OSExJtCg0sTRJszA0TjFOLLS0zEhLS0sxzUy1SLIwAABYfg6x"
context.log_level = "debug"
number_of_tests = 0
while True:
	print("[+] TEST {}".format(number_of_tests))
	p.recvuntil(b"!!!\r\n")
	encoded_string = (p.recvline()).decode("utf-8")
	encoded_string = f"{encoded_string}{'=' * (len(encoded_string) % 4)}"
	answer = decode_base64_and_inflate(encoded_string)
	p.recv()
	"Encoded string: {}\nAnswer: {}".format(encoded_string.encode("utf-8"), answer)
	p.sendline(answer)
	number_of_tests += 1
	#print(p.recv())



99872abaf272f43aeba8cde421c9eb4bfe900823
<mask token>


def inflate(data):
    inflated = zlib.decompress(data)
    return inflated.decode('utf-8')


<mask token>

<mask token>


def inflate(data):
    inflated = zlib.decompress(data)
    return inflated.decode('utf-8')


def decode_base64_and_inflate(b64string):
    decoded_data = base64.b64decode(b64string, '-_')
    return inflate(decoded_data)


<mask token>
while True:
    print('[+] TEST {}'.format(number_of_tests))
    p.recvuntil(b'!!!\r\n')
    encoded_string = p.recvline().decode('utf-8')
    encoded_string = f"{encoded_string}{'=' * (len(encoded_string) % 4)}"
    answer = decode_base64_and_inflate(encoded_string)
    p.recv()
    """Encoded string: {}
Answer: {}""".format(encoded_string.encode(
        'utf-8'), answer)
    p.sendline(answer)
    number_of_tests += 1

<mask token>


def inflate(data):
    inflated = zlib.decompress(data)
    return inflated.decode('utf-8')


def decode_base64_and_inflate(b64string):
    decoded_data = base64.b64decode(b64string, '-_')
    return inflate(decoded_data)


p = remote('35.246.158.241', 30948)
context.log_level = 'debug'
number_of_tests = 0
while True:
    print('[+] TEST {}'.format(number_of_tests))
    p.recvuntil(b'!!!\r\n')
    encoded_string = p.recvline().decode('utf-8')
    encoded_string = f"{encoded_string}{'=' * (len(encoded_string) % 4)}"
    answer = decode_base64_and_inflate(encoded_string)
    p.recv()
    """Encoded string: {}
Answer: {}""".format(encoded_string.encode(
        'utf-8'), answer)
    p.sendline(answer)
    number_of_tests += 1

from pwn import *
import zlib
import base64


def inflate(data):
    inflated = zlib.decompress(data)
    return inflated.decode('utf-8')


def decode_base64_and_inflate(b64string):
    decoded_data = base64.b64decode(b64string, '-_')
    return inflate(decoded_data)


p = remote('35.246.158.241', 30948)
context.log_level = 'debug'
number_of_tests = 0
while True:
    print('[+] TEST {}'.format(number_of_tests))
    p.recvuntil(b'!!!\r\n')
    encoded_string = p.recvline().decode('utf-8')
    encoded_string = f"{encoded_string}{'=' * (len(encoded_string) % 4)}"
    answer = decode_base64_and_inflate(encoded_string)
    p.recv()
    """Encoded string: {}
Answer: {}""".format(encoded_string.encode(
        'utf-8'), answer)
    p.sendline(answer)
    number_of_tests += 1

# RazviOverflow

from pwn import *
import zlib
import base64

# https://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
def inflate(data):
    #decompress = zlib.decompressobj(-zlib.MAX_WBITS)
    inflated = zlib.decompress(data)
    #inflated += zlib.flush()
    return inflated.decode("utf-8")

# From https://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
def decode_base64_and_inflate( b64string ):
    decoded_data = base64.b64decode(b64string, "-_")
    return inflate( decoded_data)

p = remote("35.246.158.241", 30948)

#encoded_string = "eJwrzy_Kji8oys9Psy3OSExJtCg0sTRJszA0TjFOLLS0zEhLS0sxzUy1SLIwAABYfg6x"
context.log_level = "debug"
number_of_tests = 0
while True:
	print("[+] TEST {}".format(number_of_tests))
	p.recvuntil(b"!!!\r\n")
	encoded_string = (p.recvline()).decode("utf-8")
	encoded_string = f"{encoded_string}{'=' * (len(encoded_string) % 4)}"
	answer = decode_base64_and_inflate(encoded_string)
	p.recv()
	"Encoded string: {}\nAnswer: {}".format(encoded_string.encode("utf-8"), answer)
	p.sendline(answer)
	number_of_tests += 1
	#print(p.recv())


